Skip to content

Conversation

@justinmc
Copy link
Contributor

Updates two PopScope examples to a more clear usage of showDialog.

This came up in #138614, where many users were confused about how to use a back confirmation dialog with PopScope. Two examples of this already exist, but now they are cleaner and follow more typical navigation patterns, so users should recognize their own code in them more easily.

@justinmc justinmc self-assigned this Jan 24, 2024
@github-actions github-actions bot added framework flutter/packages/flutter repository. See also f: labels. d: api docs Issues with https://api.flutter.dev/ d: examples Sample code and demos labels Jan 24, 2024
@justinmc justinmc marked this pull request as ready for review January 24, 2024 20:00
Copy link
Contributor

@LongCatIsLooong LongCatIsLooong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked at https://main-api.flutter.dev/flutter/widgets/PopScope-class.html the example description only says "This sample demonstrates how to use this widget to handle nested navigation in a bottom navigation bar.".

If I was looking for information on how to use an async function in PopScope I would probably turn away upon reading that description since it doesn't sound that interesting.

/// Shows a dialog and resolves to true when the user has indicated that they
/// want to pop.
///
/// A null indicates a desire not to pop.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where's null introduced?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

showDialog can return a Future that resolves to null. Dismissing the dialog (such as by tapping the barrier) will resolve to null. In those cases, the user doesn't want to leave the page.

I'll change that to "A return value of null indicates a desire not to pop, such as when the user has dismissed the modal without tapping a button."

@justinmc
Copy link
Contributor Author

@LongCatIsLooong Good catch, that example description is actually totally wrong. I must have copied it from one of the navigator_pop_handler examples by mistake. I've updated it.

Copy link
Contributor

@LongCatIsLooong LongCatIsLooong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@justinmc justinmc merged commit 204a884 into flutter:master Jan 25, 2024
@justinmc justinmc deleted the pop-scope-example-improvements branch January 25, 2024 18:14
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 26, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 26, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 26, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 26, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 26, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 26, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 26, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 27, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 27, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 28, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 28, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 29, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 29, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 29, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 29, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 29, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 29, 2024
auto-submit bot pushed a commit to flutter/packages that referenced this pull request Jan 29, 2024
Manual roll requested by stuartmorgan@google.com

flutter/flutter@a8efa77...2f6fdf2

2024-01-26 matanlurey@users.noreply.github.com Start renaming by adding a new `bringup: true` as an Android emulator. (flutter/flutter#142257)
2024-01-26 polinach@google.com Instrument ImageInfo. (flutter/flutter#141411)
2024-01-26 36861262+QuncCccccc@users.noreply.github.com Fix `SegmentedButton` default size and default tappable size (flutter/flutter#142243)
2024-01-26 godofredoc@google.com Update name for android_defines_test. (flutter/flutter#142273)
2024-01-26 101587250+pbo-linaro@users.noreply.github.com Enable native compilation for windows-arm64 (flutter/flutter#141930)
2024-01-25 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Roll Flutter Engine from 4b145d041560 to 44f26274bfbe (6 revisions)" (flutter/flutter#142274)
2024-01-25 godofredoc@google.com Run a few mac tests only on arm. (flutter/flutter#142188)
2024-01-25 82763757+NobodyForNothing@users.noreply.github.com fix Ink not updating on TextField newline (flutter/flutter#140700)
2024-01-25 49699333+dependabot[bot]@users.noreply.github.com Bump codecov/codecov-action from 3.1.4 to 3.1.5 (flutter/flutter#142259)
2024-01-25 engine-flutter-autoroll@skia.org Roll Flutter Engine from 4b145d041560 to 44f26274bfbe (6 revisions) (flutter/flutter#142264)
2024-01-25 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Reverts "Rename `integration_tests/external_ui` but do not touch anything else..."" (flutter/flutter#142268)
2024-01-25 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Rename `integration_tests/external_ui` but do not touch anything else..." (flutter/flutter#142265)
2024-01-25 engine-flutter-autoroll@skia.org Roll Flutter Engine from b2167a93c1a0 to 4b145d041560 (3 revisions) (flutter/flutter#142256)
2024-01-25 nathan.wilson1232@gmail.com Implementing `switch` expressions in the `cupertino/` directory (flutter/flutter#141591)
2024-01-25 matanlurey@users.noreply.github.com Rename `integration_tests/external_ui` but do not touch anything else... (flutter/flutter#142238)
2024-01-25 engine-flutter-autoroll@skia.org Roll Flutter Engine from 55eefd5bd255 to b2167a93c1a0 (2 revisions) (flutter/flutter#142252)
2024-01-25 engine-flutter-autoroll@skia.org Roll Flutter Engine from 3b4779324b44 to 55eefd5bd255 (6 revisions) (flutter/flutter#142245)
2024-01-25 louisehsu@google.com Fix incorrect zh-cn translation for Look Up Label in selection controls (flutter/flutter#142158)
2024-01-25 jmccandless@google.com PopScope example improvements (flutter/flutter#142163)
2024-01-25 engine-flutter-autoroll@skia.org Roll Flutter Engine from 1d3f16b0d62e to 3b4779324b44 (1 revision) (flutter/flutter#142225)
2024-01-25 engine-flutter-autoroll@skia.org Roll Packages from 8fbdf65 to 21b5abb (6 revisions) (flutter/flutter#142224)
2024-01-25 sigurdm@google.com Don't show legacy welcome message when analytics are disabled (flutter/flutter#140956)
2024-01-25 engine-flutter-autoroll@skia.org Roll Flutter Engine from 7c4ed15cb271 to 1d3f16b0d62e (1 revision) (flutter/flutter#142223)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC rmistry@google.com,stuartmorgan@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

d: api docs Issues with https://api.flutter.dev/ d: examples Sample code and demos framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants