Schaban

Fix GetMatrialApp.router and GetCupertinoApp

@@ -237,89 +237,122 @@ class GetCupertinoApp extends StatelessWidget { @@ -237,89 +237,122 @@ class GetCupertinoApp extends StatelessWidget {
237 } 237 }
238 238
239 @override 239 @override
240 - Widget build(BuildContext context) {  
241 - return GetBuilder<GetMaterialController>(  
242 - init: Get.rootController,  
243 - dispose: (d) {  
244 - onDispose?.call();  
245 - },  
246 - initState: (i) {  
247 - Get.engine.addPostFrameCallback((timeStamp) {  
248 - onReady?.call();  
249 - });  
250 - if (locale != null) Get.locale = locale;  
251 -  
252 - if (fallbackLocale != null) Get.fallbackLocale = fallbackLocale; 240 + Widget build(BuildContext context) => GetBuilder<GetMaterialController>(
  241 + init: Get.rootController,
  242 + dispose: (d) {
  243 + onDispose?.call();
  244 + },
  245 + initState: (i) {
  246 + Get.engine.addPostFrameCallback((timeStamp) {
  247 + onReady?.call();
  248 + });
  249 + if (locale != null) Get.locale = locale;
253 250
254 - if (translations != null) {  
255 - Get.addTranslations(translations.keys);  
256 - } else if (translationsKeys != null) {  
257 - Get.addTranslations(translationsKeys);  
258 - } 251 + if (fallbackLocale != null) Get.fallbackLocale = fallbackLocale;
259 252
260 - Get.customTransition = customTransition; 253 + if (translations != null) {
  254 + Get.addTranslations(translations.keys);
  255 + } else if (translationsKeys != null) {
  256 + Get.addTranslations(translationsKeys);
  257 + }
261 258
262 - initialBinding?.dependencies();  
263 - Get.addPages(getPages);  
264 - Get.smartManagement = smartManagement;  
265 - onInit?.call(); 259 + Get.customTransition = customTransition;
266 260
267 - Get.config(  
268 - enableLog: enableLog ?? Get.isLogEnable,  
269 - logWriterCallback: logWriterCallback,  
270 - defaultTransition: defaultTransition ?? Get.defaultTransition,  
271 - defaultOpaqueRoute: opaqueRoute ?? Get.isOpaqueRouteDefault,  
272 - defaultPopGesture: popGesture ?? Get.isPopGestureEnable,  
273 - defaultDurationTransition:  
274 - transitionDuration ?? Get.defaultTransitionDuration,  
275 - );  
276 - },  
277 - builder: (_) {  
278 - return CupertinoApp(  
279 - key: _.unikey,  
280 - theme: theme,  
281 - navigatorKey:  
282 - (navigatorKey == null ? Get.key : Get.addKey(navigatorKey)),  
283 - home: home,  
284 - routes: routes ?? const <String, WidgetBuilder>{},  
285 - initialRoute: initialRoute,  
286 - onGenerateRoute: (getPages != null ? generator : onGenerateRoute),  
287 - onGenerateInitialRoutes: (getPages == null || home != null)  
288 - ? onGenerateInitialRoutes  
289 - : initialRoutesGenerate,  
290 - onUnknownRoute: onUnknownRoute,  
291 - navigatorObservers: (navigatorObservers == null  
292 - ? <NavigatorObserver>[GetObserver(routingCallback, Get.routing)]  
293 - : <NavigatorObserver>[GetObserver(routingCallback, Get.routing)]  
294 - ..addAll(navigatorObservers)),  
295 - builder: (context, child) {  
296 - return Directionality(  
297 - textDirection: textDirection ??  
298 - (rtlLanguages.contains(Get.locale?.languageCode)  
299 - ? TextDirection.rtl  
300 - : TextDirection.ltr),  
301 - child: builder == null ? child : builder(context, child),  
302 - );  
303 - },  
304 - title: title ?? '',  
305 - onGenerateTitle: onGenerateTitle,  
306 - color: color, 261 + initialBinding?.dependencies();
  262 + Get.addPages(getPages);
  263 + Get.smartManagement = smartManagement;
  264 + onInit?.call();
307 265
308 - locale: Get.locale ?? locale,  
309 - localizationsDelegates: localizationsDelegates,  
310 - localeListResolutionCallback: localeListResolutionCallback,  
311 - localeResolutionCallback: localeResolutionCallback,  
312 - supportedLocales:  
313 - supportedLocales ?? const <Locale>[Locale('en', 'US')],  
314 - showPerformanceOverlay: showPerformanceOverlay ?? false,  
315 - checkerboardRasterCacheImages:  
316 - checkerboardRasterCacheImages ?? false,  
317 - checkerboardOffscreenLayers: checkerboardOffscreenLayers ?? false,  
318 - showSemanticsDebugger: showSemanticsDebugger ?? false,  
319 - debugShowCheckedModeBanner: debugShowCheckedModeBanner ?? true,  
320 - shortcuts: shortcuts,  
321 - // actions: actions,  
322 - );  
323 - });  
324 - } 266 + Get.config(
  267 + enableLog: enableLog ?? Get.isLogEnable,
  268 + logWriterCallback: logWriterCallback,
  269 + defaultTransition: defaultTransition ?? Get.defaultTransition,
  270 + defaultOpaqueRoute: opaqueRoute ?? Get.isOpaqueRouteDefault,
  271 + defaultPopGesture: popGesture ?? Get.isPopGestureEnable,
  272 + defaultDurationTransition:
  273 + transitionDuration ?? Get.defaultTransitionDuration,
  274 + );
  275 + },
  276 + builder: (_) => routerDelegate != null
  277 + ? CupertinoApp.router(
  278 + routerDelegate: routerDelegate,
  279 + routeInformationParser: routeInformationParser,
  280 + backButtonDispatcher: backButtonDispatcher,
  281 + routeInformationProvider: routeInformationProvider,
  282 + key: _.unikey,
  283 + theme: theme,
  284 + builder: (context, child) {
  285 + return Directionality(
  286 + textDirection: textDirection ??
  287 + (rtlLanguages.contains(Get.locale?.languageCode)
  288 + ? TextDirection.rtl
  289 + : TextDirection.ltr),
  290 + child: builder == null ? child : builder(context, child),
  291 + );
  292 + },
  293 + title: title ?? '',
  294 + onGenerateTitle: onGenerateTitle,
  295 + color: color,
  296 + locale: Get.locale ?? locale,
  297 + localizationsDelegates: localizationsDelegates,
  298 + localeListResolutionCallback: localeListResolutionCallback,
  299 + localeResolutionCallback: localeResolutionCallback,
  300 + supportedLocales:
  301 + supportedLocales ?? const <Locale>[Locale('en', 'US')],
  302 + showPerformanceOverlay: showPerformanceOverlay ?? false,
  303 + checkerboardRasterCacheImages:
  304 + checkerboardRasterCacheImages ?? false,
  305 + checkerboardOffscreenLayers: checkerboardOffscreenLayers ?? false,
  306 + showSemanticsDebugger: showSemanticsDebugger ?? false,
  307 + debugShowCheckedModeBanner: debugShowCheckedModeBanner ?? true,
  308 + shortcuts: shortcuts,
  309 + )
  310 + : CupertinoApp(
  311 + key: _.unikey,
  312 + theme: theme,
  313 + navigatorKey:
  314 + (navigatorKey == null ? Get.key : Get.addKey(navigatorKey)),
  315 + home: home,
  316 + routes: routes ?? const <String, WidgetBuilder>{},
  317 + initialRoute: initialRoute,
  318 + onGenerateRoute: (getPages != null ? generator : onGenerateRoute),
  319 + onGenerateInitialRoutes: (getPages == null || home != null)
  320 + ? onGenerateInitialRoutes
  321 + : initialRoutesGenerate,
  322 + onUnknownRoute: onUnknownRoute,
  323 + navigatorObservers: (navigatorObservers == null
  324 + ? <NavigatorObserver>[
  325 + GetObserver(routingCallback, Get.routing)
  326 + ]
  327 + : <NavigatorObserver>[
  328 + GetObserver(routingCallback, Get.routing)
  329 + ]
  330 + ..addAll(navigatorObservers)),
  331 + builder: (context, child) {
  332 + return Directionality(
  333 + textDirection: textDirection ??
  334 + (rtlLanguages.contains(Get.locale?.languageCode)
  335 + ? TextDirection.rtl
  336 + : TextDirection.ltr),
  337 + child: builder == null ? child : builder(context, child),
  338 + );
  339 + },
  340 + title: title ?? '',
  341 + onGenerateTitle: onGenerateTitle,
  342 + color: color,
  343 + locale: Get.locale ?? locale,
  344 + localizationsDelegates: localizationsDelegates,
  345 + localeListResolutionCallback: localeListResolutionCallback,
  346 + localeResolutionCallback: localeResolutionCallback,
  347 + supportedLocales:
  348 + supportedLocales ?? const <Locale>[Locale('en', 'US')],
  349 + showPerformanceOverlay: showPerformanceOverlay ?? false,
  350 + checkerboardRasterCacheImages:
  351 + checkerboardRasterCacheImages ?? false,
  352 + checkerboardOffscreenLayers: checkerboardOffscreenLayers ?? false,
  353 + showSemanticsDebugger: showSemanticsDebugger ?? false,
  354 + debugShowCheckedModeBanner: debugShowCheckedModeBanner ?? true,
  355 + shortcuts: shortcuts,
  356 + // actions: actions,
  357 + ));
