Showing
2 changed files
with
89 additions
and
19 deletions
| @@ -237,8 +237,7 @@ class GetCupertinoApp extends StatelessWidget { | @@ -237,8 +237,7 @@ class GetCupertinoApp extends StatelessWidget { | ||
| 237 | } | 237 | } |
| 238 | 238 | ||
| 239 | @override | 239 | @override |
| 240 | - Widget build(BuildContext context) { | ||
| 241 | - return GetBuilder<GetMaterialController>( | 240 | + Widget build(BuildContext context) => GetBuilder<GetMaterialController>( |
| 242 | init: Get.rootController, | 241 | init: Get.rootController, |
| 243 | dispose: (d) { | 242 | dispose: (d) { |
| 244 | onDispose?.call(); | 243 | onDispose?.call(); |
| @@ -274,8 +273,41 @@ class GetCupertinoApp extends StatelessWidget { | @@ -274,8 +273,41 @@ class GetCupertinoApp extends StatelessWidget { | ||
| 274 | transitionDuration ?? Get.defaultTransitionDuration, | 273 | transitionDuration ?? Get.defaultTransitionDuration, |
| 275 | ); | 274 | ); |
| 276 | }, | 275 | }, |
| 277 | - builder: (_) { | ||
| 278 | - return CupertinoApp( | 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( | ||
| 279 | key: _.unikey, | 311 | key: _.unikey, |
| 280 | theme: theme, | 312 | theme: theme, |
| 281 | navigatorKey: | 313 | navigatorKey: |
| @@ -289,8 +321,12 @@ class GetCupertinoApp extends StatelessWidget { | @@ -289,8 +321,12 @@ class GetCupertinoApp extends StatelessWidget { | ||
| 289 | : initialRoutesGenerate, | 321 | : initialRoutesGenerate, |
| 290 | onUnknownRoute: onUnknownRoute, | 322 | onUnknownRoute: onUnknownRoute, |
| 291 | navigatorObservers: (navigatorObservers == null | 323 | navigatorObservers: (navigatorObservers == null |
| 292 | - ? <NavigatorObserver>[GetObserver(routingCallback, Get.routing)] | ||
| 293 | - : <NavigatorObserver>[GetObserver(routingCallback, Get.routing)] | 324 | + ? <NavigatorObserver>[ |
| 325 | + GetObserver(routingCallback, Get.routing) | ||
| 326 | + ] | ||
| 327 | + : <NavigatorObserver>[ | ||
| 328 | + GetObserver(routingCallback, Get.routing) | ||
| 329 | + ] | ||
| 294 | ..addAll(navigatorObservers)), | 330 | ..addAll(navigatorObservers)), |
| 295 | builder: (context, child) { | 331 | builder: (context, child) { |
| 296 | return Directionality( | 332 | return Directionality( |
| @@ -304,7 +340,6 @@ class GetCupertinoApp extends StatelessWidget { | @@ -304,7 +340,6 @@ class GetCupertinoApp extends StatelessWidget { | ||
| 304 | title: title ?? '', | 340 | title: title ?? '', |
| 305 | onGenerateTitle: onGenerateTitle, | 341 | onGenerateTitle: onGenerateTitle, |
| 306 | color: color, | 342 | color: color, |
| 307 | - | ||
| 308 | locale: Get.locale ?? locale, | 343 | locale: Get.locale ?? locale, |
| 309 | localizationsDelegates: localizationsDelegates, | 344 | localizationsDelegates: localizationsDelegates, |
| 310 | localeListResolutionCallback: localeListResolutionCallback, | 345 | localeListResolutionCallback: localeListResolutionCallback, |
| @@ -319,7 +354,5 @@ class GetCupertinoApp extends StatelessWidget { | @@ -319,7 +354,5 @@ class GetCupertinoApp extends StatelessWidget { | ||
| 319 | debugShowCheckedModeBanner: debugShowCheckedModeBanner ?? true, | 354 | debugShowCheckedModeBanner: debugShowCheckedModeBanner ?? true, |
| 320 | shortcuts: shortcuts, | 355 | shortcuts: shortcuts, |
| 321 | // actions: actions, | 356 | // actions: actions, |
| 322 | - ); | ||
| 323 | - }); | ||
| 324 | - } | 357 | + )); |
| 325 | } | 358 | } |
| @@ -248,8 +248,7 @@ class GetMaterialApp extends StatelessWidget { | @@ -248,8 +248,7 @@ class GetMaterialApp extends StatelessWidget { | ||
| 248 | } | 248 | } |
| 249 | 249 | ||
| 250 | @override | 250 | @override |
| 251 | - Widget build(BuildContext context) { | ||
| 252 | - return GetBuilder<GetMaterialController>( | 251 | + Widget build(BuildContext context) => GetBuilder<GetMaterialController>( |
| 253 | init: Get.rootController, | 252 | init: Get.rootController, |
| 254 | dispose: (d) { | 253 | dispose: (d) { |
| 255 | onDispose?.call(); | 254 | onDispose?.call(); |
| @@ -285,8 +284,44 @@ class GetMaterialApp extends StatelessWidget { | @@ -285,8 +284,44 @@ class GetMaterialApp extends StatelessWidget { | ||
| 285 | transitionDuration ?? Get.defaultTransitionDuration, | 284 | transitionDuration ?? Get.defaultTransitionDuration, |
| 286 | ); | 285 | ); |
| 287 | }, | 286 | }, |
| 288 | - builder: (_) { | ||
| 289 | - return MaterialApp( | 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( | ||
| 290 | key: _.unikey, | 325 | key: _.unikey, |
| 291 | navigatorKey: | 326 | navigatorKey: |
| 292 | (navigatorKey == null ? Get.key : Get.addKey(navigatorKey)), | 327 | (navigatorKey == null ? Get.key : Get.addKey(navigatorKey)), |
| @@ -299,8 +334,12 @@ class GetMaterialApp extends StatelessWidget { | @@ -299,8 +334,12 @@ class GetMaterialApp extends StatelessWidget { | ||
| 299 | : initialRoutesGenerate, | 334 | : initialRoutesGenerate, |
| 300 | onUnknownRoute: onUnknownRoute, | 335 | onUnknownRoute: onUnknownRoute, |
| 301 | navigatorObservers: (navigatorObservers == null | 336 | navigatorObservers: (navigatorObservers == null |
| 302 | - ? <NavigatorObserver>[GetObserver(routingCallback, Get.routing)] | ||
| 303 | - : <NavigatorObserver>[GetObserver(routingCallback, Get.routing)] | 337 | + ? <NavigatorObserver>[ |
| 338 | + GetObserver(routingCallback, Get.routing) | ||
| 339 | + ] | ||
| 340 | + : <NavigatorObserver>[ | ||
| 341 | + GetObserver(routingCallback, Get.routing) | ||
| 342 | + ] | ||
| 304 | ..addAll(navigatorObservers)), | 343 | ..addAll(navigatorObservers)), |
| 305 | builder: (context, child) { | 344 | builder: (context, child) { |
| 306 | return Directionality( | 345 | return Directionality( |
| @@ -332,7 +371,5 @@ class GetMaterialApp extends StatelessWidget { | @@ -332,7 +371,5 @@ class GetMaterialApp extends StatelessWidget { | ||
| 332 | debugShowCheckedModeBanner: debugShowCheckedModeBanner ?? true, | 371 | debugShowCheckedModeBanner: debugShowCheckedModeBanner ?? true, |
| 333 | shortcuts: shortcuts, | 372 | shortcuts: shortcuts, |
| 334 | // actions: actions, | 373 | // actions: actions, |
| 335 | - ); | ||
| 336 | - }); | ||
| 337 | - } | 374 | + )); |
| 338 | } | 375 | } |
-
Please register or login to post a comment