Jonatas

Merge branch 'master' of https://github.com/jonataslaw/getx

@@ -23,7 +23,7 @@ jobs: @@ -23,7 +23,7 @@ jobs:
23 # https://github.com/marketplace/actions/flutter-action 23 # https://github.com/marketplace/actions/flutter-action
24 - uses: subosito/flutter-action@v1 24 - uses: subosito/flutter-action@v1
25 with: 25 with:
26 - flutter-version: "1.22.2" 26 + flutter-version: "1.22.3"
27 channel: "stable" 27 channel: "stable"
28 - run: flutter pub get 28 - run: flutter pub get
29 #- run: flutter analyze 29 #- run: flutter analyze
@@ -127,14 +127,15 @@ class GetObserver extends NavigatorObserver { @@ -127,14 +127,15 @@ class GetObserver extends NavigatorObserver {
127 @override 127 @override
128 void didPop(Route route, Route previousRoute) { 128 void didPop(Route route, Route previousRoute) {
129 super.didPop(route, previousRoute); 129 super.didPop(route, previousRoute);
130 - final newRoute = _RouteData.ofRoute(route);  
131 -  
132 - if (newRoute.isSnackbar) {  
133 - Get.log("CLOSE SNACKBAR ${newRoute.name}");  
134 - } else if (newRoute.isBottomSheet || newRoute.isDialog) {  
135 - Get.log("CLOSE ${newRoute.name}");  
136 - } else if (newRoute.isGetPageRoute) {  
137 - Get.log("CLOSE TO ROUTE ${newRoute.name}"); 130 + final currentRoute = _RouteData.ofRoute(route);
  131 + final newRoute = _RouteData.ofRoute(previousRoute);
  132 +
  133 + if (currentRoute.isSnackbar) {
  134 + Get.log("CLOSE SNACKBAR ${currentRoute.name}");
  135 + } else if (currentRoute.isBottomSheet || currentRoute.isDialog) {
  136 + Get.log("CLOSE ${currentRoute.name}");
  137 + } else if (currentRoute.isGetPageRoute) {
  138 + Get.log("CLOSE TO ROUTE ${currentRoute.name}");
138 } 139 }
139 140
140 Get.reference = newRoute.name; 141 Get.reference = newRoute.name;
@@ -122,13 +122,15 @@ abstract class GetNotifier<T> extends Value<T> with GetLifeCycleBase { @@ -122,13 +122,15 @@ abstract class GetNotifier<T> extends Value<T> with GetLifeCycleBase {
122 } 122 }
123 123
124 extension StateExt<T> on StateMixin<T> { 124 extension StateExt<T> on StateMixin<T> {
125 - Widget obx(NotifierBuilder<T> widget, {Widget onError, Widget onLoading}) { 125 + Widget obx(NotifierBuilder<T> widget, {Widget Function(String error) onError, Widget onLoading}) {
126 assert(widget != null); 126 assert(widget != null);
127 return SimpleBuilder(builder: (_) { 127 return SimpleBuilder(builder: (_) {
128 if (status.isLoading) { 128 if (status.isLoading) {
129 return onLoading ?? CircularProgressIndicator(); 129 return onLoading ?? CircularProgressIndicator();
130 } else if (status.isError) { 130 } else if (status.isError) {
131 - return onError ?? Text('A error occured: ${status.errorMessage}'); 131 + return onError != null
  132 + ? onError(status.errorMessage)
  133 + : Text('A error occured: ${status.errorMessage}');
132 } else { 134 } else {
133 return widget(value); 135 return widget(value);
134 } 136 }
@@ -95,6 +95,9 @@ class GetUtils { @@ -95,6 +95,9 @@ class GetUtils {
95 /// Checks if string consist only Alphabet. (No Whitespace) 95 /// Checks if string consist only Alphabet. (No Whitespace)
96 static bool isAlphabetOnly(String s) => hasMatch(s, r'^[a-zA-Z]+$'); 96 static bool isAlphabetOnly(String s) => hasMatch(s, r'^[a-zA-Z]+$');
97 97
  98 + /// Checks if string contains at least one Capital Letter
  99 + static bool hasCapitalletter(String s) => hasMatch(s, r'[A-Z]');
  100 +
98 /// Checks if string is boolean. 101 /// Checks if string is boolean.
99 static bool isBool(String value) { 102 static bool isBool(String value) {
100 if (isNull(value)) { 103 if (isNull(value)) {