Committed by
GitHub
Merge pull request #2051 from jonataslaw/4.6.0
bump to 4.6.0
Showing
31 changed files
with
88 additions
and
81 deletions
1 | -## [4.5.1] - Big Update | 1 | +## [4.6.0] |
2 | +Add useInheritedMediaQuery to GetMaterialApp and GetCupertinoApp (@davidhole) | ||
3 | +Add Circular reveal Transition (@parmarravi) | ||
4 | +Add request to failed response (@heftekharm) | ||
5 | +Fix internationalization with only country code (@codercengiz) | ||
6 | +Add GetTickerProviderStateMixin when multiple AnimationController objects are used (@NatsuOnFire) | ||
7 | +Add the followRedirects and maxRedirects fields to the Request object (@wei53881) | ||
8 | +Fix to rx.trigger fires twice (@gslender) | ||
9 | +Add proxy setting support to GetConnect (@jtans) | ||
10 | +Fix markAsDirty used on permanent controllers (@zenalex) | ||
11 | +Update Korean readme (@dumbokim) | ||
12 | + | ||
13 | + | ||
14 | +## [4.5.1] | ||
2 | Fix Snackbar when it have action and icon the same time | 15 | Fix Snackbar when it have action and icon the same time |
3 | 16 | ||
4 | ## [4.5.0] - Big Update | 17 | ## [4.5.0] - Big Update |
5 | -To have a context-free, page-agnostic snackbar, we used OverlayRoute to display a partial route. | 18 | +To have a page-agnostic snackbar, we used OverlayRoute to display a partial route. |
6 | However this had several problems: | 19 | However this had several problems: |
7 | 20 | ||
8 | 1: There was no possibility to close the page without closing the snackbar | 21 | 1: There was no possibility to close the page without closing the snackbar |
1 | -class Logger { | 1 | +mixin Logger { |
2 | // Sample of abstract logging function | 2 | // Sample of abstract logging function |
3 | static void write(String text, {bool isError = false}) { | 3 | static void write(String text, {bool isError = false}) { |
4 | Future.microtask(() => print('** $text. isError: [$isError]')); | 4 | Future.microtask(() => print('** $text. isError: [$isError]')); |
@@ -125,18 +125,17 @@ class GetConnect extends GetConnectInterface { | @@ -125,18 +125,17 @@ class GetConnect extends GetConnectInterface { | ||
125 | 125 | ||
126 | @override | 126 | @override |
127 | GetHttpClient get httpClient => _httpClient ??= GetHttpClient( | 127 | GetHttpClient get httpClient => _httpClient ??= GetHttpClient( |
128 | - userAgent: userAgent, | ||
129 | - sendUserAgent: sendUserAgent, | ||
130 | - timeout: timeout, | ||
131 | - followRedirects: followRedirects, | ||
132 | - maxRedirects: maxRedirects, | ||
133 | - maxAuthRetries: maxAuthRetries, | ||
134 | - allowAutoSignedCert: allowAutoSignedCert, | ||
135 | - baseUrl: baseUrl, | ||
136 | - trustedCertificates: trustedCertificates, | ||
137 | - withCredentials: withCredentials, | ||
138 | - findProxy: findProxy | ||
139 | - ); | 128 | + userAgent: userAgent, |
129 | + sendUserAgent: sendUserAgent, | ||
130 | + timeout: timeout, | ||
131 | + followRedirects: followRedirects, | ||
132 | + maxRedirects: maxRedirects, | ||
133 | + maxAuthRetries: maxAuthRetries, | ||
134 | + allowAutoSignedCert: allowAutoSignedCert, | ||
135 | + baseUrl: baseUrl, | ||
136 | + trustedCertificates: trustedCertificates, | ||
137 | + withCredentials: withCredentials, | ||
138 | + findProxy: findProxy); | ||
140 | 139 | ||
141 | @override | 140 | @override |
142 | Future<Response<T>> get<T>( | 141 | Future<Response<T>> get<T>( |
@@ -199,16 +199,16 @@ class GetHttpClient { | @@ -199,16 +199,16 @@ class GetHttpClient { | ||
199 | int requestNumber = 1, | 199 | int requestNumber = 1, |
200 | Map<String, String>? headers, | 200 | Map<String, String>? headers, |
201 | }) async { | 201 | }) async { |
202 | - var request = await handler(); | 202 | + var request = await handler(); |
203 | 203 | ||
204 | - headers?.forEach((key, value) { | ||
205 | - request.headers[key] = value; | ||
206 | - }); | 204 | + headers?.forEach((key, value) { |
205 | + request.headers[key] = value; | ||
206 | + }); | ||
207 | 207 | ||
208 | - if (authenticate) await _modifier.authenticator!(request); | ||
209 | - final newRequest = await _modifier.modifyRequest<T>(request); | 208 | + if (authenticate) await _modifier.authenticator!(request); |
209 | + final newRequest = await _modifier.modifyRequest<T>(request); | ||
210 | 210 | ||
211 | - _httpClient.timeout = timeout; | 211 | + _httpClient.timeout = timeout; |
212 | try { | 212 | try { |
213 | var response = await _httpClient.send<T>(newRequest); | 213 | var response = await _httpClient.send<T>(newRequest); |
214 | 214 |
@@ -9,9 +9,6 @@ import '../../get_utils/get_utils.dart'; | @@ -9,9 +9,6 @@ import '../../get_utils/get_utils.dart'; | ||
9 | import '../get_navigation.dart'; | 9 | import '../get_navigation.dart'; |
10 | import 'dialog/dialog_route.dart'; | 10 | import 'dialog/dialog_route.dart'; |
11 | import 'root/parse_route.dart'; | 11 | import 'root/parse_route.dart'; |
12 | -import 'root/root_controller.dart'; | ||
13 | -import 'routes/transitions_type.dart'; | ||
14 | -import 'snackbar/snackbar_controller.dart'; | ||
15 | 12 | ||
16 | /// It replaces the Flutter Navigator, but needs no context. | 13 | /// It replaces the Flutter Navigator, but needs no context. |
17 | /// You can to use navigator.push(YourRoute()) rather | 14 | /// You can to use navigator.push(YourRoute()) rather |
1 | import 'package:flutter/material.dart'; | 1 | import 'package:flutter/material.dart'; |
2 | 2 | ||
3 | import '../../../get.dart'; | 3 | import '../../../get.dart'; |
4 | -import 'get_router_delegate.dart'; | ||
5 | 4 | ||
6 | class RouterOutlet<TDelegate extends RouterDelegate<T>, T extends Object> | 5 | class RouterOutlet<TDelegate extends RouterDelegate<T>, T extends Object> |
7 | extends StatefulWidget { | 6 | extends StatefulWidget { |
@@ -7,7 +7,6 @@ import '../../../get_instance/get_instance.dart'; | @@ -7,7 +7,6 @@ import '../../../get_instance/get_instance.dart'; | ||
7 | import '../../../get_state_manager/get_state_manager.dart'; | 7 | import '../../../get_state_manager/get_state_manager.dart'; |
8 | import '../../../get_utils/get_utils.dart'; | 8 | import '../../../get_utils/get_utils.dart'; |
9 | import '../../get_navigation.dart'; | 9 | import '../../get_navigation.dart'; |
10 | -import 'root_controller.dart'; | ||
11 | 10 | ||
12 | class GetCupertinoApp extends StatelessWidget { | 11 | class GetCupertinoApp extends StatelessWidget { |
13 | final GlobalKey<NavigatorState>? navigatorKey; | 12 | final GlobalKey<NavigatorState>? navigatorKey; |
1 | -import 'package:flutter/cupertino.dart'; | ||
2 | import 'package:flutter/foundation.dart'; | 1 | import 'package:flutter/foundation.dart'; |
3 | import 'package:flutter/material.dart'; | 2 | import 'package:flutter/material.dart'; |
4 | 3 | ||
@@ -7,7 +6,6 @@ import '../../../get_instance/get_instance.dart'; | @@ -7,7 +6,6 @@ import '../../../get_instance/get_instance.dart'; | ||
7 | import '../../../get_state_manager/get_state_manager.dart'; | 6 | import '../../../get_state_manager/get_state_manager.dart'; |
8 | import '../../../get_utils/get_utils.dart'; | 7 | import '../../../get_utils/get_utils.dart'; |
9 | import '../../get_navigation.dart'; | 8 | import '../../get_navigation.dart'; |
10 | -import 'root_controller.dart'; | ||
11 | 9 | ||
12 | class GetMaterialApp extends StatelessWidget { | 10 | class GetMaterialApp extends StatelessWidget { |
13 | final GlobalKey<NavigatorState>? navigatorKey; | 11 | final GlobalKey<NavigatorState>? navigatorKey; |
1 | import 'package:flutter/material.dart'; | 1 | import 'package:flutter/material.dart'; |
2 | 2 | ||
3 | import '../../../get.dart'; | 3 | import '../../../get.dart'; |
4 | -import '../../../get_state_manager/get_state_manager.dart'; | ||
5 | -import '../../../get_utils/get_utils.dart'; | ||
6 | -import '../routes/custom_transition.dart'; | ||
7 | -import '../routes/observers/route_observer.dart'; | ||
8 | -import '../routes/transitions_type.dart'; | ||
9 | 4 | ||
10 | class GetMaterialController extends SuperController { | 5 | class GetMaterialController extends SuperController { |
11 | bool testMode = false; | 6 | bool testMode = false; |
@@ -20,8 +20,8 @@ class CircularRevealClipper extends CustomClipper<Path> { | @@ -20,8 +20,8 @@ class CircularRevealClipper extends CustomClipper<Path> { | ||
20 | 20 | ||
21 | @override | 21 | @override |
22 | Path getClip(Size size) { | 22 | Path getClip(Size size) { |
23 | - final Offset center = this.centerAlignment?.alongSize(size) ?? | ||
24 | - this.centerOffset ?? | 23 | + final center = centerAlignment?.alongSize(size) ?? |
24 | + centerOffset ?? | ||
25 | Offset(size.width / 2, size.height / 2); | 25 | Offset(size.width / 2, size.height / 2); |
26 | final minRadius = this.minRadius ?? 0; | 26 | final minRadius = this.minRadius ?? 0; |
27 | final maxRadius = this.maxRadius ?? calcMaxRadius(size, center); | 27 | final maxRadius = this.maxRadius ?? calcMaxRadius(size, center); |
@@ -44,4 +44,3 @@ class CircularRevealClipper extends CustomClipper<Path> { | @@ -44,4 +44,3 @@ class CircularRevealClipper extends CustomClipper<Path> { | ||
44 | return sqrt(w * w + h * h); | 44 | return sqrt(w * w + h * h); |
45 | } | 45 | } |
46 | } | 46 | } |
47 | - |
@@ -2,10 +2,7 @@ import 'package:flutter/material.dart'; | @@ -2,10 +2,7 @@ import 'package:flutter/material.dart'; | ||
2 | 2 | ||
3 | import '../../../get.dart'; | 3 | import '../../../get.dart'; |
4 | import '../router_report.dart'; | 4 | import '../router_report.dart'; |
5 | -import 'custom_transition.dart'; | ||
6 | import 'get_transition_mixin.dart'; | 5 | import 'get_transition_mixin.dart'; |
7 | -import 'route_middleware.dart'; | ||
8 | -import 'transitions_type.dart'; | ||
9 | 6 | ||
10 | mixin PageRouteReportMixin<T> on Route<T> { | 7 | mixin PageRouteReportMixin<T> on Route<T> { |
11 | @override | 8 | @override |
1 | import 'package:flutter/cupertino.dart'; | 1 | import 'package:flutter/cupertino.dart'; |
2 | import 'package:flutter/material.dart'; | 2 | import 'package:flutter/material.dart'; |
3 | 3 | ||
4 | +import 'circular_reveal_clipper.dart'; | ||
5 | + | ||
4 | class LeftToRightFadeTransition { | 6 | class LeftToRightFadeTransition { |
5 | Widget buildTransitions( | 7 | Widget buildTransitions( |
6 | BuildContext context, | 8 | BuildContext context, |
@@ -185,7 +187,6 @@ class SizeTransitions { | @@ -185,7 +187,6 @@ class SizeTransitions { | ||
185 | } | 187 | } |
186 | } | 188 | } |
187 | 189 | ||
188 | - | ||
189 | class CircularRevealTransition { | 190 | class CircularRevealTransition { |
190 | Widget buildTransitions( | 191 | Widget buildTransitions( |
191 | BuildContext context, | 192 | BuildContext context, |
@@ -197,7 +198,7 @@ class CircularRevealTransition { | @@ -197,7 +198,7 @@ class CircularRevealTransition { | ||
197 | return ClipPath( | 198 | return ClipPath( |
198 | clipper: CircularRevealClipper( | 199 | clipper: CircularRevealClipper( |
199 | fraction: animation.value, | 200 | fraction: animation.value, |
200 | - centerAlignment: Alignment.center, | 201 | + centerAlignment: Alignment.center, |
201 | centerOffset: Offset.zero, | 202 | centerOffset: Offset.zero, |
202 | minRadius: 0, | 203 | minRadius: 0, |
203 | maxRadius: 800, | 204 | maxRadius: 800, |
@@ -206,4 +207,3 @@ class CircularRevealTransition { | @@ -206,4 +207,3 @@ class CircularRevealTransition { | ||
206 | ); | 207 | ); |
207 | } | 208 | } |
208 | } | 209 | } |
209 | - |
1 | import 'package:flutter/cupertino.dart'; | 1 | import 'package:flutter/cupertino.dart'; |
2 | -import 'package:flutter/foundation.dart'; | ||
3 | import 'package:flutter/material.dart'; | 2 | import 'package:flutter/material.dart'; |
4 | -import 'package:flutter/widgets.dart'; | ||
5 | 3 | ||
6 | import '../../../get_core/src/get_main.dart'; | 4 | import '../../../get_core/src/get_main.dart'; |
7 | import '../../../get_instance/get_instance.dart'; | 5 | import '../../../get_instance/get_instance.dart'; |
8 | import '../../get_navigation.dart'; | 6 | import '../../get_navigation.dart'; |
9 | -import 'custom_transition.dart'; | ||
10 | -import 'transitions_type.dart'; | ||
11 | 7 | ||
12 | class GetPage<T> extends Page<T> { | 8 | class GetPage<T> extends Page<T> { |
13 | final GetPageBuilder page; | 9 | final GetPageBuilder page; |
@@ -8,7 +8,6 @@ import 'package:flutter/material.dart'; | @@ -8,7 +8,6 @@ import 'package:flutter/material.dart'; | ||
8 | 8 | ||
9 | import '../../../get.dart'; | 9 | import '../../../get.dart'; |
10 | import 'default_transitions.dart'; | 10 | import 'default_transitions.dart'; |
11 | -import 'transitions_type.dart'; | ||
12 | 11 | ||
13 | const double _kBackGestureWidth = 20.0; | 12 | const double _kBackGestureWidth = 20.0; |
14 | const int _kMaxDroppedSwipePageForwardAnimationTime = | 13 | const int _kMaxDroppedSwipePageForwardAnimationTime = |
@@ -619,8 +618,8 @@ Cannot read the previousTitle for a route that has not yet been installed''', | @@ -619,8 +618,8 @@ Cannot read the previousTitle for a route that has not yet been installed''', | ||
619 | onStartPopGesture: () => _startPopGesture<T>(route), | 618 | onStartPopGesture: () => _startPopGesture<T>(route), |
620 | child: child) | 619 | child: child) |
621 | : child); | 620 | : child); |
622 | - | ||
623 | - case Transition.ciruclarReveal: | 621 | + |
622 | + case Transition.circularReveal: | ||
624 | return CircularRevealTransition().buildTransitions( | 623 | return CircularRevealTransition().buildTransitions( |
625 | context, | 624 | context, |
626 | route.curve, | 625 | route.curve, |
@@ -629,11 +628,11 @@ Cannot read the previousTitle for a route that has not yet been installed''', | @@ -629,11 +628,11 @@ Cannot read the previousTitle for a route that has not yet been installed''', | ||
629 | secondaryAnimation, | 628 | secondaryAnimation, |
630 | route.popGesture ?? Get.defaultPopGesture | 629 | route.popGesture ?? Get.defaultPopGesture |
631 | ? CupertinoBackGestureDetector<T>( | 630 | ? CupertinoBackGestureDetector<T>( |
632 | - gestureWidth: route.gestureWidth?.call(context) ?? | ||
633 | - _kBackGestureWidth, | ||
634 | - enabledCallback: () => _isPopGestureEnabled<T>(route), | ||
635 | - onStartPopGesture: () => _startPopGesture<T>(route), | ||
636 | - child: child) | 631 | + gestureWidth: route.gestureWidth?.call(context) ?? |
632 | + _kBackGestureWidth, | ||
633 | + enabledCallback: () => _isPopGestureEnabled<T>(route), | ||
634 | + onStartPopGesture: () => _startPopGesture<T>(route), | ||
635 | + child: child) | ||
637 | : child); | 636 | : child); |
638 | 637 | ||
639 | default: | 638 | default: |
@@ -5,7 +5,6 @@ import '../../../../instance_manager.dart'; | @@ -5,7 +5,6 @@ import '../../../../instance_manager.dart'; | ||
5 | import '../../../get_navigation.dart'; | 5 | import '../../../get_navigation.dart'; |
6 | import '../../dialog/dialog_route.dart'; | 6 | import '../../dialog/dialog_route.dart'; |
7 | import '../../router_report.dart'; | 7 | import '../../router_report.dart'; |
8 | -import '../default_route.dart'; | ||
9 | 8 | ||
10 | /// Extracts the name of a route based on it's instance type | 9 | /// Extracts the name of a route based on it's instance type |
11 | /// or null if not possible. | 10 | /// or null if not possible. |
@@ -15,7 +15,8 @@ enum Transition { | @@ -15,7 +15,8 @@ enum Transition { | ||
15 | cupertino, | 15 | cupertino, |
16 | cupertinoDialog, | 16 | cupertinoDialog, |
17 | size, | 17 | size, |
18 | - native | 18 | + circularReveal, |
19 | + native, | ||
19 | } | 20 | } |
20 | 21 | ||
21 | typedef GetPageBuilder = Widget Function(); | 22 | typedef GetPageBuilder = Widget Function(); |
@@ -113,7 +113,8 @@ mixin GetTickerProviderStateMixin on GetxController implements TickerProvider { | @@ -113,7 +113,8 @@ mixin GetTickerProviderStateMixin on GetxController implements TickerProvider { | ||
113 | @override | 113 | @override |
114 | Ticker createTicker(TickerCallback onTick) { | 114 | Ticker createTicker(TickerCallback onTick) { |
115 | _tickers ??= <_WidgetTicker>{}; | 115 | _tickers ??= <_WidgetTicker>{}; |
116 | - final result = _WidgetTicker(onTick, this, debugLabel: kDebugMode ? 'created by ${describeIdentity(this)}' : null); | 116 | + final result = _WidgetTicker(onTick, this, |
117 | + debugLabel: kDebugMode ? 'created by ${describeIdentity(this)}' : null); | ||
117 | _tickers!.add(result); | 118 | _tickers!.add(result); |
118 | return result; | 119 | return result; |
119 | } | 120 | } |
@@ -143,13 +144,13 @@ mixin GetTickerProviderStateMixin on GetxController implements TickerProvider { | @@ -143,13 +144,13 @@ mixin GetTickerProviderStateMixin on GetxController implements TickerProvider { | ||
143 | ErrorSummary('$this was disposed with an active Ticker.'), | 144 | ErrorSummary('$this was disposed with an active Ticker.'), |
144 | ErrorDescription( | 145 | ErrorDescription( |
145 | '$runtimeType created a Ticker via its GetTickerProviderStateMixin, but at the time ' | 146 | '$runtimeType created a Ticker via its GetTickerProviderStateMixin, but at the time ' |
146 | - 'dispose() was called on the mixin, that Ticker was still active. All Tickers must ' | ||
147 | - 'be disposed before calling super.dispose().', | 147 | + 'dispose() was called on the mixin, that Ticker was still active. All Tickers must ' |
148 | + 'be disposed before calling super.dispose().', | ||
148 | ), | 149 | ), |
149 | ErrorHint( | 150 | ErrorHint( |
150 | 'Tickers used by AnimationControllers ' | 151 | 'Tickers used by AnimationControllers ' |
151 | - 'should be disposed by calling dispose() on the AnimationController itself. ' | ||
152 | - 'Otherwise, the ticker will leak.', | 152 | + 'should be disposed by calling dispose() on the AnimationController itself. ' |
153 | + 'Otherwise, the ticker will leak.', | ||
153 | ), | 154 | ), |
154 | ticker.describeForError('The offending ticker was'), | 155 | ticker.describeForError('The offending ticker was'), |
155 | ]); | 156 | ]); |
@@ -160,11 +161,11 @@ mixin GetTickerProviderStateMixin on GetxController implements TickerProvider { | @@ -160,11 +161,11 @@ mixin GetTickerProviderStateMixin on GetxController implements TickerProvider { | ||
160 | }()); | 161 | }()); |
161 | super.onClose(); | 162 | super.onClose(); |
162 | } | 163 | } |
163 | - | ||
164 | } | 164 | } |
165 | 165 | ||
166 | class _WidgetTicker extends Ticker { | 166 | class _WidgetTicker extends Ticker { |
167 | - _WidgetTicker(TickerCallback onTick, this._creator, { String? debugLabel }) : super(onTick, debugLabel: debugLabel); | 167 | + _WidgetTicker(TickerCallback onTick, this._creator, {String? debugLabel}) |
168 | + : super(onTick, debugLabel: debugLabel); | ||
168 | 169 | ||
169 | final GetTickerProviderStateMixin _creator; | 170 | final GetTickerProviderStateMixin _creator; |
170 | 171 |
1 | import 'package:flutter/widgets.dart'; | 1 | import 'package:flutter/widgets.dart'; |
2 | 2 | ||
3 | import '../../../get.dart'; | 3 | import '../../../get.dart'; |
4 | -import 'get_view.dart'; | ||
5 | 4 | ||
6 | mixin GetResponsiveMixin on Widget { | 5 | mixin GetResponsiveMixin on Widget { |
7 | ResponsiveScreen get screen; | 6 | ResponsiveScreen get screen; |
1 | import 'dart:collection'; | 1 | import 'dart:collection'; |
2 | -import 'package:flutter/foundation.dart'; | 2 | + |
3 | import 'package:flutter/widgets.dart'; | 3 | import 'package:flutter/widgets.dart'; |
4 | 4 | ||
5 | // This callback remove the listener on addListener function | 5 | // This callback remove the listener on addListener function |
1 | import 'package:flutter/material.dart'; | 1 | import 'package:flutter/material.dart'; |
2 | + | ||
2 | import '../../get_state_manager.dart'; | 3 | import '../../get_state_manager.dart'; |
3 | -import 'get_state.dart'; | ||
4 | 4 | ||
5 | class MixinBuilder<T extends GetxController> extends StatelessWidget { | 5 | class MixinBuilder<T extends GetxController> extends StatelessWidget { |
6 | @required | 6 | @required |
@@ -68,8 +68,8 @@ extension Trans on String { | @@ -68,8 +68,8 @@ extension Trans on String { | ||
68 | Map<String, String>? get _getSimilarLanguageTranslation { | 68 | Map<String, String>? get _getSimilarLanguageTranslation { |
69 | final translationsWithNoCountry = Get.translations | 69 | final translationsWithNoCountry = Get.translations |
70 | .map((key, value) => MapEntry(key.split("_").first, value)); | 70 | .map((key, value) => MapEntry(key.split("_").first, value)); |
71 | - final containsKey = | ||
72 | - translationsWithNoCountry.containsKey(Get.locale!.languageCode.split("_").first); | 71 | + final containsKey = translationsWithNoCountry |
72 | + .containsKey(Get.locale!.languageCode.split("_").first); | ||
73 | 73 | ||
74 | if (!containsKey) { | 74 | if (!containsKey) { |
75 | return null; | 75 | return null; |
1 | name: get | 1 | name: get |
2 | description: Open screens/snackbars/dialogs without context, manage states and inject dependencies easily with GetX. | 2 | description: Open screens/snackbars/dialogs without context, manage states and inject dependencies easily with GetX. |
3 | -version: 4.5.1 | 3 | +version: 4.6.0 |
4 | homepage: https://github.com/jonataslaw/getx | 4 | homepage: https://github.com/jonataslaw/getx |
5 | 5 | ||
6 | environment: | 6 | environment: |
1 | +// ignore_for_file: avoid_classes_with_only_static_members | ||
2 | + | ||
1 | import 'package:flutter_test/flutter_test.dart'; | 3 | import 'package:flutter_test/flutter_test.dart'; |
2 | import 'package:get/get.dart'; | 4 | import 'package:get/get.dart'; |
3 | 5 | ||
@@ -146,8 +148,8 @@ void main() { | @@ -146,8 +148,8 @@ void main() { | ||
146 | Get.create<Service>(() => Api()); | 148 | Get.create<Service>(() => Api()); |
147 | final ct1 = Get.find<Service>(); | 149 | final ct1 = Get.find<Service>(); |
148 | final ct2 = Get.find<Service>(); | 150 | final ct2 = Get.find<Service>(); |
149 | - expect(ct1 is Service, true); | ||
150 | - expect(ct2 is Service, true); | 151 | + // expect(ct1 is Service, true); |
152 | + // expect(ct2 is Service, true); | ||
151 | expect(ct1 == ct2, false); | 153 | expect(ct1 == ct2, false); |
152 | Get.reset(); | 154 | Get.reset(); |
153 | }); | 155 | }); |
@@ -336,7 +336,10 @@ void main() { | @@ -336,7 +336,10 @@ void main() { | ||
336 | 336 | ||
337 | testWidgets("Get.back navigates back", (tester) async { | 337 | testWidgets("Get.back navigates back", (tester) async { |
338 | await tester.pumpWidget( | 338 | await tester.pumpWidget( |
339 | - Wrapper(child: FirstScreen()), | 339 | + Wrapper( |
340 | + child: FirstScreen(), | ||
341 | + defaultTransition: Transition.circularReveal, | ||
342 | + ), | ||
340 | ); | 343 | ); |
341 | 344 | ||
342 | Get.to(SecondScreen()); | 345 | Get.to(SecondScreen()); |
1 | import 'package:flutter/cupertino.dart'; | 1 | import 'package:flutter/cupertino.dart'; |
2 | -import 'package:flutter/material.dart'; | ||
3 | import 'package:flutter_test/flutter_test.dart'; | 2 | import 'package:flutter_test/flutter_test.dart'; |
4 | import 'package:get/get.dart'; | 3 | import 'package:get/get.dart'; |
5 | 4 |
@@ -114,6 +114,23 @@ void main() { | @@ -114,6 +114,23 @@ void main() { | ||
114 | expect(1, timesCalled); | 114 | expect(1, timesCalled); |
115 | }); | 115 | }); |
116 | 116 | ||
117 | + test('Rx different value will call the listener when `trigger`', () async { | ||
118 | + var reactiveInteger = RxInt(0); | ||
119 | + var timesCalled = 0; | ||
120 | + reactiveInteger.listen((newInt) { | ||
121 | + timesCalled++; | ||
122 | + }); | ||
123 | + | ||
124 | + // we call 3 | ||
125 | + reactiveInteger.trigger(1); | ||
126 | + // then repeat twice | ||
127 | + reactiveInteger.trigger(2); | ||
128 | + reactiveInteger.trigger(3); | ||
129 | + | ||
130 | + await Future.delayed(Duration(milliseconds: 100)); | ||
131 | + expect(3, timesCalled); | ||
132 | + }); | ||
133 | + | ||
117 | test('Rx same value will call the listener when `trigger`', () async { | 134 | test('Rx same value will call the listener when `trigger`', () async { |
118 | var reactiveInteger = RxInt(2); | 135 | var reactiveInteger = RxInt(2); |
119 | var timesCalled = 0; | 136 | var timesCalled = 0; |
@@ -125,10 +142,11 @@ void main() { | @@ -125,10 +142,11 @@ void main() { | ||
125 | reactiveInteger.trigger(3); | 142 | reactiveInteger.trigger(3); |
126 | // then repeat twice | 143 | // then repeat twice |
127 | reactiveInteger.trigger(3); | 144 | reactiveInteger.trigger(3); |
145 | + reactiveInteger.trigger(3); | ||
128 | reactiveInteger.trigger(1); | 146 | reactiveInteger.trigger(1); |
129 | 147 | ||
130 | await Future.delayed(Duration(milliseconds: 100)); | 148 | await Future.delayed(Duration(milliseconds: 100)); |
131 | - expect(3, timesCalled); | 149 | + expect(4, timesCalled); |
132 | }); | 150 | }); |
133 | 151 | ||
134 | test('Rx String with non null values', () async { | 152 | test('Rx String with non null values', () async { |
-
Please register or login to post a comment