-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[DO NOT MERGE] Adds page apis migration guide #9873
Conversation
Visit the preview URL for this PR (updated for commit b09a47b): https://flutter-docs-prod--pr9873-page-apis-8eoyjmvl.web.app |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@chunhtai : I'll approve so you don't need to go through another round, but would recommend accepting these suggestions. Thanks!
## Context | ||
|
||
The `onPopPage` was added for cleaning up pages after a page is about to be popped. | ||
The developer can veto pop by returning false in the callback. This does not work well |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A global request. Rather than say "the developer", can you replace with "you"? Or reword to avoid the pronoun entirely?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simple and straight
The developer can veto pop by returning false in the callback. This does not work well | |
To veto pop, return `false` in the callback. This does not work well |
|
||
The `onPopPage` was added for cleaning up pages after a page is about to be popped. | ||
The developer can veto pop by returning false in the callback. This does not work well | ||
with other popping mechanisms in the framework, such as [`PopScope`] and cupertino back |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: Is the cupertino mention an object or something else? Might be good to link to something.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd change this even further:
Use the onPopPage
method to clean up after a page is about to be popped.
You can veto the pop by returning false
in the callback. This method doesn't work well
with other popping mechanisms in the framework,
such as [PopScope
][] or CupertinoNavigationBarBackButton
.
with other popping mechanisms in the framework, such as [`PopScope`] and cupertino back | ||
gestures. | ||
|
||
The page APIs needed to be refactored in order to integrate them together. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggstion: Condition, then instruction per GSG.
The page APIs needed to be refactored in order to integrate them together. | |
To integrate the other pop mechanisms together, the page APIs need to be refactored. |
The `onPopPage` is replaced by `onDidRemovePage` and no longer had the ability to veto | ||
a pop. In the `onDidRemovePage`, one is only responsible for updating the [`pages`]. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: Write in active voice per GSG. Google Style doesn't recommend using a property as a noun on its own. It should modify what it's changing.
The `onPopPage` is replaced by `onDidRemovePage` and no longer had the ability to veto | |
a pop. In the `onDidRemovePage`, one is only responsible for updating the [`pages`]. | |
The `onDidRemovePage` property replaces the `onPopPage` property. | |
It can no longer veto a pop. | |
In the `onDidRemovePage`, one is only responsible for updating the [`pages`]. |
The veto mechanism is moved to the `Page.canPop` and `Page.onPopInvoked` similar to how | ||
one uses the `PopScope` widget. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: Write in active voice per GSG.
The veto mechanism is moved to the `Page.canPop` and `Page.onPopInvoked` similar to how | |
one uses the `PopScope` widget. | |
The veto mechanism moves to the `Page.canPop` and `Page.onPopInvoked`. | |
These function similar to how one uses the `PopScope` widget. |
I'd like to make further changes to this, @chunhtai. Perhaps you can make some changes, so far, and I can review it again? Definitely don't land. |
@chunhtai, this PR has become a bit of a mess. I'm closing it. Can you open a fresh copy? thx! |
waiting for flutter/flutter#137792
Presubmit checklist