Showing
3 changed files
with
109 additions
and
107 deletions
| @@ -80,7 +80,6 @@ class GetModalBottomSheetRoute<T> extends PopupRoute<T> { | @@ -80,7 +80,6 @@ class GetModalBottomSheetRoute<T> extends PopupRoute<T> { | ||
| 80 | elevation: | 80 | elevation: |
| 81 | elevation ?? sheetTheme?.modalElevation ?? sheetTheme?.elevation, | 81 | elevation ?? sheetTheme?.modalElevation ?? sheetTheme?.elevation, |
| 82 | shape: shape, | 82 | shape: shape, |
| 83 | - | ||
| 84 | clipBehavior: clipBehavior, | 83 | clipBehavior: clipBehavior, |
| 85 | isScrollControlled: isScrollControlled, | 84 | isScrollControlled: isScrollControlled, |
| 86 | enableDrag: enableDrag, | 85 | enableDrag: enableDrag, |
| @@ -145,45 +144,47 @@ class _GetModalBottomSheetState<T> extends State<_GetModalBottomSheet<T>> { | @@ -145,45 +144,47 @@ class _GetModalBottomSheetState<T> extends State<_GetModalBottomSheet<T>> { | ||
| 145 | final animationValue = mediaQuery.accessibleNavigation | 144 | final animationValue = mediaQuery.accessibleNavigation |
| 146 | ? 1.0 | 145 | ? 1.0 |
| 147 | : widget.route.animation.value; | 146 | : widget.route.animation.value; |
| 148 | - return Semantics( | 147 | + return Semantics( |
| 149 | scopesRoute: true, | 148 | scopesRoute: true, |
| 150 | namesRoute: true, | 149 | namesRoute: true, |
| 151 | label: routeLabel, | 150 | label: routeLabel, |
| 152 | explicitChildNodes: true, | 151 | explicitChildNodes: true, |
| 153 | child: ClipRect( | 152 | child: ClipRect( |
| 154 | child: CustomSingleChildLayout( | 153 | child: CustomSingleChildLayout( |
| 155 | - delegate: _GetModalBottomSheetLayout( | ||
| 156 | - animationValue, widget.isScrollControlled), | ||
| 157 | - child: widget.isPersistent == false ? BottomSheet( | ||
| 158 | - animationController: widget.route._animationController, | ||
| 159 | - onClosing: () { | ||
| 160 | - if (widget.route.isCurrent) { | ||
| 161 | - Navigator.pop(context); | ||
| 162 | - } | ||
| 163 | - }, | ||
| 164 | - builder: widget.route.builder, | ||
| 165 | - backgroundColor: widget.backgroundColor, | ||
| 166 | - elevation: widget.elevation, | ||
| 167 | - shape: widget.shape, | ||
| 168 | - clipBehavior: widget.clipBehavior, | ||
| 169 | - enableDrag: widget.enableDrag, | ||
| 170 | - ) : Scaffold( | ||
| 171 | - bottomSheet: BottomSheet( | ||
| 172 | - animationController: widget.route._animationController, | ||
| 173 | - onClosing: () { | ||
| 174 | - // if (widget.route.isCurrent) { | ||
| 175 | - // Navigator.pop(context); | ||
| 176 | - // } | ||
| 177 | - }, | ||
| 178 | - builder: widget.route.builder, | ||
| 179 | - backgroundColor: widget.backgroundColor, | ||
| 180 | - elevation: widget.elevation, | ||
| 181 | - shape: widget.shape, | ||
| 182 | - clipBehavior: widget.clipBehavior, | ||
| 183 | - enableDrag: widget.enableDrag, | ||
| 184 | - ), | ||
| 185 | - ) | ||
| 186 | - ), | 154 | + delegate: _GetModalBottomSheetLayout( |
| 155 | + animationValue, widget.isScrollControlled), | ||
| 156 | + child: widget.isPersistent == false | ||
| 157 | + ? BottomSheet( | ||
| 158 | + animationController: widget.route._animationController, | ||
| 159 | + onClosing: () { | ||
| 160 | + if (widget.route.isCurrent) { | ||
| 161 | + Navigator.pop(context); | ||
| 162 | + } | ||
| 163 | + }, | ||
| 164 | + builder: widget.route.builder, | ||
| 165 | + backgroundColor: widget.backgroundColor, | ||
| 166 | + elevation: widget.elevation, | ||
| 167 | + shape: widget.shape, | ||
| 168 | + clipBehavior: widget.clipBehavior, | ||
| 169 | + enableDrag: widget.enableDrag, | ||
| 170 | + ) | ||
| 171 | + : Scaffold( | ||
| 172 | + bottomSheet: BottomSheet( | ||
| 173 | + animationController: | ||
| 174 | + widget.route._animationController, | ||
| 175 | + onClosing: () { | ||
| 176 | + // if (widget.route.isCurrent) { | ||
| 177 | + // Navigator.pop(context); | ||
| 178 | + // } | ||
| 179 | + }, | ||
| 180 | + builder: widget.route.builder, | ||
| 181 | + backgroundColor: widget.backgroundColor, | ||
| 182 | + elevation: widget.elevation, | ||
| 183 | + shape: widget.shape, | ||
| 184 | + clipBehavior: widget.clipBehavior, | ||
| 185 | + enableDrag: widget.enableDrag, | ||
| 186 | + ), | ||
| 187 | + )), | ||
| 187 | ), | 188 | ), |
| 188 | ); | 189 | ); |
| 189 | }, | 190 | }, |
| @@ -255,38 +256,40 @@ class _GetPerModalBottomSheetState<T> | @@ -255,38 +256,40 @@ class _GetPerModalBottomSheetState<T> | ||
| 255 | explicitChildNodes: true, | 256 | explicitChildNodes: true, |
| 256 | child: ClipRect( | 257 | child: ClipRect( |
| 257 | child: CustomSingleChildLayout( | 258 | child: CustomSingleChildLayout( |
| 258 | - delegate: _GetModalBottomSheetLayout( | ||
| 259 | - animationValue, widget.isScrollControlled), | ||
| 260 | - child: widget.isPersistent == false ? BottomSheet( | ||
| 261 | - animationController: widget.route._animationController, | ||
| 262 | - onClosing: () { | ||
| 263 | - if (widget.route.isCurrent) { | ||
| 264 | - Navigator.pop(context); | ||
| 265 | - } | ||
| 266 | - }, | ||
| 267 | - builder: widget.route.builder, | ||
| 268 | - backgroundColor: widget.backgroundColor, | ||
| 269 | - elevation: widget.elevation, | ||
| 270 | - shape: widget.shape, | ||
| 271 | - clipBehavior: widget.clipBehavior, | ||
| 272 | - enableDrag: widget.enableDrag, | ||
| 273 | - ) : Scaffold( | ||
| 274 | - bottomSheet: BottomSheet( | ||
| 275 | - animationController: widget.route._animationController, | ||
| 276 | - onClosing: () { | ||
| 277 | - // if (widget.route.isCurrent) { | ||
| 278 | - // Navigator.pop(context); | ||
| 279 | - // } | ||
| 280 | - }, | ||
| 281 | - builder: widget.route.builder, | ||
| 282 | - backgroundColor: widget.backgroundColor, | ||
| 283 | - elevation: widget.elevation, | ||
| 284 | - shape: widget.shape, | ||
| 285 | - clipBehavior: widget.clipBehavior, | ||
| 286 | - enableDrag: widget.enableDrag, | ||
| 287 | - ), | ||
| 288 | - ) | ||
| 289 | - ), | 259 | + delegate: _GetModalBottomSheetLayout( |
| 260 | + animationValue, widget.isScrollControlled), | ||
| 261 | + child: widget.isPersistent == false | ||
| 262 | + ? BottomSheet( | ||
| 263 | + animationController: widget.route._animationController, | ||
| 264 | + onClosing: () { | ||
| 265 | + if (widget.route.isCurrent) { | ||
| 266 | + Navigator.pop(context); | ||
| 267 | + } | ||
| 268 | + }, | ||
| 269 | + builder: widget.route.builder, | ||
| 270 | + backgroundColor: widget.backgroundColor, | ||
| 271 | + elevation: widget.elevation, | ||
| 272 | + shape: widget.shape, | ||
| 273 | + clipBehavior: widget.clipBehavior, | ||
| 274 | + enableDrag: widget.enableDrag, | ||
| 275 | + ) | ||
| 276 | + : Scaffold( | ||
| 277 | + bottomSheet: BottomSheet( | ||
| 278 | + animationController: | ||
| 279 | + widget.route._animationController, | ||
| 280 | + onClosing: () { | ||
| 281 | + // if (widget.route.isCurrent) { | ||
| 282 | + // Navigator.pop(context); | ||
| 283 | + // } | ||
| 284 | + }, | ||
| 285 | + builder: widget.route.builder, | ||
| 286 | + backgroundColor: widget.backgroundColor, | ||
| 287 | + elevation: widget.elevation, | ||
| 288 | + shape: widget.shape, | ||
| 289 | + clipBehavior: widget.clipBehavior, | ||
| 290 | + enableDrag: widget.enableDrag, | ||
| 291 | + ), | ||
| 292 | + )), | ||
| 290 | ), | 293 | ), |
| 291 | ); | 294 | ); |
| 292 | }, | 295 | }, |
| @@ -26,4 +26,3 @@ abstract class RxInterface<T> { | @@ -26,4 +26,3 @@ abstract class RxInterface<T> { | ||
| 26 | /// Calls [callback] with current value, when the value changes. | 26 | /// Calls [callback] with current value, when the value changes. |
| 27 | StreamSubscription<T> listen(ValueCallback<T> callback); | 27 | StreamSubscription<T> listen(ValueCallback<T> callback); |
| 28 | } | 28 | } |
| 29 | - |
| @@ -26,13 +26,13 @@ class _Wrapper extends StatelessWidget { | @@ -26,13 +26,13 @@ class _Wrapper extends StatelessWidget { | ||
| 26 | } | 26 | } |
| 27 | 27 | ||
| 28 | void testController<T>( | 28 | void testController<T>( |
| 29 | - String description, | ||
| 30 | - void Function(T) callback, { | ||
| 31 | - @required T controller, | ||
| 32 | - void Function(T) onInit, | ||
| 33 | - void Function(T) onReady, | ||
| 34 | - void Function(T) onClose, | ||
| 35 | - }) { | 29 | + String description, |
| 30 | + void Function(T) callback, { | ||
| 31 | + @required T controller, | ||
| 32 | + void Function(T) onInit, | ||
| 33 | + void Function(T) onReady, | ||
| 34 | + void Function(T) onClose, | ||
| 35 | +}) { | ||
| 36 | test(description, () { | 36 | test(description, () { |
| 37 | onInit(controller); | 37 | onInit(controller); |
| 38 | SchedulerBinding.instance.addPostFrameCallback((f) { | 38 | SchedulerBinding.instance.addPostFrameCallback((f) { |
| @@ -44,26 +44,26 @@ void testController<T>( | @@ -44,26 +44,26 @@ void testController<T>( | ||
| 44 | } | 44 | } |
| 45 | 45 | ||
| 46 | Future<T> testGetX<T extends DisposableInterface>( | 46 | Future<T> testGetX<T extends DisposableInterface>( |
| 47 | - String description, { | ||
| 48 | - @required GetX<T> widget, | ||
| 49 | - @required void Function(T controller) test, | ||
| 50 | - }) async { | 47 | + String description, { |
| 48 | + @required GetX<T> widget, | ||
| 49 | + @required void Function(T controller) test, | ||
| 50 | +}) async { | ||
| 51 | T controller; | 51 | T controller; |
| 52 | testWidgets(description, (tester) async { | 52 | testWidgets(description, (tester) async { |
| 53 | provideMockedNetworkImages(() async { | 53 | provideMockedNetworkImages(() async { |
| 54 | - await tester.pumpWidget(GetMaterialApp(home: widget)); | ||
| 55 | - final controller = Get.find<T>(); | ||
| 56 | - test(controller); | 54 | + await tester.pumpWidget(GetMaterialApp(home: widget)); |
| 55 | + final controller = Get.find<T>(); | ||
| 56 | + test(controller); | ||
| 57 | }); | 57 | }); |
| 58 | }); | 58 | }); |
| 59 | return controller; | 59 | return controller; |
| 60 | } | 60 | } |
| 61 | 61 | ||
| 62 | Future<T> testGetBuilder<T extends GetxController>( | 62 | Future<T> testGetBuilder<T extends GetxController>( |
| 63 | - String description, { | ||
| 64 | - @required GetBuilder<T> widget, | ||
| 65 | - @required void Function(T controller) test, | ||
| 66 | - }) async { | 63 | + String description, { |
| 64 | + @required GetBuilder<T> widget, | ||
| 65 | + @required void Function(T controller) test, | ||
| 66 | +}) async { | ||
| 67 | T controller; | 67 | T controller; |
| 68 | testWidgets(description, (tester) async { | 68 | testWidgets(description, (tester) async { |
| 69 | provideMockedNetworkImages(() async { | 69 | provideMockedNetworkImages(() async { |
| @@ -76,11 +76,11 @@ Future<T> testGetBuilder<T extends GetxController>( | @@ -76,11 +76,11 @@ Future<T> testGetBuilder<T extends GetxController>( | ||
| 76 | } | 76 | } |
| 77 | 77 | ||
| 78 | Future<T> testObx<T extends GetxController>( | 78 | Future<T> testObx<T extends GetxController>( |
| 79 | - String description, { | ||
| 80 | - @required T controller, | ||
| 81 | - @required Obx Function(T controller) widget, | ||
| 82 | - @required void Function(T controller) test, | ||
| 83 | - }) async { | 79 | + String description, { |
| 80 | + @required T controller, | ||
| 81 | + @required Obx Function(T controller) widget, | ||
| 82 | + @required void Function(T controller) test, | ||
| 83 | +}) async { | ||
| 84 | testWidgets(description, (tester) async { | 84 | testWidgets(description, (tester) async { |
| 85 | provideMockedNetworkImages(() async { | 85 | provideMockedNetworkImages(() async { |
| 86 | await tester.pumpWidget(GetMaterialApp(home: widget(controller))); | 86 | await tester.pumpWidget(GetMaterialApp(home: widget(controller))); |
| @@ -91,18 +91,18 @@ Future<T> testObx<T extends GetxController>( | @@ -91,18 +91,18 @@ Future<T> testObx<T extends GetxController>( | ||
| 91 | } | 91 | } |
| 92 | 92 | ||
| 93 | void getTest( | 93 | void getTest( |
| 94 | - String description, { | ||
| 95 | - @required WidgetTesterCallback widgetTest, | ||
| 96 | - Widget wrapper, | ||
| 97 | - List<GetPage> getPages, | ||
| 98 | - String initialRoute = '/', | ||
| 99 | - bool skip = false, | ||
| 100 | - Timeout timeout, | ||
| 101 | - Duration initialTimeout, | ||
| 102 | - bool semanticsEnabled = true, | ||
| 103 | - TestVariant<Object> variant = const DefaultTestVariant(), | ||
| 104 | - dynamic tags, | ||
| 105 | - }) { | 94 | + String description, { |
| 95 | + @required WidgetTesterCallback widgetTest, | ||
| 96 | + Widget wrapper, | ||
| 97 | + List<GetPage> getPages, | ||
| 98 | + String initialRoute = '/', | ||
| 99 | + bool skip = false, | ||
| 100 | + Timeout timeout, | ||
| 101 | + Duration initialTimeout, | ||
| 102 | + bool semanticsEnabled = true, | ||
| 103 | + TestVariant<Object> variant = const DefaultTestVariant(), | ||
| 104 | + dynamic tags, | ||
| 105 | +}) { | ||
| 106 | assert(variant != null); | 106 | assert(variant != null); |
| 107 | assert(variant.values.isNotEmpty); | 107 | assert(variant.values.isNotEmpty); |
| 108 | 108 | ||
| @@ -118,11 +118,11 @@ void getTest( | @@ -118,11 +118,11 @@ void getTest( | ||
| 118 | 118 | ||
| 119 | testWidgets( | 119 | testWidgets( |
| 120 | description, | 120 | description, |
| 121 | - (tester) async { | ||
| 122 | - provideMockedNetworkImages(() async { | ||
| 123 | - await tester.pumpWidget(wrapper); | ||
| 124 | - widgetTest(tester); | ||
| 125 | - }); | 121 | + (tester) async { |
| 122 | + provideMockedNetworkImages(() async { | ||
| 123 | + await tester.pumpWidget(wrapper); | ||
| 124 | + widgetTest(tester); | ||
| 125 | + }); | ||
| 126 | }, | 126 | }, |
| 127 | skip: skip, | 127 | skip: skip, |
| 128 | timeout: timeout, | 128 | timeout: timeout, |
-
Please register or login to post a comment