From 8aee75f64579cb70d569bc13f59e7ce3a6001f6b Mon Sep 17 00:00:00 2001 From: Jonah Williams Date: Mon, 12 Oct 2020 16:09:20 -0700 Subject: [PATCH] Revert "Pass RouteSettings to the internal Route in showCupertinoModalPopup (#56024)" (#67969) This reverts commit da58f5e6fe034f8edfa1adc08debcb92d42e2a68. --- packages/flutter/lib/src/cupertino/route.dart | 5 --- .../flutter/test/cupertino/route_test.dart | 44 ------------------- 2 files changed, 49 deletions(-) diff --git a/packages/flutter/lib/src/cupertino/route.dart b/packages/flutter/lib/src/cupertino/route.dart index ace6af939c..73669d02ab 100644 --- a/packages/flutter/lib/src/cupertino/route.dart +++ b/packages/flutter/lib/src/cupertino/route.dart @@ -1031,9 +1031,6 @@ class _CupertinoModalPopupRoute extends PopupRoute { /// The `semanticsDismissible` argument is used to determine whether the /// semantics of the modal barrier are included in the semantics tree. /// -/// The `routeSettings` argument is used to provide [RouteSettings] to the -/// created Route. -/// /// The `builder` argument typically builds a [CupertinoActionSheet] widget. /// Content below the widget is dimmed with a [ModalBarrier]. The widget built /// by the `builder` does not share a context with the location that @@ -1057,7 +1054,6 @@ Future showCupertinoModalPopup({ bool barrierDismissible = true, bool useRootNavigator = true, bool? semanticsDismissible, - RouteSettings? routeSettings, }) { assert(useRootNavigator != null); return Navigator.of(context, rootNavigator: useRootNavigator)!.push( @@ -1068,7 +1064,6 @@ Future showCupertinoModalPopup({ builder: builder, filter: filter, semanticsDismissible: semanticsDismissible, - settings: routeSettings, ), ); } diff --git a/packages/flutter/test/cupertino/route_test.dart b/packages/flutter/test/cupertino/route_test.dart index 1c22012500..69df6707c6 100644 --- a/packages/flutter/test/cupertino/route_test.dart +++ b/packages/flutter/test/cupertino/route_test.dart @@ -1345,38 +1345,6 @@ void main() { debugDefaultTargetPlatformOverride = null; }); - testWidgets('showCupertinoModalPopup passes RouteSettings to PopupRoute', (WidgetTester tester) async { - final RouteSettingsObserver routeSettingsObserver = RouteSettingsObserver(); - - await tester.pumpWidget(CupertinoApp( - navigatorObservers: [routeSettingsObserver], - home: Navigator( - onGenerateRoute: (RouteSettings settings) { - return PageRouteBuilder( - pageBuilder: (BuildContext context, Animation _, - Animation __) { - return GestureDetector( - onTap: () async { - await showCupertinoModalPopup( - context: context, - builder: (BuildContext context) => const SizedBox(), - routeSettings: const RouteSettings(name: '/modal'), - ); - }, - child: const Text('tap'), - ); - }, - ); - }, - ), - )); - - // Open the dialog. - await tester.tap(find.text('tap')); - - expect(routeSettingsObserver.routeName, '/modal'); - }); - testWidgets('showCupertinoModalPopup transparent barrier color is transparent', (WidgetTester tester) async { const Color _kTransparentColor = Color(0x00000000); @@ -1689,18 +1657,6 @@ class DialogObserver extends NavigatorObserver { } } -class RouteSettingsObserver extends NavigatorObserver { - String routeName; - - @override - void didPush(Route route, Route previousRoute) { - if (route.toString().contains('_CupertinoModalPopupRoute')) { - routeName = route.settings.name; - } - super.didPush(route, previousRoute); - } -} - class TransitionDetector extends DefaultTransitionDelegate { bool hasTransition = false; @override