-
Notifications
You must be signed in to change notification settings - Fork 218
feat: add go router package and routing to the app #1401
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
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.
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.
Hi,
Sorry to ask this here.
I am running the flutter_newstoolkit and the static are rendring as expected. Here the command line only working. If I try to run the app in the IDE (Android Studio) it is not showing the apps target in the config.
I am trying to acheive my backend data to fetch in the app. How can I acheive this. I have changed the baseUrl in the app. And Modified some changes still it not working. Also unable to debug the app using the breakpoint.
{
"total": 28,
"size": 20,
"results": [
{
"id": 16,
"created_date": "2025-05-08T15:26:29.160+00:00",
"modified_date": "2025-05-15T18:24:24.715+00:00",
"channel": "Channel",
"pub_id": 2,
"age_restricted_video": false,
"title": "Do the Mavs have their mind set on a specific player at No. 1? #shorts",
"description": "SUBSCRIBE TO OUR",
"body": null,
"labels": null,
"details": {
}
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