-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(router): implement GoRouter navigation system #32
feat(router): implement GoRouter navigation system #32
Conversation
- Setup GoRouter configuration with initial routes • Create app_router.dart with route definitions • Define AppRoute enum for type-safe routing • Configure MaterialApp.router in main.dart - Implement core screens with navigation flow • Add SplashScreen with 2-second auto-navigation • Create HomeScreen with basic layout • Setup proper back navigation handling - Add comprehensive router tests • Test route paths and names validation • Verify navigation flow from splash to home • Ensure proper widget rendering • Test back navigation behavior The implementation follows a feature-first structure and includes: • Type-safe route management • Automatic navigation from splash to home • Proper handling of back navigation • Comprehensive test coverage
- Apply consistent code formatting • Run dart format on all new files • Ensure proper indentation • Maintain consistent style This feature provides a foundation for app-wide navigation using GoRouter, enabling efficient task distribution among team members while maintaining a cohesive navigation pattern throughout the app. The implementation follows a feature-first structure and includes: • Type-safe route management • Automatic navigation from splash to home • Proper handling of back navigation • Comprehensive test coverage • Consistent code formatting Closes #23
@phoenixit99, please amend the commit to resolve the conflict and update the commit message. After making the changes, force-push the updated commit. The highlighted text should be moved to the commit title and follow the Conventional Commits guideline. |
conflict: resolved conflicts approved by esmaeil-ahmadipour
f4e757f
to
cfd5227
Compare
Reorganizes the project structure by moving `app_router` into the inner `src/core` directory to improve modularity and maintainability. No functionality has been changed in this refactor.
Thanks @esmaeil-ahmadipour . I updated the commit and restructured the directories |
I had a look at the implementation compared to the Figma design. The goal for this issue was to create a simple sitemap based on the design, but the current implementation seems incomplete. All pages were expected to be mocked with navigation between them, but only two pages have been connected to the routing system: a splash page and a home page. Looking at the design, there isn’t actually a page named "Home," and what’s labeled as "Splash" is more of a "Welcome" page that quickly navigates to the next screen. Here’s a list of all the main routes we were expecting: Register Route
Basic Route
|
- Add initial route configuration for auth and basic flows - Configure registration flow routes: - Welcome Page - Initialize Mode - Restoration Seed - Confirmation Seed - Master Password - Validator Config - Initializing - Finish - Set up basic flow routes: - SplashScreen - Password - Dashboard BREAKING CHANGE: New routing architecture implementation Requires updated navigation handling throughout the app Resolves: #32
- Add initial route configuration for auth and basic flows - Configure registration flow routes: - Welcome Page - Initialize Mode - Restoration Seed - Confirmation Seed - Master Password - Validator Config - Initializing - Finish - Set up basic flow routes: - SplashScreen - Password - Dashboard BREAKING CHANGE: New routing architecture implementation Requires updated navigation handling throughout the app Resolves: #23
6b32318
to
03da6c4
Compare
conflict: resolved conflicts
conflict: resolved conflicts
Already apply in new PR |
I’ve added 5 comments as a reviewer on certain parts of your code. Whenever you get a time , please take a look at them directly in the PR so I don’t need to rewrite them for you. To make things easier for you this time, I’ve summarized all the points here as new comments. please review and take action on them whenever possible. Let me know once everything is resolved. Thanks so much! Problems :
please if don't use remove it.
please add Gap package and use it and replace with SizedBox
remove this part and write easy way :)
remove this part and write easy way :)
|
- Separate to register route and basic route - Add gap dependency - remove unused code in language_bloc - update code in route_name for easy-to-read
Thanks for your comment, I update the code that resolved all feedback |
- implement test case
@phoenixit99 , henry excellent. good job! Please add a button to all screens to navigate forward through the flow until the end. Make sure users can go back to previous screens, and ensure the last screen (when navigating back) is the first screen of the route, not the splash screen.
|
- remove `routeName` get method - rename `routePath` get method to `path`
fb7f974
to
c6c80a3
Compare
import 'package:bloc/bloc.dart'; | ||
import '../../../src/features/main/language/presentation/bloc/language_bloc.dart'; | ||
|
||
const languagePrefsKey = 'languagePrefs'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import 'package:gui/src/features/welcome/presentation/screen/welcome_page.dart'; | ||
import 'route_name.dart'; | ||
|
||
final GoRouter routerConfig = GoRouter( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all this parts used for register route.
we need another route for basic route.
so create two file one for basic route and another for registration route.
and consume two routes in this file. (in future need move any route parts to self modules.)
height: _logoSize, | ||
fit: BoxFit.contain, | ||
), | ||
const SizedBox(height: _spacingBetweenElements), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lib/src/core/router/route_name.dart
Outdated
String get path => switch (this) { | ||
AppRoute.splash => '/', | ||
AppRoute.dashboard => '/dashboard', | ||
AppRoute.password => '/password', | ||
AppRoute.welcome => '/welcome', | ||
AppRoute.initializeMode => '/initialize-mode', | ||
AppRoute.restorationSeed => '/restoration-seed', | ||
AppRoute.confirmationSeed => '/confirmation-seed', | ||
AppRoute.masterPassword => '/master-password', | ||
AppRoute.validatorConfig => '/validator-config', | ||
AppRoute.initializing => '/initializing', | ||
AppRoute.finish => '/finish', | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove this part and write easy way :)
/// Returns the route path for this enum value.
String get routePath => '/$name';
lib/src/core/router/route_name.dart
Outdated
String get name => switch (this) { | ||
AppRoute.splash => 'splash', | ||
AppRoute.dashboard => 'dashboard', | ||
AppRoute.password => 'password', | ||
AppRoute.welcome => 'welcome', | ||
AppRoute.initializeMode => 'initializeMode', | ||
AppRoute.restorationSeed => 'restorationSeed', | ||
AppRoute.confirmationSeed => 'confirmationSeed', | ||
AppRoute.masterPassword => 'masterPassword', | ||
AppRoute.validatorConfig => 'validatorConfig', | ||
AppRoute.initializing => 'initializing', | ||
AppRoute.finish => 'finish', | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and for this write :
/// Returns the route name for this enum value.
String get routeName => name;
Setup GoRouter configuration with initial routes • Create app_router.dart with route definitions • Define AppRoute enum for type-safe routing • Configure MaterialApp.router in main.dart
Implement core screens with navigation flow • Add SplashScreen with 2-second auto-navigation • Create HomeScreen with basic layout • Setup proper back navigation handling
Add comprehensive router tests • Test route paths and names validation • Verify navigation flow from splash to home • Ensure proper widget rendering • Test back navigation behavior
The implementation follows a feature-first structure and includes: • Type-safe route management
• Automatic navigation from splash to home
• Proper handling of back navigation
• Comprehensive test coverage