1
+ // ignore_for_file: prefer_const_constructors
2
+
1
3
import 'package:flutter/material.dart' ;
2
4
import 'package:flutter_twitter_clone/ui/page/Auth/selectAuthMethod.dart' ;
3
5
import 'package:flutter_twitter_clone/ui/page/Auth/verifyEmail.dart' ;
4
6
import 'package:flutter_twitter_clone/ui/page/common/splash.dart' ;
5
7
import 'package:flutter_twitter_clone/ui/page/feed/composeTweet/composeTweet.dart' ;
6
8
import 'package:flutter_twitter_clone/ui/page/feed/composeTweet/state/composeTweetState.dart' ;
9
+ import 'package:flutter_twitter_clone/ui/page/homePage.dart' ;
7
10
import 'package:flutter_twitter_clone/ui/page/message/conversationInformation/conversationInformation.dart' ;
8
11
import 'package:flutter_twitter_clone/ui/page/message/newMessagePage.dart' ;
9
12
import 'package:flutter_twitter_clone/ui/page/profile/follow/followerListPage.dart' ;
@@ -30,25 +33,24 @@ import '../ui/page/Auth/signup.dart';
30
33
import '../ui/page/feed/feedPostDetail.dart' ;
31
34
import '../ui/page/feed/imageViewPage.dart' ;
32
35
import '../ui/page/message/chatScreenPage.dart' ;
33
- import '../ui/page/profile/EditProfilePage.dart' ;
34
36
import '../ui/page/profile/profilePage.dart' ;
35
37
import '../widgets/customWidgets.dart' ;
36
38
37
39
class Routes {
38
40
static dynamic route () {
39
41
return {
40
- 'SplashPage' : (BuildContext context) => SplashPage (),
42
+ 'SplashPage' : (BuildContext context) => const SplashPage (),
41
43
};
42
44
}
43
45
44
- static void sendNavigationEventToFirebase (String path) {
46
+ static void sendNavigationEventToFirebase (String ? path) {
45
47
if (path != null && path.isNotEmpty) {
46
48
// analytics.setCurrentScreen(screenName: path);
47
49
}
48
50
}
49
51
50
- static Route onGenerateRoute (RouteSettings settings) {
51
- final List <String > pathElements = settings.name.split ('/' );
52
+ static Route ? onGenerateRoute (RouteSettings settings) {
53
+ final List <String > pathElements = settings.name! .split ('/' );
52
54
if (pathElements[0 ] != '' || pathElements.length == 1 ) {
53
55
return null ;
54
56
}
@@ -75,105 +77,104 @@ class Routes {
75
77
builder: (BuildContext context) => FeedPostDetail (
76
78
postId: postId,
77
79
),
78
- settings: RouteSettings (name: 'FeedPostDetail' ));
80
+ settings: const RouteSettings (name: 'FeedPostDetail' ));
79
81
case "ProfilePage" :
80
82
String profileId;
81
83
if (pathElements.length > 2 ) {
82
84
profileId = pathElements[2 ];
85
+ return CustomRoute <bool >(
86
+ builder: (BuildContext context) => ProfilePage (
87
+ profileId: profileId,
88
+ ));
83
89
}
84
- return CustomRoute <bool >(
85
- builder: (BuildContext context) => ProfilePage (
86
- profileId: profileId,
87
- ));
90
+ return CustomRoute (builder: (BuildContext context) => const HomePage ());
91
+
88
92
case "CreateFeedPage" :
89
93
return CustomRoute <bool >(
90
94
builder: (BuildContext context) =>
91
95
ChangeNotifierProvider <ComposeTweetState >(
92
96
create: (_) => ComposeTweetState (),
93
- child: ComposeTweetPage (isRetweet: false , isTweet: true ),
97
+ child:
98
+ const ComposeTweetPage (isRetweet: false , isTweet: true ),
94
99
));
95
100
case "WelcomePage" :
96
101
return CustomRoute <bool >(
97
- builder: (BuildContext context) => WelcomePage ());
102
+ builder: (BuildContext context) => const WelcomePage ());
98
103
case "SignIn" :
99
104
return CustomRoute <bool >(builder: (BuildContext context) => SignIn ());
100
105
case "SignUp" :
101
106
return CustomRoute <bool >(builder: (BuildContext context) => Signup ());
102
107
case "ForgetPasswordPage" :
103
108
return CustomRoute <bool >(
104
- builder: (BuildContext context) => ForgetPasswordPage ());
109
+ builder: (BuildContext context) => const ForgetPasswordPage ());
105
110
case "SearchPage" :
106
111
return CustomRoute <bool >(
107
112
builder: (BuildContext context) => SearchPage ());
108
113
case "ImageViewPge" :
109
114
return CustomRoute <bool >(
110
- builder: (BuildContext context) => ImageViewPge ());
115
+ builder: (BuildContext context) => const ImageViewPge ());
111
116
case "ChatScreenPage" :
112
117
return CustomRoute <bool >(
113
- builder: (BuildContext context) => ChatScreenPage ());
118
+ builder: (BuildContext context) => const ChatScreenPage ());
114
119
case "NewMessagePage" :
115
120
return CustomRoute <bool >(
116
121
builder: (BuildContext context) => NewMessagePage (),
117
122
);
118
123
case "SettingsAndPrivacyPage" :
119
124
return CustomRoute <bool >(
120
- builder: (BuildContext context) => SettingsAndPrivacyPage (),
121
- );
122
- case "AccountSettingsPage" :
123
- return CustomRoute <bool >(
124
- builder: (BuildContext context) => AccountSettingsPage (),
125
+ builder: (BuildContext context) => const SettingsAndPrivacyPage (),
125
126
);
126
127
case "AccountSettingsPage" :
127
128
return CustomRoute <bool >(
128
- builder: (BuildContext context) => AccountSettingsPage (),
129
+ builder: (BuildContext context) => const AccountSettingsPage (),
129
130
);
130
131
case "PrivacyAndSaftyPage" :
131
132
return CustomRoute <bool >(
132
- builder: (BuildContext context) => PrivacyAndSaftyPage (),
133
+ builder: (BuildContext context) => const PrivacyAndSaftyPage (),
133
134
);
134
135
case "NotificationPage" :
135
136
return CustomRoute <bool >(
136
- builder: (BuildContext context) => NotificationPage (),
137
+ builder: (BuildContext context) => const NotificationPage (),
137
138
);
138
139
case "ContentPrefrencePage" :
139
140
return CustomRoute <bool >(
140
- builder: (BuildContext context) => ContentPrefrencePage (),
141
+ builder: (BuildContext context) => const ContentPrefrencePage (),
141
142
);
142
143
case "DisplayAndSoundPage" :
143
144
return CustomRoute <bool >(
144
- builder: (BuildContext context) => DisplayAndSoundPage (),
145
+ builder: (BuildContext context) => const DisplayAndSoundPage (),
145
146
);
146
147
case "DirectMessagesPage" :
147
148
return CustomRoute <bool >(
148
- builder: (BuildContext context) => DirectMessagesPage (),
149
+ builder: (BuildContext context) => const DirectMessagesPage (),
149
150
);
150
151
case "TrendsPage" :
151
152
return CustomRoute <bool >(
152
- builder: (BuildContext context) => TrendsPage (),
153
+ builder: (BuildContext context) => const TrendsPage (),
153
154
);
154
155
case "DataUsagePage" :
155
156
return CustomRoute <bool >(
156
- builder: (BuildContext context) => DataUsagePage (),
157
+ builder: (BuildContext context) => const DataUsagePage (),
157
158
);
158
159
case "AccessibilityPage" :
159
160
return CustomRoute <bool >(
160
- builder: (BuildContext context) => AccessibilityPage (),
161
+ builder: (BuildContext context) => const AccessibilityPage (),
161
162
);
162
163
case "ProxyPage" :
163
164
return CustomRoute <bool >(
164
- builder: (BuildContext context) => ProxyPage (),
165
+ builder: (BuildContext context) => const ProxyPage (),
165
166
);
166
167
case "AboutPage" :
167
168
return CustomRoute <bool >(
168
- builder: (BuildContext context) => AboutPage (),
169
+ builder: (BuildContext context) => const AboutPage (),
169
170
);
170
171
case "ConversationInformation" :
171
172
return CustomRoute <bool >(
172
- builder: (BuildContext context) => ConversationInformation (),
173
+ builder: (BuildContext context) => const ConversationInformation (),
173
174
);
174
175
case "FollowingListPage" :
175
176
return CustomRoute <bool >(
176
- builder: (BuildContext context) => FollowingListPage (),
177
+ builder: (BuildContext context) => const FollowingListPage (),
177
178
);
178
179
case "FollowerListPage" :
179
180
return CustomRoute <bool >(
@@ -184,19 +185,21 @@ class Routes {
184
185
builder: (BuildContext context) => VerifyEmailPage (),
185
186
);
186
187
default :
187
- return onUnknownRoute (RouteSettings (name: '/Feature' ));
188
+ return onUnknownRoute (const RouteSettings (name: '/Feature' ));
188
189
}
189
190
}
190
191
191
192
static Route onUnknownRoute (RouteSettings settings) {
192
193
return MaterialPageRoute (
193
- builder: (_ ) => Scaffold (
194
+ builder: (context ) => Scaffold (
194
195
appBar: AppBar (
195
- title: customTitleText (settings.name.split ('/' )[1 ]),
196
+ title: customTitleText (
197
+ settings.name! .split ('/' )[1 ],
198
+ ),
196
199
centerTitle: true ,
197
200
),
198
201
body: Center (
199
- child: Text ('${settings .name .split ('/' )[1 ]} Comming soon..' ),
202
+ child: Text ('${settings .name ! .split ('/' )[1 ]} Comming soon..' ),
200
203
),
201
204
),
202
205
);
0 commit comments