Schaban

Middlewares with initial Routes

@@ -191,50 +191,8 @@ class GetCupertinoApp extends StatelessWidget { @@ -191,50 +191,8 @@ class GetCupertinoApp extends StatelessWidget {
191 return PageRedirect(settings, unknownRoute).page(); 191 return PageRedirect(settings, unknownRoute).page();
192 } 192 }
193 193
194 - List<Route<dynamic>> initialRoutesGenerate(String name) {  
195 - final match = Get.routeTree.matchRoute(name);  
196 - Get.parameters = match?.parameters;  
197 -  
198 - //Route can be nullable, just pass the unknown route  
199 - if (match?.route == null) {  
200 - return [  
201 - GetPageRoute(  
202 - page: unknownRoute.page,  
203 - parameter: unknownRoute.parameter,  
204 - settings: RouteSettings(name: name, arguments: null),  
205 - curve: unknownRoute.curve,  
206 - opaque: unknownRoute.opaque,  
207 - routeName: unknownRoute.name,  
208 - customTransition: unknownRoute.customTransition,  
209 - binding: unknownRoute.binding,  
210 - bindings: unknownRoute.bindings,  
211 - transitionDuration: (unknownRoute.transitionDuration ??  
212 - Get.defaultTransitionDuration),  
213 - transition: unknownRoute.transition,  
214 - popGesture: unknownRoute.popGesture,  
215 - fullscreenDialog: unknownRoute.fullscreenDialog,  
216 - )  
217 - ];  
218 - }  
219 -  
220 - return [  
221 - GetPageRoute(  
222 - page: match.route.page,  
223 - parameter: match.route.parameter,  
224 - settings: RouteSettings(name: name, arguments: null),  
225 - curve: match.route.curve,  
226 - opaque: match.route.opaque,  
227 - routeName: match.route.name,  
228 - binding: match.route.binding,  
229 - bindings: match.route.bindings,  
230 - transitionDuration:  
231 - (match.route.transitionDuration ?? Get.defaultTransitionDuration),  
232 - transition: match.route.transition,  
233 - popGesture: match.route.popGesture,  
234 - fullscreenDialog: match.route.fullscreenDialog,  
235 - )  
236 - ];  
237 - } 194 + List<Route<dynamic>> initialRoutesGenerate(String name) =>
  195 + [PageRedirect(RouteSettings(name: name), unknownRoute).page()];
238 196
239 @override 197 @override
240 Widget build(BuildContext context) => GetBuilder<GetMaterialController>( 198 Widget build(BuildContext context) => GetBuilder<GetMaterialController>(
@@ -198,54 +198,11 @@ class GetMaterialApp extends StatelessWidget { @@ -198,54 +198,11 @@ class GetMaterialApp extends StatelessWidget {
198 initialRoute = null, 198 initialRoute = null,
199 super(key: key); 199 super(key: key);
200 200
201 - Route<dynamic> generator(RouteSettings settings) {  
202 - return PageRedirect(settings, unknownRoute).page();  
203 - } 201 + Route<dynamic> generator(RouteSettings settings) =>
  202 + PageRedirect(settings, unknownRoute).page();
204 203
205 - List<Route<dynamic>> initialRoutesGenerate(String name) {  
206 - final match = Get.routeTree.matchRoute(name);  
207 - Get.parameters = match?.parameters;  
208 -  
209 - //Route can be nullable, just pass the unknown route  
210 - if (match?.route == null) {  
211 - return [  
212 - GetPageRoute(  
213 - page: unknownRoute.page,  
214 - parameter: unknownRoute.parameter,  
215 - settings: RouteSettings(name: name, arguments: null),  
216 - curve: unknownRoute.curve,  
217 - opaque: unknownRoute.opaque,  
218 - routeName: unknownRoute.name,  
219 - customTransition: unknownRoute.customTransition,  
220 - binding: unknownRoute.binding,  
221 - bindings: unknownRoute.bindings,  
222 - transitionDuration: (unknownRoute.transitionDuration ??  
223 - Get.defaultTransitionDuration),  
224 - transition: unknownRoute.transition,  
225 - popGesture: unknownRoute.popGesture,  
226 - fullscreenDialog: unknownRoute.fullscreenDialog,  
227 - )  
228 - ];  
229 - }  
230 -  
231 - return [  
232 - GetPageRoute(  
233 - page: match.route.page,  
234 - parameter: match.route.parameter,  
235 - settings: RouteSettings(name: name, arguments: null),  
236 - curve: match.route.curve,  
237 - opaque: match.route.opaque,  
238 - binding: match.route.binding,  
239 - routeName: match.route.name,  
240 - bindings: match.route.bindings,  
241 - transitionDuration:  
242 - (match.route.transitionDuration ?? Get.defaultTransitionDuration),  
243 - transition: match.route.transition,  
244 - popGesture: match.route.popGesture,  
245 - fullscreenDialog: match.route.fullscreenDialog,  
246 - )  
247 - ];  
248 - } 204 + List<Route<dynamic>> initialRoutesGenerate(String name) =>
  205 + [PageRedirect(RouteSettings(name: name), unknownRoute).page()];
249 206
250 @override 207 @override
251 Widget build(BuildContext context) => GetBuilder<GetMaterialController>( 208 Widget build(BuildContext context) => GetBuilder<GetMaterialController>(