325 } 358 }
@@ -248,91 +248,128 @@ class GetMaterialApp extends StatelessWidget { @@ -248,91 +248,128 @@ class GetMaterialApp extends StatelessWidget {
248 } 248 }
249 249
250 @override 250 @override
251 - Widget build(BuildContext context) {  
252 - return GetBuilder<GetMaterialController>(  
253 - init: Get.rootController,  
254 - dispose: (d) {  
255 - onDispose?.call();  
256 - },  
257 - initState: (i) {  
258 - Get.engine.addPostFrameCallback((timeStamp) {  
259 - onReady?.call();  
260 - });  
261 - if (locale != null) Get.locale = locale; 251 + Widget build(BuildContext context) => GetBuilder<GetMaterialController>(
  252 + init: Get.rootController,
  253 + dispose: (d) {
  254 + onDispose?.call();
  255 + },
  256 + initState: (i) {
  257 + Get.engine.addPostFrameCallback((timeStamp) {
  258 + onReady?.call();
  259 + });
  260 + if (locale != null) Get.locale = locale;
262 261
263 - if (fallbackLocale != null) Get.fallbackLocale = fallbackLocale; 262 + if (fallbackLocale != null) Get.fallbackLocale = fallbackLocale;
264 263
265 - if (translations != null) {  
266 - Get.addTranslations(translations.keys);  
267 - } else if (translationsKeys != null) {  
268 - Get.addTranslations(translationsKeys);  
269 - } 264 + if (translations != null) {
  265 + Get.addTranslations(translations.keys);
  266 + } else if (translationsKeys != null) {
  267 + Get.addTranslations(translationsKeys);
  268 + }
270 269
271 - Get.customTransition = customTransition; 270 + Get.customTransition = customTransition;
272 271
273 - initialBinding?.dependencies();  
274 - Get.addPages(getPages);  
275 - Get.smartManagement = smartManagement;  
276 - onInit?.call(); 272 + initialBinding?.dependencies();
  273 + Get.addPages(getPages);
  274 + Get.smartManagement = smartManagement;
  275 + onInit?.call();
277 276
278 - Get.config(  
279 - enableLog: enableLog ?? Get.isLogEnable,  
280 - logWriterCallback: logWriterCallback,  
281 - defaultTransition: defaultTransition ?? Get.defaultTransition,  
282 - defaultOpaqueRoute: opaqueRoute ?? Get.isOpaqueRouteDefault,  
283 - defaultPopGesture: popGesture ?? Get.isPopGestureEnable,  
284 - defaultDurationTransition:  
285 - transitionDuration ?? Get.defaultTransitionDuration,  
286 - );  
287 - },  
288 - builder: (_) {  
289 - return MaterialApp(  
290 - key: _.unikey,  
291 - navigatorKey:  
292 - (navigatorKey == null ? Get.key : Get.addKey(navigatorKey)),  
293 - home: home,  
294 - routes: routes ?? const <String, WidgetBuilder>{},  
295 - initialRoute: initialRoute,  
296 - onGenerateRoute: (getPages != null ? generator : onGenerateRoute),  
297 - onGenerateInitialRoutes: (getPages == null || home != null)  
298 - ? onGenerateInitialRoutes  
299 - : initialRoutesGenerate,  
300 - onUnknownRoute: onUnknownRoute,  
301 - navigatorObservers: (navigatorObservers == null  
302 - ? <NavigatorObserver>[GetObserver(routingCallback, Get.routing)]  
303 - : <NavigatorObserver>[GetObserver(routingCallback, Get.routing)]  
304 - ..addAll(navigatorObservers)),  
305 - builder: (context, child) {  
306 - return Directionality(  
307 - textDirection: textDirection ??  
308 - (rtlLanguages.contains(Get.locale?.languageCode)  
309 - ? TextDirection.rtl  
310 - : TextDirection.ltr),  
311 - child: builder == null ? child : builder(context, child),  
312 - );  
313 - },  
314 - title: title ?? '',  
315 - onGenerateTitle: onGenerateTitle,  
316 - color: color,  
317 - theme: _.theme ?? theme ?? ThemeData.fallback(),  
318 - darkTheme: darkTheme,  
319 - themeMode: _.themeMode ?? themeMode ?? ThemeMode.system,  
320 - locale: Get.locale ?? locale,  
321 - localizationsDelegates: localizationsDelegates,  
322 - localeListResolutionCallback: localeListResolutionCallback,  
323 - localeResolutionCallback: localeResolutionCallback,  
324 - supportedLocales:  
325 - supportedLocales ?? const <Locale>[Locale('en', 'US')],  
326 - debugShowMaterialGrid: debugShowMaterialGrid ?? false,  
327 - showPerformanceOverlay: showPerformanceOverlay ?? false,  
328 - checkerboardRasterCacheImages:  
329 - checkerboardRasterCacheImages ?? false,  
330 - checkerboardOffscreenLayers: checkerboardOffscreenLayers ?? false,  
331 - showSemanticsDebugger: showSemanticsDebugger ?? false,  
332 - debugShowCheckedModeBanner: debugShowCheckedModeBanner ?? true,  
333 - shortcuts: shortcuts,  
334 - // actions: actions,  
335 - );  
336 - });  
337 - } 277 + Get.config(
  278 + enableLog: enableLog ?? Get.isLogEnable,
  279 + logWriterCallback: logWriterCallback,
  280 + defaultTransition: defaultTransition ?? Get.defaultTransition,
  281 + defaultOpaqueRoute: opaqueRoute ?? Get.isOpaqueRouteDefault,
  282 + defaultPopGesture: popGesture ?? Get.isPopGestureEnable,
  283 + defaultDurationTransition:
  284 + transitionDuration ?? Get.defaultTransitionDuration,
  285 + );
  286 + },
  287 + builder: (_) => routerDelegate != null
  288 + ? MaterialApp.router(
  289 + routerDelegate: routerDelegate,
  290 + routeInformationParser: routeInformationParser,
  291 + backButtonDispatcher: backButtonDispatcher,
  292 + routeInformationProvider: routeInformationProvider,
  293 + key: _.unikey,
  294 + builder: (context, child) {
  295 + return Directionality(
  296 + textDirection: textDirection ??
  297 + (rtlLanguages.contains(Get.locale?.languageCode)
  298 + ? TextDirection.rtl
  299 + : TextDirection.ltr),
  300 + child: builder == null ? child : builder(context, child),
  301 + );
  302 + },
  303 + title: title ?? '',
  304 + onGenerateTitle: onGenerateTitle,
  305 + color: color,
  306 + theme: _.theme ?? theme ?? ThemeData.fallback(),
  307 + darkTheme: darkTheme,
  308 + themeMode: _.themeMode ?? themeMode ?? ThemeMode.system,
  309 + locale: Get.locale ?? locale,
  310 + localizationsDelegates: localizationsDelegates,
  311 + localeListResolutionCallback: localeListResolutionCallback,
  312 + localeResolutionCallback: localeResolutionCallback,
  313 + supportedLocales:
  314 + supportedLocales ?? const <Locale>[Locale('en', 'US')],
  315 + debugShowMaterialGrid: debugShowMaterialGrid ?? false,
  316 + showPerformanceOverlay: showPerformanceOverlay ?? false,
  317 + checkerboardRasterCacheImages:
  318 + checkerboardRasterCacheImages ?? false,
  319 + checkerboardOffscreenLayers: checkerboardOffscreenLayers ?? false,
  320 + showSemanticsDebugger: showSemanticsDebugger ?? false,
  321 + debugShowCheckedModeBanner: debugShowCheckedModeBanner ?? true,
  322 + shortcuts: shortcuts,
  323 + )
  324 + : MaterialApp(
  325 + key: _.unikey,
  326 + navigatorKey:
  327 + (navigatorKey == null ? Get.key : Get.addKey(navigatorKey)),
  328 + home: home,
  329 + routes: routes ?? const <String, WidgetBuilder>{},
  330 + initialRoute: initialRoute,
  331 + onGenerateRoute: (getPages != null ? generator : onGenerateRoute),
  332 + onGenerateInitialRoutes: (getPages == null || home != null)
  333 + ? onGenerateInitialRoutes
  334 + : initialRoutesGenerate,
  335 + onUnknownRoute: onUnknownRoute,
  336 + navigatorObservers: (navigatorObservers == null
  337 + ? <NavigatorObserver>[
  338 + GetObserver(routingCallback, Get.routing)
  339 + ]
  340 + : <NavigatorObserver>[
  341 + GetObserver(routingCallback, Get.routing)
  342 + ]
  343 + ..addAll(navigatorObservers)),
  344 + builder: (context, child) {
  345 + return Directionality(
  346 + textDirection: textDirection ??
  347 + (rtlLanguages.contains(Get.locale?.languageCode)
  348 + ? TextDirection.rtl
  349 + : TextDirection.ltr),
  350 + child: builder == null ? child : builder(context, child),
  351 + );
  352 + },
  353 + title: title ?? '',
  354 + onGenerateTitle: onGenerateTitle,
  355 + color: color,
  356 + theme: _.theme ?? theme ?? ThemeData.fallback(),
  357 + darkTheme: darkTheme,
  358 + themeMode: _.themeMode ?? themeMode ?? ThemeMode.system,
  359 + locale: Get.locale ?? locale,
  360 + localizationsDelegates: localizationsDelegates,
  361 + localeListResolutionCallback: localeListResolutionCallback,
  362 + localeResolutionCallback: localeResolutionCallback,
  363 + supportedLocales:
  364 + supportedLocales ?? const <Locale>[Locale('en', 'US')],
  365 + debugShowMaterialGrid: debugShowMaterialGrid ?? false,
  366 + showPerformanceOverlay: showPerformanceOverlay ?? false,
  367 + checkerboardRasterCacheImages:
  368 + checkerboardRasterCacheImages ?? false,
  369 + checkerboardOffscreenLayers: checkerboardOffscreenLayers ?? false,
  370 + showSemanticsDebugger: showSemanticsDebugger ?? false,
  371 + debugShowCheckedModeBanner: debugShowCheckedModeBanner ?? true,
  372 + shortcuts: shortcuts,
  373 + // actions: actions,
  374 + ));
338 } 375 }