Jonny Borges

listem locale update and call Get.updateLocale

1 import 'package:flutter/material.dart'; 1 import 'package:flutter/material.dart';
2 2
  3 +import '../../../get.dart';
3 import '../../../get_state_manager/get_state_manager.dart'; 4 import '../../../get_state_manager/get_state_manager.dart';
4 import '../../../get_utils/get_utils.dart'; 5 import '../../../get_utils/get_utils.dart';
5 import '../routes/custom_transition.dart'; 6 import '../routes/custom_transition.dart';
6 import '../routes/observers/route_observer.dart'; 7 import '../routes/observers/route_observer.dart';
7 import '../routes/transitions_type.dart'; 8 import '../routes/transitions_type.dart';
8 9
9 -class GetMaterialController extends GetxController { 10 +class GetMaterialController extends SuperController {
10 bool testMode = false; 11 bool testMode = false;
11 Key? unikey; 12 Key? unikey;
12 ThemeData? theme; 13 ThemeData? theme;
@@ -43,6 +44,28 @@ class GetMaterialController extends GetxController { @@ -43,6 +44,28 @@ class GetMaterialController extends GetxController {
43 return key; 44 return key;
44 } 45 }
45 46
  47 + @override
  48 + void didChangeLocales(List<Locale>? locales) {
  49 + Get.asap(() {
  50 + final locale = Get.deviceLocale;
  51 + if (locale != null) {
  52 + Get.updateLocale(locale);
  53 + }
  54 + });
  55 + }
  56 +
  57 + @override
  58 + void onDetached() {}
  59 +
  60 + @override
  61 + void onInactive() {}
  62 +
  63 + @override
  64 + void onPaused() {}
  65 +
  66 + @override
  67 + void onResumed() {}
  68 +
46 void restartApp() { 69 void restartApp() {
47 unikey = UniqueKey(); 70 unikey = UniqueKey();
48 update(); 71 update();
@@ -75,14 +75,14 @@ mixin ScrollMixin on GetLifeCycleBase { @@ -75,14 +75,14 @@ mixin ScrollMixin on GetLifeCycleBase {
75 abstract class RxController extends DisposableInterface {} 75 abstract class RxController extends DisposableInterface {}
76 76
77 abstract class SuperController<T> extends FullLifeCycleController 77 abstract class SuperController<T> extends FullLifeCycleController
78 - with FullLifeCycle, StateMixin<T> {} 78 + with FullLifeCycleMixin, StateMixin<T> {}
79 79
80 abstract class FullLifeCycleController extends GetxController 80 abstract class FullLifeCycleController extends GetxController
81 with 81 with
82 // ignore: prefer_mixin 82 // ignore: prefer_mixin
83 WidgetsBindingObserver {} 83 WidgetsBindingObserver {}
84 84
85 -mixin FullLifeCycle on FullLifeCycleController { 85 +mixin FullLifeCycleMixin on FullLifeCycleController {
86 @mustCallSuper 86 @mustCallSuper
87 @override 87 @override
88 void onInit() { 88 void onInit() {