/* * Copyright (c) 2024-2026 Fabian Freund. * * This file is part of WebLibre * (see https://weblibre.eu). * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ part of 'routes.dart'; @TypedGoRoute( name: 'ProfileListRoute', path: '/profiles', routes: [ TypedGoRoute(name: 'ProfileEditRoute', path: 'edit'), TypedGoRoute( name: 'ProfileBackupListRoute', path: 'backup_list', ), TypedGoRoute( name: 'RestoreProfileRoute', path: 'restore', ), TypedGoRoute( name: 'BackupProfileRoute', path: 'backup', ), TypedGoRoute( name: 'CreateProfileRoute', path: 'create', ), ], ) class ProfileListRoute extends GoRouteData with $ProfileListRoute { @override Widget build(BuildContext context, GoRouterState state) { return const ProfileListScreen(); } } class CreateProfileRoute extends GoRouteData with $CreateProfileRoute { @override Widget build(BuildContext context, GoRouterState state) { return const ProfileEditScreen(profile: null); } } class EditProfileRoute extends GoRouteData with $EditProfileRoute { final String profile; const EditProfileRoute({required this.profile}); @override Widget build(BuildContext context, GoRouterState state) { return ProfileEditScreen( profile: Profile.fromJson(jsonDecode(profile) as Map), ); } } class BackupProfileRoute extends GoRouteData with $BackupProfileRoute { final String profile; const BackupProfileRoute({required this.profile}); @override Widget build(BuildContext context, GoRouterState state) { return ProfileBackupScreen( profile: Profile.fromJson(jsonDecode(profile) as Map), ); } } class RestoreProfileRoute extends GoRouteData with $RestoreProfileRoute { final String backupFilePath; const RestoreProfileRoute({required this.backupFilePath}); @override Widget build(BuildContext context, GoRouterState state) { return ProfileRestoreScreen(backupFile: File(backupFilePath)); } } class ProfileBackupListRoute extends GoRouteData with $ProfileBackupListRoute { @override Widget build(BuildContext context, GoRouterState state) { return const ProfileBackupListScreen(); } }