@@ -2,7 +2,6 @@ import 'package:flutter/material.dart';
2
2
import 'package:flutter_bloc/flutter_bloc.dart' ;
3
3
import 'package:go_router/go_router.dart' ;
4
4
import 'package:ht_main/app/bloc/app_bloc.dart' ;
5
- import 'package:ht_main/app/view/app_scaffold.dart' ;
6
5
import 'package:ht_main/authentication/view/authentication_page.dart' ;
7
6
import 'package:ht_main/headline-details/view/headline_details_page.dart' ;
8
7
import 'package:ht_main/headlines-feed/view/headlines_feed_page.dart' ;
@@ -13,34 +12,57 @@ final appRouter = GoRouter(
13
12
initialLocation: Routes .headlinesFeed,
14
13
redirect: (BuildContext context, GoRouterState state) {
15
14
final appStatus = context.read <AppBloc >().state.status;
16
- if (appStatus = = AppStatus .authenticated) {
15
+ if (appStatus ! = AppStatus .authenticated) {
17
16
return Routes .headlinesFeed;
18
17
} else {
19
18
return Routes .authentication;
20
19
}
21
20
},
22
21
routes: [
23
- ShellRoute (
24
- builder: (context, state, child) {
25
- return AppScaffold (child: child);
22
+ GoRoute (
23
+ path: Routes .authentication,
24
+ name: Routes .authenticationName,
25
+ builder: (BuildContext context, GoRouterState state) {
26
+ return const AuthenticationPage ();
26
27
},
27
28
routes: [
28
29
GoRoute (
29
- path: Routes .headlinesFeed ,
30
- name: Routes .headlinesFeedName ,
30
+ path: Routes .forgotPassword ,
31
+ name: Routes .forgotPasswordName ,
31
32
builder: (BuildContext context, GoRouterState state) {
32
- return const HeadlinesFeedPage ();
33
+ return const Placeholder (child: Text ('Forgot Password Page' ));
34
+ },
35
+ ),
36
+ GoRoute (
37
+ path: Routes .resetPassword,
38
+ name: Routes .resetPasswordName,
39
+ builder: (BuildContext context, GoRouterState state) {
40
+ return const Placeholder (child: Text ('Reset Password Page' ));
41
+ },
42
+ ),
43
+ GoRoute (
44
+ path: Routes .confirmEmail,
45
+ name: Routes .confirmEmailName,
46
+ builder: (BuildContext context, GoRouterState state) {
47
+ return const Placeholder (child: Text ('Confirm Email Page' ));
48
+ },
49
+ ),
50
+ ],
51
+ ),
52
+ GoRoute (
53
+ path: Routes .headlinesFeed,
54
+ name: Routes .headlinesFeedName,
55
+ builder: (BuildContext context, GoRouterState state) {
56
+ return const HeadlinesFeedPage ();
57
+ },
58
+ routes: [
59
+ GoRoute (
60
+ path: 'article/:id' ,
61
+ name: Routes .articleDetailsName,
62
+ builder: (BuildContext context, GoRouterState state) {
63
+ final id = state.pathParameters['id' ]! ;
64
+ return HeadlineDetailsPage (headlineId: id);
33
65
},
34
- routes: [
35
- GoRoute (
36
- path: 'article/:id' ,
37
- name: Routes .articleDetailsName,
38
- builder: (BuildContext context, GoRouterState state) {
39
- final id = state.pathParameters['id' ]! ;
40
- return HeadlineDetailsPage (headlineId: id);
41
- },
42
- ),
43
- ],
44
66
),
45
67
GoRoute (
46
68
path: Routes .search,
@@ -58,36 +80,6 @@ final appRouter = GoRouter(
58
80
);
59
81
},
60
82
),
61
- GoRoute (
62
- path: Routes .authentication,
63
- name: Routes .authenticationName,
64
- builder: (BuildContext context, GoRouterState state) {
65
- return const AuthenticationPage ();
66
- },
67
- routes: [
68
- GoRoute (
69
- path: Routes .forgotPassword,
70
- name: Routes .forgotPasswordName,
71
- builder: (BuildContext context, GoRouterState state) {
72
- return const Placeholder (child: Text ('Forgot Password Page' ));
73
- },
74
- ),
75
- GoRoute (
76
- path: Routes .resetPassword,
77
- name: Routes .resetPasswordName,
78
- builder: (BuildContext context, GoRouterState state) {
79
- return const Placeholder (child: Text ('Reset Password Page' ));
80
- },
81
- ),
82
- GoRoute (
83
- path: Routes .confirmEmail,
84
- name: Routes .confirmEmailName,
85
- builder: (BuildContext context, GoRouterState state) {
86
- return const Placeholder (child: Text ('Confirm Email Page' ));
87
- },
88
- ),
89
- ],
90
- ),
91
83
],
92
84
),
93
85
],
0 commit comments