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: https://github.com/flutter/website/pull/9872
This commit is contained in:
auto-submit[bot]
2024-04-18 22:36:26 +00:00
committed by GitHub
parent e8fc89e690
commit bb4c9b381e
18 changed files with 55 additions and 466 deletions

View File

@@ -48,7 +48,7 @@ class CupertinoNavigationDemo extends StatelessWidget {
@override
Widget build(BuildContext context) {
return PopScope<Object?>(
return PopScope(
// Prevent swipe popping of this page. Use explicit exit buttons only.
canPop: false,
child: DefaultTextStyle(

View File

@@ -110,7 +110,7 @@ class FullScreenDialogDemoState extends State<FullScreenDialogDemo> {
bool _hasName = false;
late String _eventName;
Future<void> _handlePopInvoked(bool didPop, Object? result) async {
Future<void> _handlePopInvoked(bool didPop) async {
if (didPop) {
return;
}

View File

@@ -143,7 +143,7 @@ class TextFormFieldDemoState extends State<TextFormFieldDemo> {
return null;
}
Future<void> _handlePopInvoked(bool didPop, Object? result) async {
Future<void> _handlePopInvoked(bool didPop) async {
if (didPop) {
return;
}

View File

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

View File

@@ -326,9 +326,9 @@ class _GalleryHomeState extends State<GalleryHome> with SingleTickerProviderStat
backgroundColor: isDark ? _kFlutterBlue : theme.primaryColor,
body: SafeArea(
bottom: false,
child: PopScope<Object?>(
child: PopScope(
canPop: _category == null,
onPopInvoked: (bool didPop, Object? result) {
onPopInvoked: (bool didPop) {
if (didPop) {
return;
}