Added SystemNavigator.pop "animated" argument.#41820
Added SystemNavigator.pop "animated" argument.#41820gaaclarke merged 4 commits intoflutter:masterfrom
Conversation
bias and was incorrect for iOS.
|
It looks like this pull request may not have tests. Please make sure to add tests before merging. While there are exceptions to this rule, if this patch modifies code it is probably not an exception. Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
goderbauer
left a comment
There was a problem hiding this comment.
Is there an engine side change related to this that you can link from the PR description?
| /// had crashed. | ||
| static Future<void> pop() async { | ||
| await SystemChannels.platform.invokeMethod<void>('SystemNavigator.pop'); | ||
| /// On iOS, calls `popViewControllerAnimated:` if the root view |
There was a problem hiding this comment.
Can we document this in terms of what happens from a user perspective instead of what APIs are called? Just like its done on Android above.
There was a problem hiding this comment.
Also: I thought apple doesn't allow popping the root ViewController (see old documentation). What has changed?
There was a problem hiding this comment.
Can we document this in terms of what happens from a user perspective instead of what APIs are called? Just like its done on Android above.
The reason I talked about the actual implementation is because "animated" doesn't have a definite meaning. It means whatever Apple decides it means, and could potentially change it. You might even be able to customize it. So, if we said "animated means you will do a slide out animation to the left" that might not be true always. I could say something like "performs UIViewController's dismiss animation", you like that?
Also: I thought apple doesn't allow popping the root ViewController (see old documentation). What has changed?
Yep, that changed. See: https://github.com/flutter/engine/blob/c12b917e95074aec4700dd5554563bc84f93ecc2/shell/platform/darwin/ios/framework/Source/FlutterPlatformPlugin.mm#L197
It now has slightly different semantics for iOS since the platforms' concepts don't really match.
There was a problem hiding this comment.
My comment wasn't talking about the documentation about "animated". That one is fine. It was talking about the "popViewControllerAnimated". That one should say in prose what calling "pop" means on iOS, e.g. the FlutterViewController is removed or whatever it does. Similarly to how the Android part documents this.
The link you provided basically has a comment that describes what happens in words instead of in terms of API.
There was a problem hiding this comment.
Sorry, github isn't good at displaying chains of PR's. That text was already approved in a previous PR, that's why I as confused.
That one should say in prose what calling "pop" means on iOS
I believe that it is already explained on the first line in prose, "Removes the topmost Flutter instance, presenting what was before it.".
I've added the iOS section about implementation details in order to provide more color. The comment in the code I link referred to "navigation controllers" which is a less specific way to say UINavigationController. I think in this case when we are providing further details; we are doing users a disservice by avoiding concrete classes and methods. I'm happy to chat in person if you want to look into it more =)
| /// `dismissViewControllerAnimated:completion:` if the top view | ||
| /// controller is a `FlutterViewController`. | ||
| /// | ||
| /// The optional [animated] parameter is ignored on all platforms |
There was a problem hiding this comment.
nit: Enclose animated in ` instead of [.
Description
Added SystemNavigator.pop "animated" argument which has meaning on iOS.
Related Issues
#32382
Tests
I added the following tests:
Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]). This will ensure a smooth and quick review process.///).flutter analyze --flutter-repo) does not report any problems on my PR.Breaking Change
Does your PR require Flutter developers to manually update their apps to accommodate your change?