Jonatas

fix types on extensions

@@ -206,40 +206,6 @@ class GetBar<T extends Object> extends StatefulWidget { @@ -206,40 +206,6 @@ class GetBar<T extends Object> extends StatefulWidget {
206 return await Get.key.currentState.push(_snackRoute); 206 return await Get.key.currentState.push(_snackRoute);
207 } 207 }
208 208
209 - /// Dismisses the snack causing is to return a future containing [result].  
210 - /// When this future finishes, it is guaranteed that Snack was dismissed.  
211 - Future<T> dismiss([T result]) async {  
212 - // If route was never initialized, do nothing  
213 - if (_snackRoute == null) {  
214 - return null;  
215 - }  
216 -  
217 - if (_snackRoute.isCurrent) {  
218 - _snackRoute.navigator.pop(result);  
219 - return _snackRoute.completed;  
220 - } else if (_snackRoute.isActive) {  
221 - // removeRoute is called every time you dismiss a Snack that is not  
222 - // the top route.  
223 - // It will not animate back and listeners will not detect  
224 - // SnackbarStatus.CLOSING or SnackbarStatus.CLOSED  
225 - // To avoid this, always make sure that Snack is the top  
226 - // route when it is being dismissed  
227 - _snackRoute.navigator.removeRoute(_snackRoute);  
228 - }  
229 -  
230 - return null;  
231 - }  
232 -  
233 - /// Checks if the snack is visible  
234 - bool isShowing() {  
235 - return _snackRoute?.currentStatus == SnackbarStatus.OPEN;  
236 - }  
237 -  
238 - /// Checks if the snack is dismissed  
239 - bool isDismissed() {  
240 - return _snackRoute?.currentStatus == SnackbarStatus.CLOSED;  
241 - }  
242 -  
243 @override 209 @override
244 State createState() { 210 State createState() {
245 return _GetBarState<T>(); 211 return _GetBarState<T>();
@@ -273,8 +239,9 @@ class _GetBarState<K extends Object> extends State<GetBar> @@ -273,8 +239,9 @@ class _GetBarState<K extends Object> extends State<GetBar>
273 ((widget.userInputForm != null || 239 ((widget.userInputForm != null ||
274 ((widget.message != null && widget.message.isNotEmpty) || 240 ((widget.message != null && widget.message.isNotEmpty) ||
275 widget.messageText != null))), 241 widget.messageText != null))),
276 - // ignore: lines_longer_than_80_chars  
277 - "A message is mandatory if you are not using userInputForm. Set either a message or messageText"); 242 + """
  243 +A message is mandatory if you are not using userInputForm.
  244 +Set either a message or messageText""");
278 245
279 _isTitlePresent = (widget.title != null || widget.titleText != null); 246 _isTitlePresent = (widget.title != null || widget.titleText != null);
280 _messageTopMargin = _isTitlePresent ? 6.0 : widget.padding.top; 247 _messageTopMargin = _isTitlePresent ? 6.0 : widget.padding.top;
1 import 'dart:async'; 1 import 'dart:async';
2 import 'dart:ui'; 2 import 'dart:ui';
3 -  
4 import 'package:flutter/widgets.dart'; 3 import 'package:flutter/widgets.dart';
5 - 4 +import '../../get_navigation.dart';
6 import 'snack.dart'; 5 import 'snack.dart';
7 6
8 class SnackRoute<T> extends OverlayRoute<T> { 7 class SnackRoute<T> extends OverlayRoute<T> {
@@ -65,7 +64,7 @@ class SnackRoute<T> extends OverlayRoute<T> { @@ -65,7 +64,7 @@ class SnackRoute<T> extends OverlayRoute<T> {
65 OverlayEntry( 64 OverlayEntry(
66 builder: (context) { 65 builder: (context) {
67 return GestureDetector( 66 return GestureDetector(
68 - onTap: snack.isDismissible ? () => snack.dismiss() : null, 67 + onTap: snack.isDismissible ? Get.back : null,
69 child: AnimatedBuilder( 68 child: AnimatedBuilder(
70 animation: _filterBlurAnimation, 69 animation: _filterBlurAnimation,
71 builder: (context, child) { 70 builder: (context, child) {
1 -import 'dart:ui'; 1 +import 'dart:async';
2 2
3 /// Duration utilities. 3 /// Duration utilities.
4 extension GetDurationUtils on Duration { 4 extension GetDurationUtils on Duration {
@@ -15,5 +15,5 @@ extension GetDurationUtils on Duration { @@ -15,5 +15,5 @@ extension GetDurationUtils on Duration {
15 /// await 0.7.seconds.delay(() { 15 /// await 0.7.seconds.delay(() {
16 /// } 16 /// }
17 ///``` 17 ///```
18 - Future delay([VoidCallback callback]) async => Future.delayed(this, callback); 18 + Future delay([FutureOr callback()]) async => Future.delayed(this, callback);
19 } 19 }
@@ -66,13 +66,9 @@ extension LocalesIntl on GetInterface { @@ -66,13 +66,9 @@ extension LocalesIntl on GetInterface {
66 66
67 Locale get fallbackLocale => _intlHost.fallbackLocale; 67 Locale get fallbackLocale => _intlHost.fallbackLocale;
68 68
69 - set locale(Locale newLocale) {  
70 - _intlHost.locale = newLocale;  
71 - } 69 + set locale(Locale newLocale) => _intlHost.locale = newLocale;
72 70
73 - set fallbackLocale(Locale newLocale) {  
74 - _intlHost.fallbackLocale = newLocale;  
75 - } 71 + set fallbackLocale(Locale newLocale) => _intlHost.fallbackLocale = newLocale;
76 72
77 Map<String, Map<String, String>> get translations => _intlHost.translations; 73 Map<String, Map<String, String>> get translations => _intlHost.translations;
78 74
1 -import 'dart:ui';  
2 - 1 +import 'dart:async';
3 import '../get_utils/get_utils.dart'; 2 import '../get_utils/get_utils.dart';
4 3
5 extension GetNumUtils on num { 4 extension GetNumUtils on num {
@@ -24,7 +23,7 @@ extension GetNumUtils on num { @@ -24,7 +23,7 @@ extension GetNumUtils on num {
24 /// print('currently running callback 1.2sec'); 23 /// print('currently running callback 1.2sec');
25 /// } 24 /// }
26 ///``` 25 ///```
27 - Future delay([VoidCallback callback]) async => Future.delayed( 26 + Future delay([FutureOr callback()]) async => Future.delayed(
28 Duration(milliseconds: (this * 1000).round()), 27 Duration(milliseconds: (this * 1000).round()),
29 callback, 28 callback,
30 ); 29 );
@@ -12,6 +12,7 @@ dependencies: @@ -12,6 +12,7 @@ dependencies:
12 sdk: flutter 12 sdk: flutter
13 get_core: 13 get_core:
14 path: ../get_core 14 path: ../get_core
  15 + meta: ">=1.1.0 <2.0.0"
15 16
16 dev_dependencies: 17 dev_dependencies:
17 flutter_test: 18 flutter_test: