Showing
2 changed files
with
22 additions
and
9 deletions
| @@ -618,7 +618,7 @@ extension GetNavigation on GetInterface { | @@ -618,7 +618,7 @@ extension GetNavigation on GetInterface { | ||
| 618 | /// as explained in documentation | 618 | /// as explained in documentation |
| 619 | /// | 619 | /// |
| 620 | /// [predicate] can be used like this: | 620 | /// [predicate] can be used like this: |
| 621 | - /// `Get.offNamedUntil(page, (route) => (route as GetPageRoute).routeName == '/home')` | 621 | + /// `Get.offNamedUntil(page, ModalRoute.withName('/home'))` |
| 622 | /// to pop routes in stack until home, | 622 | /// to pop routes in stack until home, |
| 623 | /// or like this: | 623 | /// or like this: |
| 624 | /// `Get.offNamedUntil((route) => !Get.isDialogOpen())`, | 624 | /// `Get.offNamedUntil((route) => !Get.isDialogOpen())`, |
| 1 | import 'package:flutter/material.dart'; | 1 | import 'package:flutter/material.dart'; |
| 2 | import 'package:flutter_test/flutter_test.dart'; | 2 | import 'package:flutter_test/flutter_test.dart'; |
| 3 | import 'package:get/get.dart'; | 3 | import 'package:get/get.dart'; |
| 4 | + | ||
| 4 | import 'utils/wrapper.dart'; | 5 | import 'utils/wrapper.dart'; |
| 5 | 6 | ||
| 6 | class SizeTransitions extends CustomTransition { | 7 | class SizeTransitions extends CustomTransition { |
| @@ -198,16 +199,21 @@ void main() { | @@ -198,16 +199,21 @@ void main() { | ||
| 198 | 199 | ||
| 199 | await tester.pumpAndSettle(); | 200 | await tester.pumpAndSettle(); |
| 200 | 201 | ||
| 201 | - expect(find.byType(FirstScreen), findsOneWidget); | 202 | + Get.to(SecondScreen()); |
| 202 | 203 | ||
| 203 | - Get.offUntil( | ||
| 204 | - MaterialPageRoute(builder: (context) => SecondScreen()), | ||
| 205 | - ModalRoute.withName('/'), | ||
| 206 | - ); | 204 | + await tester.pumpAndSettle(); |
| 205 | + | ||
| 206 | + Get.offUntil(GetPageRoute(page: () => ThirdScreen()), | ||
| 207 | + (route) => (route as GetPageRoute).routeName == '/FirstScreen'); | ||
| 207 | 208 | ||
| 208 | await tester.pumpAndSettle(); | 209 | await tester.pumpAndSettle(); |
| 209 | 210 | ||
| 210 | - expect(find.byType(SecondScreen), findsOneWidget); | 211 | + expect(find.byType(ThirdScreen), findsOneWidget); |
| 212 | + Get.back(); | ||
| 213 | + | ||
| 214 | + await tester.pumpAndSettle(); | ||
| 215 | + | ||
| 216 | + expect(find.byType(FirstScreen), findsOneWidget); | ||
| 211 | }); | 217 | }); |
| 212 | 218 | ||
| 213 | testWidgets("Get.offNamedUntil smoke test", (tester) async { | 219 | testWidgets("Get.offNamedUntil smoke test", (tester) async { |
| @@ -232,12 +238,19 @@ void main() { | @@ -232,12 +238,19 @@ void main() { | ||
| 232 | ); | 238 | ); |
| 233 | 239 | ||
| 234 | Get.toNamed('/first'); | 240 | Get.toNamed('/first'); |
| 241 | + Get.toNamed('/second'); | ||
| 235 | 242 | ||
| 236 | await tester.pumpAndSettle(); | 243 | await tester.pumpAndSettle(); |
| 237 | 244 | ||
| 238 | - expect(find.byType(FirstScreen), findsOneWidget); | 245 | + expect(find.byType(SecondScreen), findsOneWidget); |
| 246 | + | ||
| 247 | + Get.offNamedUntil('/third', ModalRoute.withName('/first')); | ||
| 239 | 248 | ||
| 240 | - Get.offNamedUntil('/first', ModalRoute.withName('/')); | 249 | + await tester.pumpAndSettle(); |
| 250 | + | ||
| 251 | + expect(find.byType(ThirdScreen), findsOneWidget); | ||
| 252 | + | ||
| 253 | + Get.back(); | ||
| 241 | 254 | ||
| 242 | await tester.pumpAndSettle(); | 255 | await tester.pumpAndSettle(); |
| 243 | 256 |
-
Please register or login to post a comment