-
Notifications
You must be signed in to change notification settings - Fork 214
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: add go router package and routing to the app #1401
base: main
Are you sure you want to change the base?
Conversation
import 'package:flutter_news_example/home/home.dart'; | ||
import 'package:flutter_news_example/login/login.dart'; | ||
import 'package:flutter_news_example/magic_link_prompt/view/magic_link_prompt_page.dart'; |
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.
It would be great to be able to use barrel files instead of importing the file directly.
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.
check other imports too
final id = state.pathParameters['id']; | ||
|
||
final isVideoArticle = bool.tryParse( | ||
state.uri.queryParameters['isVideoArticle'] ?? 'false', |
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.
state.uri.queryParameters
can be abstracted as a variable to reuse
: null; | ||
|
||
if (id == null) { | ||
throw Exception('Missing required "id" parameter'); |
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.
What's shown when this happens ? Isn't better to render NetworkError
instead?
@@ -31,6 +33,17 @@ class HomeView extends StatelessWidget { | |||
} | |||
}, | |||
), | |||
BlocListener<AppBloc, AppState>( |
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.
BlocListener<CardActivationCubit, CardActivationState>(
listenWhen: (_, current) => current == AppStatus.onboardingRequired ,
listener: (context, _) => context.goNamed(OnboardingPage.routePath),
),
Something like this could be simpler, what do you think?
@@ -40,7 +45,7 @@ void main() { | |||
|
|||
testWidgets('renders FeedView', (tester) async { | |||
await tester.pumpApp( | |||
const HomePage(), | |||
InheritedGoRouter(goRouter: router, child: const HomePage()), |
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.
Why is InheritedGoRouter
necessary?
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.
I don't think we should remove these tests, but adapt them to the new approach to navigation.
Description
Routing refactored now using go_router package.
TO DO:
Demo videos
Profile, Notification preferences and Subscriptions page:
1.mov
Article page, slideshow and Subscriptions page:
2.mov
Login flow
4.mov
Article details
3.mov
Type of Change