Skip to content

Commit

Permalink
Revert "add a new PopScope.onPopWithResultInvoke widget to replace Po… (
Browse files Browse the repository at this point in the history
flutter#147597)

…pScope.onPopInvoke (flutter#147016)"

This reverts commit 8031a3e.

Needs to migrate flutter_eval

## Pre-launch Checklist

- [ ] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [ ] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [ ] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [ ] I signed the [CLA].
- [ ] I listed at least one issue that this PR fixes in the description
above.
- [ ] I updated/added relevant documentation (doc comments with `///`).
- [ ] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [ ] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [ ] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#overview
[Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene
[test-exempt]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes
[Discord]: https://github.com/flutter/flutter/wiki/Chat
[Data Driven Fixes]:
https://github.com/flutter/flutter/wiki/Data-driven-Fixes
  • Loading branch information
chunhtai authored and chingjun committed Apr 30, 2024
1 parent 2e80670 commit d794b09
Show file tree
Hide file tree
Showing 18 changed files with 75 additions and 546 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -175,7 +175,7 @@ class FullScreenDialogDemoState extends State<FullScreenDialogDemo> {
),
body: Form(
canPop: !_saveNeeded && !_hasLocation && !_hasName,
onPopInvokedWithResult: _handlePopInvoked,
onPopInvoked: _handlePopInvoked,
child: Scrollbar(
child: ListView(
primary: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -192,7 +192,7 @@ class TextFormFieldDemoState extends State<TextFormFieldDemo> {
key: _formKey,
autovalidateMode: _autovalidateMode,
canPop: _formKey.currentState == null || !_formWasEdited || _formKey.currentState!.validate(),
onPopInvokedWithResult: _handlePopInvoked,
onPopInvoked: _handlePopInvoked,
child: Scrollbar(
child: SingleChildScrollView(
primary: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -370,9 +370,9 @@ 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,
onPopInvokedWithResult: _handlePopInvoked,
onPopInvoked: _handlePopInvoked,
child: AnimatedBuilder(
animation: widget.hideController,
builder: _buildSlideAnimation,
Expand Down
4 changes: 2 additions & 2 deletions dev/integration_tests/flutter_gallery/lib/gallery/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
onPopInvokedWithResult: (bool didPop, Object? result) {
onPopInvoked: (bool didPop) {
if (didPop) {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion examples/api/lib/widgets/form/form.1.dart
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class _SaveableFormState extends State<_SaveableForm> {
const SizedBox(height: 20.0),
Form(
canPop: !_isDirty,
onPopInvokedWithResult: (bool didPop, Object? result) async {
onPopInvoked: (bool didPop) async {
if (didPop) {
return;
}
Expand Down
4 changes: 2 additions & 2 deletions examples/api/lib/widgets/pop_scope/pop_scope.0.dart
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@ class _PageTwoState extends State<_PageTwo> {
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
const Text('Page Two'),
PopScope<Object?>(
PopScope(
canPop: false,
onPopInvokedWithResult: (bool didPop, Object? result) async {
onPopInvoked: (bool didPop) async {
if (didPop) {
return;
}
Expand Down
233 changes: 0 additions & 233 deletions examples/api/lib/widgets/pop_scope/pop_scope.1.dart

This file was deleted.

0 comments on commit d794b09

Please sign in to comment.