Skip to content

Commit bb4c9b3

Browse files
Reverts "Add generic type for result in PopScope (#139164)" (#147015)
Reverts: flutter/flutter#139164 Initiated by: chunhtai Reason for reverting: hard breaking change Original PR Author: chunhtai Reviewed By: {justinmc} This change reverts the following previous change: Adds a generic type and pop result to popscope and its friend. The use cases are to be able to capture the result when the pop is called. migration guide: flutter/website#9872
1 parent e8fc89e commit bb4c9b3

File tree

18 files changed

+55
-466
lines changed

18 files changed

+55
-466
lines changed

dev/integration_tests/flutter_gallery/lib/demo/cupertino/cupertino_navigation_demo.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class CupertinoNavigationDemo extends StatelessWidget {
4848

4949
@override
5050
Widget build(BuildContext context) {
51-
return PopScope<Object?>(
51+
return PopScope(
5252
// Prevent swipe popping of this page. Use explicit exit buttons only.
5353
canPop: false,
5454
child: DefaultTextStyle(

dev/integration_tests/flutter_gallery/lib/demo/material/full_screen_dialog_demo.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ class FullScreenDialogDemoState extends State<FullScreenDialogDemo> {
110110
bool _hasName = false;
111111
late String _eventName;
112112

113-
Future<void> _handlePopInvoked(bool didPop, Object? result) async {
113+
Future<void> _handlePopInvoked(bool didPop) async {
114114
if (didPop) {
115115
return;
116116
}

dev/integration_tests/flutter_gallery/lib/demo/material/text_form_field_demo.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ class TextFormFieldDemoState extends State<TextFormFieldDemo> {
143143
return null;
144144
}
145145

146-
Future<void> _handlePopInvoked(bool didPop, Object? result) async {
146+
Future<void> _handlePopInvoked(bool didPop) async {
147147
if (didPop) {
148148
return;
149149
}

dev/integration_tests/flutter_gallery/lib/demo/shrine/expanding_bottom_sheet.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ class ExpandingBottomSheetState extends State<ExpandingBottomSheet> with TickerP
355355

356356
// Closes the cart if the cart is open, otherwise exits the app (this should
357357
// only be relevant for Android).
358-
void _handlePopInvoked(bool didPop, Object? result) {
358+
void _handlePopInvoked(bool didPop) {
359359
if (didPop) {
360360
return;
361361
}
@@ -370,7 +370,7 @@ class ExpandingBottomSheetState extends State<ExpandingBottomSheet> with TickerP
370370
duration: const Duration(milliseconds: 225),
371371
curve: Curves.easeInOut,
372372
alignment: FractionalOffset.topLeft,
373-
child: PopScope<Object?>(
373+
child: PopScope(
374374
canPop: !_isOpen,
375375
onPopInvoked: _handlePopInvoked,
376376
child: AnimatedBuilder(

dev/integration_tests/flutter_gallery/lib/gallery/home.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,9 +326,9 @@ class _GalleryHomeState extends State<GalleryHome> with SingleTickerProviderStat
326326
backgroundColor: isDark ? _kFlutterBlue : theme.primaryColor,
327327
body: SafeArea(
328328
bottom: false,
329-
child: PopScope<Object?>(
329+
child: PopScope(
330330
canPop: _category == null,
331-
onPopInvoked: (bool didPop, Object? result) {
331+
onPopInvoked: (bool didPop) {
332332
if (didPop) {
333333
return;
334334
}

examples/api/lib/widgets/form/form.1.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ class _SaveableFormState extends State<_SaveableForm> {
111111
const SizedBox(height: 20.0),
112112
Form(
113113
canPop: !_isDirty,
114-
onPopInvoked: (bool didPop, Object? result) async {
114+
onPopInvoked: (bool didPop) async {
115115
if (didPop) {
116116
return;
117117
}

examples/api/lib/widgets/pop_scope/pop_scope.0.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,9 @@ class _PageTwoState extends State<_PageTwo> {
109109
mainAxisAlignment: MainAxisAlignment.center,
110110
children: <Widget>[
111111
const Text('Page Two'),
112-
PopScope<Object?>(
112+
PopScope(
113113
canPop: false,
114-
onPopInvoked: (bool didPop, Object? result) async {
114+
onPopInvoked: (bool didPop) async {
115115
if (didPop) {
116116
return;
117117
}

examples/api/lib/widgets/pop_scope/pop_scope.1.dart

Lines changed: 0 additions & 232 deletions
This file was deleted.

examples/api/test/widgets/pop_scope/pop_scope.1_test.dart

Lines changed: 0 additions & 67 deletions
This file was deleted.

packages/flutter/lib/src/material/about.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1230,9 +1230,9 @@ class _MasterDetailFlowState extends State<_MasterDetailFlow> implements _PageOp
12301230
}
12311231

12321232
MaterialPageRoute<void> _detailPageRoute(Object? arguments) {
1233-
return MaterialPageRoute<void>(builder: (BuildContext context) {
1234-
return PopScope<void>(
1235-
onPopInvoked: (bool didPop, void result) {
1233+
return MaterialPageRoute<dynamic>(builder: (BuildContext context) {
1234+
return PopScope(
1235+
onPopInvoked: (bool didPop) {
12361236
// No need for setState() as rebuild happens on navigation pop.
12371237
focus = _Focus.master;
12381238
},

0 commit comments

Comments
 (0)