Skip to content

Added SystemNavigator.pop "animated" argument.#41820

Merged
gaaclarke merged 4 commits intoflutter:masterfrom
gaaclarke:system-navigator-pop-animated
Oct 8, 2019
Merged

Added SystemNavigator.pop "animated" argument.#41820
gaaclarke merged 4 commits intoflutter:masterfrom
gaaclarke:system-navigator-pop-animated

Conversation

@gaaclarke
Copy link
Member

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.

  • [x ] I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • [x ] I signed the CLA.
  • [x ] I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • [ x] I updated/added relevant documentation (doc comments with ///).
  • [ x] All existing and new tests are passing.
  • [x ] The analyzer (flutter analyze --flutter-repo) does not report any problems on my PR.
  • [ x] I am willing to follow-up on review comments in a timely manner.

Breaking Change

Does your PR require Flutter developers to manually update their apps to accommodate your change?

  • Yes, this is a breaking change (Please read Handling breaking changes). Replace this with a link to the e-mail where you asked for input on this proposed change.
  • [x ] No, this is not a breaking change.

@fluttergithubbot
Copy link
Contributor

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.

@fluttergithubbot fluttergithubbot added the framework flutter/packages/flutter repository. See also f: labels. label Oct 2, 2019
Copy link
Member

@goderbauer goderbauer left a comment

Choose a reason for hiding this comment

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

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
Copy link
Member

Choose a reason for hiding this comment

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

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.

Copy link
Member

Choose a reason for hiding this comment

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

Also: I thought apple doesn't allow popping the root ViewController (see old documentation). What has changed?

Copy link
Member Author

Choose a reason for hiding this comment

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

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.

Copy link
Member

Choose a reason for hiding this comment

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

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.

Copy link
Member Author

Choose a reason for hiding this comment

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

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
Copy link
Member

Choose a reason for hiding this comment

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

nit: Enclose animated in ` instead of [.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

@gaaclarke gaaclarke requested a review from goderbauer October 2, 2019 22:54
Copy link
Contributor

@chunhtai chunhtai left a comment

Choose a reason for hiding this comment

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

LGTM

@gaaclarke gaaclarke merged commit ed1d5a8 into flutter:master Oct 8, 2019
Inconnu08 pushed a commit to Inconnu08/flutter that referenced this pull request Nov 26, 2019
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants