Showing
1 changed file
with
14 additions
and
18 deletions
| @@ -207,6 +207,18 @@ class GetMaterialApp extends StatelessWidget { | @@ -207,6 +207,18 @@ class GetMaterialApp extends StatelessWidget { | ||
| 207 | ]; | 207 | ]; | 
| 208 | } | 208 | } | 
| 209 | 209 | ||
| 210 | + Widget defaultBuilder(BuildContext context, Widget? child) { | ||
| 211 | + return Directionality( | ||
| 212 | + textDirection: textDirection ?? | ||
| 213 | + (rtlLanguages.contains(Get.locale?.languageCode) | ||
| 214 | + ? TextDirection.rtl | ||
| 215 | + : TextDirection.ltr), | ||
| 216 | + child: builder == null | ||
| 217 | + ? (child ?? SizedBox.shrink()) | ||
| 218 | + : builder!(context, child), | ||
| 219 | + ); | ||
| 220 | + } | ||
| 221 | + | ||
| 210 | @override | 222 | @override | 
| 211 | Widget build(BuildContext context) => GetBuilder<GetMaterialController>( | 223 | Widget build(BuildContext context) => GetBuilder<GetMaterialController>( | 
| 212 | init: Get.rootController, | 224 | init: Get.rootController, | 
| @@ -255,15 +267,7 @@ class GetMaterialApp extends StatelessWidget { | @@ -255,15 +267,7 @@ class GetMaterialApp extends StatelessWidget { | ||
| 255 | backButtonDispatcher: backButtonDispatcher, | 267 | backButtonDispatcher: backButtonDispatcher, | 
| 256 | routeInformationProvider: routeInformationProvider, | 268 | routeInformationProvider: routeInformationProvider, | 
| 257 | key: _.unikey, | 269 | key: _.unikey, | 
| 258 | - builder: (context, child) { | ||
| 259 | - return Directionality( | ||
| 260 | - textDirection: textDirection ?? | ||
| 261 | - (rtlLanguages.contains(Get.locale?.languageCode) | ||
| 262 | - ? TextDirection.rtl | ||
| 263 | - : TextDirection.ltr), | ||
| 264 | - child: builder == null ? child! : builder!(context, child), | ||
| 265 | - ); | ||
| 266 | - }, | 270 | + builder: defaultBuilder, | 
| 267 | title: title, | 271 | title: title, | 
| 268 | onGenerateTitle: onGenerateTitle, | 272 | onGenerateTitle: onGenerateTitle, | 
| 269 | color: color, | 273 | color: color, | 
| @@ -304,15 +308,7 @@ class GetMaterialApp extends StatelessWidget { | @@ -304,15 +308,7 @@ class GetMaterialApp extends StatelessWidget { | ||
| 304 | GetObserver(routingCallback, Get.routing) | 308 | GetObserver(routingCallback, Get.routing) | 
| 305 | ] | 309 | ] | 
| 306 | ..addAll(navigatorObservers!)), | 310 | ..addAll(navigatorObservers!)), | 
| 307 | - builder: (context, child) { | ||
| 308 | - return Directionality( | ||
| 309 | - textDirection: textDirection ?? | ||
| 310 | - (rtlLanguages.contains(Get.locale?.languageCode) | ||
| 311 | - ? TextDirection.rtl | ||
| 312 | - : TextDirection.ltr), | ||
| 313 | - child: builder == null ? child! : builder!(context, child), | ||
| 314 | - ); | ||
| 315 | - }, | 311 | + builder: defaultBuilder, | 
| 316 | title: title, | 312 | title: title, | 
| 317 | onGenerateTitle: onGenerateTitle, | 313 | onGenerateTitle: onGenerateTitle, | 
| 318 | color: color, | 314 | color: color, | 
- 
Please register or login to post a comment