diff --git a/assets/icons/logo.png b/assets/icons/logo.png index 5a51bdf..2ceca22 100644 Binary files a/assets/icons/logo.png and b/assets/icons/logo.png differ diff --git a/assets/images/logo_name.png b/assets/images/logo_name.png new file mode 100644 index 0000000..9399acb Binary files /dev/null and b/assets/images/logo_name.png differ diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index c920f01..664b2f6 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -2,5 +2,6 @@ "title": "Hello, World!", "subtitle": "Welcome to Localization", "description": "You have pushed the button this many times:", - "switch_language": "Switch language" + "switch_language": "Switch language", + "applications": "Applications" } \ No newline at end of file diff --git a/lib/l10n/app_es.arb b/lib/l10n/app_es.arb index 54b60e7..e80fe14 100644 --- a/lib/l10n/app_es.arb +++ b/lib/l10n/app_es.arb @@ -1,6 +1,7 @@ { "title": "¡Hola, Mundo!", "subtitle": "Bienvenido a Localización", -"description": "Has pulsado el botón tantas veces:", -"switch_language": "Cambiar idioma" + "description": "Has pulsado el botón tantas veces:", + "switch_language": "Cambiar idioma", + "applications": "Aplicaciones" } diff --git a/lib/l10n/app_fr.arb b/lib/l10n/app_fr.arb index a099905..a91a8b8 100644 --- a/lib/l10n/app_fr.arb +++ b/lib/l10n/app_fr.arb @@ -1,6 +1,7 @@ { "title": "Bonjour", "subtitle": "Bienvenue dans Localisation", -"description": "Vous avez appuyé sur le bouton autant de fois :", -"switch_language": "Changer de langue" -} \ No newline at end of file + "description": "Vous avez appuyé sur le bouton autant de fois :", + "switch_language": "Changer de langue", + "applications": "Applications" +} diff --git a/lib/main.dart b/lib/main.dart index fe2a75c..70bd10c 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -2,9 +2,9 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:gui/src/core/router/app_router.dart'; import 'package:gui/src/features/main/theme/bloc/theme_bloc.dart'; import 'src/features/main/language/presentation/bloc/language_bloc.dart'; -import 'src/features/splash_screen/presentation/screen/home_page.dart'; void main() { runApp( @@ -31,11 +31,12 @@ class MyApp extends StatelessWidget { builder: (context, languageState) { return BlocBuilder( builder: (context, themeState) { - return MaterialApp( + return MaterialApp.router( debugShowCheckedModeBanner: false, + routerConfig: routerConfig, title: 'Flutter Demo', - theme: themeState.themeData, locale: languageState.selectedLanguage.value, + theme: themeState.themeData, localizationsDelegates: const [ AppLocalizations.delegate, GlobalMaterialLocalizations.delegate, @@ -43,11 +44,10 @@ class MyApp extends StatelessWidget { GlobalCupertinoLocalizations.delegate, ], supportedLocales: const [ - Locale('en'), // English - Locale('es'), // Spanish - Locale('fr'), // French + Locale('en'), + Locale('es'), + Locale('fr'), ], - home: const MyHomePage(), ); }, ); diff --git a/lib/presentation/bloc/language_bloc/language_bloc.dart b/lib/presentation/bloc/language_bloc/language_bloc.dart new file mode 100644 index 0000000..ae23aee --- /dev/null +++ b/lib/presentation/bloc/language_bloc/language_bloc.dart @@ -0,0 +1,16 @@ +import 'package:bloc/bloc.dart'; +import '../../../src/features/main/language/presentation/bloc/language_bloc.dart'; + +const languagePrefsKey = 'languagePrefs'; + +class LanguageBloc extends Bloc { + LanguageBloc() : super(const LanguageState()) { + on(onChangeLanguage); + } + Future onChangeLanguage( + ChangeLanguage event, + Emitter emit, + ) async { + emit(state.copyWith(selectedLanguage: event.selectedLanguage)); + } +} diff --git a/lib/src/core/common/colors/app_colors.dart b/lib/src/core/common/colors/app_colors.dart index 98f70b3..2b031c4 100644 --- a/lib/src/core/common/colors/app_colors.dart +++ b/lib/src/core/common/colors/app_colors.dart @@ -3,4 +3,5 @@ import 'package:flutter/material.dart' show Color; class AppColors { AppColors._(); static const primaryDark = Color(0xFF242424); + static const splashBackground = Color(0xFF00142E); } diff --git a/lib/src/core/router/app_router.dart b/lib/src/core/router/app_router.dart new file mode 100644 index 0000000..32a5970 --- /dev/null +++ b/lib/src/core/router/app_router.dart @@ -0,0 +1,16 @@ +import 'package:go_router/go_router.dart'; +import 'package:gui/src/features/splash/presentation/screen/splash_screen.dart'; +import 'basic_routes.dart'; +import 'registration_routes.dart'; + +final GoRouter routerConfig = GoRouter( + debugLogDiagnostics: true, + routes: [ + GoRoute( + path: '/', + builder: (context, state) => SplashScreen(), + ), + ...basicRoutes, + ...registrationRoutes, + ], +); diff --git a/lib/src/core/router/basic_routes.dart b/lib/src/core/router/basic_routes.dart new file mode 100644 index 0000000..4547add --- /dev/null +++ b/lib/src/core/router/basic_routes.dart @@ -0,0 +1,22 @@ +import 'package:go_router/go_router.dart'; +import 'package:gui/src/features/dashboard/presentation/screen/dashboard_page.dart'; +import 'package:gui/src/features/password/presentation/screen/password_page.dart'; +import 'route_name.dart'; + +final List basicRoutes = [ + GoRoute( + path: AppRoute.basicPassword.fullPath, + name: AppRoute.basicPassword.name, + builder: (context, state) => PasswordPage( + fromRegistrationRoute: + state.matchedLocation.contains(AppRoute.finish.name), + ), + routes: [ + GoRoute( + path: AppRoute.basicDashboard.path, + name: AppRoute.basicDashboard.name, + builder: (context, state) => const DashboardPage(), + ), + ], + ), +]; diff --git a/lib/src/core/router/registration_routes.dart b/lib/src/core/router/registration_routes.dart new file mode 100644 index 0000000..8e7b88b --- /dev/null +++ b/lib/src/core/router/registration_routes.dart @@ -0,0 +1,90 @@ +import 'package:go_router/go_router.dart'; +import 'package:gui/src/features/confirmation_seed/presentation/screen/confirmation_seed_page.dart'; +import 'package:gui/src/features/dashboard/presentation/screen/dashboard_page.dart'; +import 'package:gui/src/features/finish/presentation/screen/finish_page.dart'; +import 'package:gui/src/features/initialize_mode/presentation/screen/initialize_mode_page.dart'; +import 'package:gui/src/features/initializing/presentation/screen/initializing_page.dart'; +import 'package:gui/src/features/master_password/presentation/screen/master_password_page.dart'; +import 'package:gui/src/features/password/presentation/screen/password_page.dart'; +import 'package:gui/src/features/restoration_seed/presentation/screen/restoration_seed_page.dart'; +import 'package:gui/src/features/validator_config/presentation/screen/validator_config_page.dart'; +import 'package:gui/src/features/welcome/presentation/screen/welcome_page.dart'; +import 'route_name.dart'; + +final List registrationRoutes = [ + GoRoute( + path: AppRoute.welcome.fullPath, + name: AppRoute.welcome.name, + builder: (context, state) => const WelcomePage(), + routes: [ + GoRoute( + path: AppRoute.initializeMode.path, + name: AppRoute.initializeMode.name, + builder: (context, state) => const InitializeModePage(), + routes: [ + GoRoute( + path: AppRoute.restorationSeed.path, + name: AppRoute.restorationSeed.name, + builder: (context, state) => const RestorationSeedPage(), + routes: [ + GoRoute( + path: AppRoute.confirmationSeed.path, + name: AppRoute.confirmationSeed.name, + builder: (context, state) => const ConfirmationSeedPage(), + routes: [ + GoRoute( + path: AppRoute.masterPassword.path, + name: AppRoute.masterPassword.name, + builder: (context, state) => const MasterPasswordPage(), + routes: [ + GoRoute( + path: AppRoute.validatorConfig.path, + name: AppRoute.validatorConfig.name, + builder: (context, state) => + const ValidatorConfigPage(), + routes: [ + GoRoute( + path: AppRoute.initializing.path, + name: AppRoute.initializing.name, + builder: (context, state) => + const InitializingPage(), + routes: [ + GoRoute( + path: AppRoute.finish.path, + name: AppRoute.finish.name, + builder: (context, state) => const FinishPage(), + routes: [ + GoRoute( + path: AppRoute.password.path, + name: AppRoute.password.name, + builder: (context, state) => PasswordPage( + fromRegistrationRoute: state + .matchedLocation + .contains(AppRoute.finish.name), + ), + routes: [ + GoRoute( + path: AppRoute.dashboard.path, + name: AppRoute.dashboard.name, + builder: (context, state) => + const DashboardPage(), + ), + ], + ), + ], + ), + ], + ), + ], + ), + ], + ), + ], + ), + ], + ), + ], + ), + ], + ), +]; diff --git a/lib/src/core/router/route_name.dart b/lib/src/core/router/route_name.dart new file mode 100644 index 0000000..9047a97 --- /dev/null +++ b/lib/src/core/router/route_name.dart @@ -0,0 +1,18 @@ +enum AppRoute { + splash, + welcome, + initializeMode, + restorationSeed, + confirmationSeed, + masterPassword, + validatorConfig, + initializing, + finish, + password, + dashboard, + basicPassword, + basicDashboard; + + String get fullPath => '/$name'; + String get path => name; +} diff --git a/lib/src/core/utils/assets/assets.gen.dart b/lib/src/core/utils/assets/assets.gen.dart index c0636b9..99f3dd8 100644 --- a/lib/src/core/utils/assets/assets.gen.dart +++ b/lib/src/core/utils/assets/assets.gen.dart @@ -48,6 +48,10 @@ class $AssetsImagesGen { /// File path: assets/images/gift.png AssetGenImage get gift => const AssetGenImage('assets/images/gift.png'); + /// File path: assets/images/logo_name.png + AssetGenImage get logoName => + const AssetGenImage('assets/images/logo_name.png'); + /// File path: assets/images/master_password.png AssetGenImage get masterPassword => const AssetGenImage('assets/images/master_password.png'); @@ -56,7 +60,8 @@ class $AssetsImagesGen { AssetGenImage get splash => const AssetGenImage('assets/images/splash.png'); /// List of all assets - List get values => [gears, gift, masterPassword, splash]; + List get values => + [gears, gift, logoName, masterPassword, splash]; } class Assets { diff --git a/lib/src/features/confirmation_seed/presentation/screen/confirmation_seed_page.dart b/lib/src/features/confirmation_seed/presentation/screen/confirmation_seed_page.dart new file mode 100644 index 0000000..62a2be3 --- /dev/null +++ b/lib/src/features/confirmation_seed/presentation/screen/confirmation_seed_page.dart @@ -0,0 +1,24 @@ +import 'package:flutter/material.dart'; +import 'package:go_router/go_router.dart'; +import 'package:gui/src/core/router/route_name.dart'; + +class ConfirmationSeedPage extends StatelessWidget { + const ConfirmationSeedPage({super.key}); + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: const Text('Confirmation Seed Page'), + ), + body: Center( + child: ElevatedButton( + onPressed: () { + context.goNamed(AppRoute.masterPassword.name); + }, + child: Text('Navigate to ${AppRoute.masterPassword.name}'), + ), + ), + ); + } +} diff --git a/lib/src/features/dashboard/presentation/screen/dashboard_page.dart b/lib/src/features/dashboard/presentation/screen/dashboard_page.dart new file mode 100644 index 0000000..293ba57 --- /dev/null +++ b/lib/src/features/dashboard/presentation/screen/dashboard_page.dart @@ -0,0 +1,14 @@ +import 'package:flutter/material.dart'; + +class DashboardPage extends StatelessWidget { + const DashboardPage({super.key}); + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: const Text('Dashboard Page'), + ), + ); + } +} diff --git a/lib/src/features/finish/presentation/screen/finish_page.dart b/lib/src/features/finish/presentation/screen/finish_page.dart new file mode 100644 index 0000000..9a18209 --- /dev/null +++ b/lib/src/features/finish/presentation/screen/finish_page.dart @@ -0,0 +1,24 @@ +import 'package:flutter/material.dart'; +import 'package:go_router/go_router.dart'; +import 'package:gui/src/core/router/route_name.dart'; + +class FinishPage extends StatelessWidget { + const FinishPage({super.key}); + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: const Text('Finish Page'), + ), + body: Center( + child: ElevatedButton( + onPressed: () { + context.goNamed(AppRoute.password.name); + }, + child: Text('Navigate to ${AppRoute.password.name}'), + ), + ), + ); + } +} diff --git a/lib/src/features/initialize_mode/presentation/screen/initialize_mode_page.dart b/lib/src/features/initialize_mode/presentation/screen/initialize_mode_page.dart new file mode 100644 index 0000000..e9219ff --- /dev/null +++ b/lib/src/features/initialize_mode/presentation/screen/initialize_mode_page.dart @@ -0,0 +1,24 @@ +import 'package:flutter/material.dart'; +import 'package:go_router/go_router.dart'; +import 'package:gui/src/core/router/route_name.dart'; + +class InitializeModePage extends StatelessWidget { + const InitializeModePage({super.key}); + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: const Text('Initialize Mode'), + ), + body: Center( + child: ElevatedButton( + onPressed: () { + context.goNamed(AppRoute.restorationSeed.name); + }, + child: Text('Navigate to ${AppRoute.restorationSeed.name}'), + ), + ), + ); + } +} diff --git a/lib/src/features/initializing/presentation/screen/initializing_page.dart b/lib/src/features/initializing/presentation/screen/initializing_page.dart new file mode 100644 index 0000000..564c874 --- /dev/null +++ b/lib/src/features/initializing/presentation/screen/initializing_page.dart @@ -0,0 +1,24 @@ +import 'package:flutter/material.dart'; +import 'package:go_router/go_router.dart'; +import 'package:gui/src/core/router/route_name.dart'; + +class InitializingPage extends StatelessWidget { + const InitializingPage({super.key}); + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: const Text('Initializing Page'), + ), + body: Center( + child: ElevatedButton( + onPressed: () { + context.goNamed(AppRoute.finish.name); + }, + child: Text('Navigate to ${AppRoute.finish.name}'), + ), + ), + ); + } +} diff --git a/lib/src/features/main/language/presentation/bloc/language_bloc.dart b/lib/src/features/main/language/presentation/bloc/language_bloc.dart index 3009d28..3829c57 100644 --- a/lib/src/features/main/language/presentation/bloc/language_bloc.dart +++ b/lib/src/features/main/language/presentation/bloc/language_bloc.dart @@ -4,8 +4,6 @@ import 'package:gui/src/features/main/language/data/language_model.dart'; part 'language_event.dart'; part 'language_state.dart'; -const languagePrefsKey = 'languagePrefs'; - class LanguageBloc extends Bloc { LanguageBloc() : super(const LanguageState()) { on(onChangeLanguage); diff --git a/lib/src/features/master_password/presentation/screen/master_password_page.dart b/lib/src/features/master_password/presentation/screen/master_password_page.dart new file mode 100644 index 0000000..d142ce9 --- /dev/null +++ b/lib/src/features/master_password/presentation/screen/master_password_page.dart @@ -0,0 +1,24 @@ +import 'package:flutter/material.dart'; +import 'package:go_router/go_router.dart'; +import 'package:gui/src/core/router/route_name.dart'; + +class MasterPasswordPage extends StatelessWidget { + const MasterPasswordPage({super.key}); + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: const Text('Master Password Page'), + ), + body: Center( + child: ElevatedButton( + onPressed: () { + context.goNamed(AppRoute.validatorConfig.name); + }, + child: Text('Navigate to ${AppRoute.validatorConfig.name}'), + ), + ), + ); + } +} diff --git a/lib/src/features/password/presentation/screen/password_page.dart b/lib/src/features/password/presentation/screen/password_page.dart new file mode 100644 index 0000000..15caf89 --- /dev/null +++ b/lib/src/features/password/presentation/screen/password_page.dart @@ -0,0 +1,41 @@ +import 'package:flutter/material.dart'; +import 'package:go_router/go_router.dart'; +import 'package:gui/src/core/router/route_name.dart'; + +class PasswordPage extends StatelessWidget { + const PasswordPage({super.key, required this.fromRegistrationRoute}); + final bool fromRegistrationRoute; + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: const Text('Password'), + ), + body: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + fromRegistrationRoute + ? MaterialButton( + onPressed: () { + context.goNamed(AppRoute.dashboard.name); + }, + child: Text( + 'Navigate to ${AppRoute.dashboard.name}', + ), + ) + : MaterialButton( + onPressed: () { + context.goNamed(AppRoute.basicDashboard.name); + }, + child: Text( + 'Navigate to ${AppRoute.basicDashboard.name}', + ), + ), + const SizedBox(height: 20), + ], + ), + ), + ); + } +} diff --git a/lib/src/features/restoration_seed/presentation/screen/restoration_seed_page.dart b/lib/src/features/restoration_seed/presentation/screen/restoration_seed_page.dart new file mode 100644 index 0000000..3a502e6 --- /dev/null +++ b/lib/src/features/restoration_seed/presentation/screen/restoration_seed_page.dart @@ -0,0 +1,24 @@ +import 'package:flutter/material.dart'; +import 'package:go_router/go_router.dart'; +import 'package:gui/src/core/router/route_name.dart'; + +class RestorationSeedPage extends StatelessWidget { + const RestorationSeedPage({super.key}); + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: const Text('Restoration Seed Page'), + ), + body: Center( + child: ElevatedButton( + onPressed: () { + context.goNamed(AppRoute.confirmationSeed.name); + }, + child: Text('Navigate to ${AppRoute.confirmationSeed.name}'), + ), + ), + ); + } +} diff --git a/lib/src/features/splash/presentation/screen/splash_screen.dart b/lib/src/features/splash/presentation/screen/splash_screen.dart new file mode 100644 index 0000000..abe5bc4 --- /dev/null +++ b/lib/src/features/splash/presentation/screen/splash_screen.dart @@ -0,0 +1,71 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_gen/gen_l10n/app_localizations.dart'; +import 'package:gap/gap.dart'; // Add this import +import 'package:go_router/go_router.dart'; +import 'package:gui/src/core/router/route_name.dart'; +import 'package:gui/src/core/utils/assets/assets.gen.dart'; +import '../../../../core/common/colors/app_colors.dart'; + +class SplashScreen extends StatefulWidget { + const SplashScreen({super.key}); + + @override + State createState() => _SplashScreenState(); +} + +class _SplashScreenState extends State { + static const _splashDuration = Duration(seconds: 2); + static const _logoSize = 180.0; + static const _logoNameWidth = 168.0; + static const _logoNameHeight = 34.0; + static const _spacingBetweenElements = 16.0; + + @override + void initState() { + super.initState(); + _initializeApp(); + } + + Future _initializeApp() async { + await Future.delayed(_splashDuration); + if (mounted) { + context.goNamed(AppRoute.welcome.name); + } + } + + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: AppColors.splashBackground, + body: Stack( + children: [ + Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Assets.icons.logo.image( + width: _logoSize, + height: _logoSize, + fit: BoxFit.contain, + ), + Gap(_spacingBetweenElements), + Assets.images.logoName.image( + width: _logoNameWidth, + height: _logoNameHeight, + fit: BoxFit.contain, + ), + Gap(_spacingBetweenElements), + Text( + AppLocalizations.of(context)!.applications, + style: Theme.of(context).textTheme.titleMedium?.copyWith( + color: Colors.white, + ), + ), + ], + ), + ), + ], + ), + ); + } +} diff --git a/lib/src/features/splash_screen/presentation/screen/home_page.dart b/lib/src/features/splash_screen/presentation/screen/home_page.dart deleted file mode 100644 index acde13e..0000000 --- a/lib/src/features/splash_screen/presentation/screen/home_page.dart +++ /dev/null @@ -1,62 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_gen/gen_l10n/app_localizations.dart'; -import 'package:gui/src/core/common/widgets/theme_switcher.dart'; -import 'package:gui/src/core/common/widgets/toolbar_logo.dart'; -import 'package:gui/src/features/main/language/presentation/widget/language_widget.dart'; -import 'package:gui/src/features/main/theme/presentation/widgets/theme_selector.dart'; -import 'package:gui/src/features/main/theme/theme_data/pallets/on_surface_pallet.dart'; - -class MyHomePage extends StatefulWidget { - const MyHomePage({super.key}); - @override - State createState() => _MyHomePageState(); -} - -class _MyHomePageState extends State { - int _counter = 0; - void _incrementCounter() { - setState(() { - _counter++; - }); - } - - @override - Widget build(BuildContext context) { - final theme = Theme.of(context); - return Scaffold( - appBar: AppBar( - actions: [ToolbarLogo(), ThemeSwitcher()], - backgroundColor: theme.colorScheme.inversePrimary, - title: Text(AppLocalizations.of(context)!.title), - ), - body: Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - AppLocalizations.of(context)!.subtitle, - style: theme.textTheme.titleMedium!.copyWith( - color: theme.extension()!.onSurface3, - ), - ), - Text( - '$_counter', - style: theme.textTheme.headlineMedium!.copyWith( - color: theme.extension()!.onSurface3, - ), - ), - const SizedBox(height: 20), - const ThemeSelector(), - const SizedBox(height: 20), - const LanguageSelector(), // Add the language selector here - ], - ), - ), - floatingActionButton: FloatingActionButton( - onPressed: _incrementCounter, - tooltip: 'Increment', - child: const Icon(Icons.add), - ), - ); - } -} diff --git a/lib/src/features/validator_config/presentation/screen/validator_config_page.dart b/lib/src/features/validator_config/presentation/screen/validator_config_page.dart new file mode 100644 index 0000000..82d2312 --- /dev/null +++ b/lib/src/features/validator_config/presentation/screen/validator_config_page.dart @@ -0,0 +1,24 @@ +import 'package:flutter/material.dart'; +import 'package:go_router/go_router.dart'; +import 'package:gui/src/core/router/route_name.dart'; + +class ValidatorConfigPage extends StatelessWidget { + const ValidatorConfigPage({super.key}); + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: const Text('Validator Config Page'), + ), + body: Center( + child: ElevatedButton( + onPressed: () { + context.goNamed(AppRoute.initializing.name); + }, + child: Text('Navigate to ${AppRoute.initializing.name}'), + ), + ), + ); + } +} diff --git a/lib/src/features/welcome/presentation/screen/welcome_page.dart b/lib/src/features/welcome/presentation/screen/welcome_page.dart new file mode 100644 index 0000000..09b54cb --- /dev/null +++ b/lib/src/features/welcome/presentation/screen/welcome_page.dart @@ -0,0 +1,34 @@ +import 'package:flutter/material.dart'; +import 'package:go_router/go_router.dart'; +import 'package:gui/src/core/router/route_name.dart'; + +class WelcomePage extends StatelessWidget { + const WelcomePage({super.key}); + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: const Text('Welcome'), + ), + body: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + const Text( + 'Welcome to the App!', + style: TextStyle(fontSize: 24), + ), + const SizedBox(height: 20), + ElevatedButton( + onPressed: () { + context.goNamed(AppRoute.initializeMode.name); + }, + child: Text('Navigate to ${AppRoute.initializeMode.name}'), + ), + ], + ), + ), + ); + } +} diff --git a/pubspec.yaml b/pubspec.yaml index 8fb1a08..949ba9a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -20,7 +20,9 @@ dependencies: flutter_svg: ^2.0.16 freezed: ^2.5.7 freezed_annotation: ^2.4.4 + gap: ^3.0.1 get_it: ^8.0.2 + go_router: ^14.6.1 intl: ^0.19.0 json_annotation: ^4.9.0 diff --git a/test/src/core/router/app_router_test.dart b/test/src/core/router/app_router_test.dart new file mode 100644 index 0000000..8372910 --- /dev/null +++ b/test/src/core/router/app_router_test.dart @@ -0,0 +1,34 @@ +import 'package:flutter_test/flutter_test.dart'; +import 'package:gui/src/core/router/route_name.dart'; + +void main() { + group('AppRouter Tests', () { + setUp(() { + // Reset any necessary test state + }); + + test('Route names should match enum values', () { + expect(AppRoute.splash.name, 'splash'); + }); + + test('Route names should match enum values', () { + expect(AppRoute.welcome.name, 'welcome'); + }); + + test('Route names should match enum values', () { + expect(AppRoute.initializeMode.name, 'initializeMode'); + }); + + test('Route names should match enum values', () { + expect(AppRoute.restorationSeed.name, 'restorationSeed'); + }); + + test('Route names should match enum values', () { + expect(AppRoute.basicPassword.name, 'basicPassword'); + }); + + test('Route names should match enum values', () { + expect(AppRoute.dashboard.name, 'dashboard'); + }); + }); +}