Skip to content
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

Added parallax effect for cupertino fullscreenDialog #50180

Conversation

Kavantix
Copy link
Contributor

@Kavantix Kavantix commented Feb 5, 2020

Description

Added the slideTransition for the parallax effect when a route was pushed as fullscreenDialog.

Related Issues

Fixes #20073

Tests

Added test that check that the parallax effect is working and is not used if a fullscreen routes is push over.

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 read the Tree Hygiene wiki page, which explains my responsibilities.
  • [ 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

Did any tests fail when you ran them? Please read Handling breaking changes.

  • [x ] No, no existing tests failed, so this is not a breaking change.

@fluttergithubbot fluttergithubbot added f: cupertino flutter/packages/flutter/cupertino repository framework flutter/packages/flutter repository. See also f: labels. labels Feb 5, 2020
@Kavantix Kavantix requested a review from xster February 5, 2020 11:29
//
// In the middle of a back gesture drag, let the transition be linear to
// match finger motions.
linearTransition: isPopGestureInProgress(route),
Copy link
Member

Choose a reason for hiding this comment

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

I suspect this might not be needed. Can you find a native example in iOS where a fullscreen modal page is back swipable?

Copy link
Contributor Author

@Kavantix Kavantix Mar 11, 2020

Choose a reason for hiding this comment

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

Indeed the primaryanimation does not use this, however, the secondary animation does still need it

Copy link
Member

Choose a reason for hiding this comment

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

ah you're right, thanks

@@ -424,27 +431,47 @@ class CupertinoFullscreenDialogTransition extends StatelessWidget {
/// Creates an iOS-style transition used for summoning fullscreen dialogs.
CupertinoFullscreenDialogTransition({
Key key,
@required Animation<double> animation,
Copy link
Member

Choose a reason for hiding this comment

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

we're renaming an existing public API but I'm surprised this didn't break any tests 😅
given our latest breaking change policy, it means this one's good to go https://flutter.dev/docs/resources/compatibility

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah this part of flutter isnt very well tested to be honest

@@ -502,6 +502,165 @@ void main() {
expect(tester.getTopLeft(find.byType(Placeholder)).dy, closeTo(600.0, 0.1));
});

testWidgets('Bottom route has parallax when non fullscreen route is pushed on top', (WidgetTester tester) async {
Copy link
Member

Choose a reason for hiding this comment

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

fullscreen dialog route has parallax exit animation when non fullscreen route is pushed on top

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This test is not targeting full screen specifically, also its not only the exit animation that has parallax
So maybe: CupertinoPageRoute has parallax animation when non fullscreenDialog route is pushed on top

CupertinoButton(
child: const Text('Button'),
onPressed: () {
Navigator.push<void>(context, CupertinoPageRoute<void>(
Copy link
Member

Choose a reason for hiding this comment

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

you're not testing the new functionality on CupertinoFullscreenDialogTransition you created right? That would involve 2 routes with the bottom one having fullscreenDialog true

Copy link
Contributor Author

@Kavantix Kavantix Mar 11, 2020

Choose a reason for hiding this comment

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

You’re correct, it seems I forgot to also test that explicitely.
This test is still needed though since it was missing.
Is it considered bad or good practice to move the body of this test into a function that gets an argument? (Whether the bottomroute should be fullscreenDialog)

Copy link
Member

Choose a reason for hiding this comment

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

having helper functions is ok

//
// In the middle of a back gesture drag, let the transition be linear to
// match finger motions.
linearTransition: isPopGestureInProgress(route),
Copy link
Contributor Author

@Kavantix Kavantix Mar 11, 2020

Choose a reason for hiding this comment

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

Indeed the primaryanimation does not use this, however, the secondary animation does still need it

@@ -424,27 +431,47 @@ class CupertinoFullscreenDialogTransition extends StatelessWidget {
/// Creates an iOS-style transition used for summoning fullscreen dialogs.
CupertinoFullscreenDialogTransition({
Key key,
@required Animation<double> animation,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah this part of flutter isnt very well tested to be honest

@@ -502,6 +502,165 @@ void main() {
expect(tester.getTopLeft(find.byType(Placeholder)).dy, closeTo(600.0, 0.1));
});

testWidgets('Bottom route has parallax when non fullscreen route is pushed on top', (WidgetTester tester) async {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This test is not targeting full screen specifically, also its not only the exit animation that has parallax
So maybe: CupertinoPageRoute has parallax animation when non fullscreenDialog route is pushed on top

packages/flutter/test/cupertino/route_test.dart Outdated Show resolved Hide resolved
CupertinoButton(
child: const Text('Button'),
onPressed: () {
Navigator.push<void>(context, CupertinoPageRoute<void>(
Copy link
Contributor Author

@Kavantix Kavantix Mar 11, 2020

Choose a reason for hiding this comment

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

You’re correct, it seems I forgot to also test that explicitely.
This test is still needed though since it was missing.
Is it considered bad or good practice to move the body of this test into a function that gets an argument? (Whether the bottomroute should be fullscreenDialog)

@Kavantix Kavantix force-pushed the cupertino-fullscreen-transition-parallax branch from 58ce152 to af12d72 Compare March 17, 2020 06:09
@Kavantix Kavantix force-pushed the cupertino-fullscreen-transition-parallax branch from af12d72 to e78fc94 Compare March 17, 2020 06:10
@Kavantix
Copy link
Contributor Author

@xster I updated the names of the test, added that both fullscreen dialog and non fullscreen dialog cases are tested and updated the comments such that they reflect which animations are affected by the linearTransition boolean.
Turns out that the comment on CupertinoPageTransition said that only the primary animation would be affected but that was not true so also updated that one.

@Piinks Piinks added the a: fidelity Matching the OEM platforms better label Mar 18, 2020
@Kavantix Kavantix force-pushed the cupertino-fullscreen-transition-parallax branch from 2684065 to 1935c40 Compare March 23, 2020 15:02
Copy link
Member

@xster xster left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for your patience!

@fluttergithubbot fluttergithubbot merged commit 6c9071d into flutter:master Mar 28, 2020
iOS Platform - Cupertino widget review automation moved this from Awaiting triage to Engineer reviewed Mar 28, 2020
@jamesderlin
Copy link
Contributor

Someone complained about the breakage: https://stackoverflow.com/questions/61075440/after-latest-flutter-upgrade-project-is-not-building

While I understand that this isn't strictly considered breaking according to the breaking change policy, in this case it's clearly from a complete lack of testing. A @required named parameter was changed; anyone using CupertinoFullscreenDialogTransition cannot avoid being broken. This should fall under:

In cases where we can imagine reasonable scenarios where developers would be affected negatively, by courtesy, once the change has landed, engineers are encouraged to announce the changes by sending an e-mail to flutter-announce and listing it on our Changelog wiki page (such that they will be included in our release notes)

@xster
Copy link
Member

xster commented Apr 7, 2020

It looks like we broke the extended_images pub package https://github.com/fluttercandies/extended_image/blob/f65ce8f5dd37b3d54d14422adf31e40a98c435f0/lib/src/gesture/extended_image_slide_page_route.dart#L331.

@Kavantix would you like to create an announcement message and send it to flutter-announce? I'll help you approve the group message. See https://github.com/flutter/website/blob/master/src/docs/release/breaking-changes/template.md for a message template.

I'll add this change to the changelog.

@Kavantix
Copy link
Contributor Author

Kavantix commented Apr 8, 2020

Sure I’ll do that.

Shouldn’t the changelog also reflect that two other required parameters where added @xster?

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 31, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a: fidelity Matching the OEM platforms better f: cupertino flutter/packages/flutter/cupertino repository framework flutter/packages/flutter repository. See also f: labels.
Projects
Development

Successfully merging this pull request may close these issues.

Cupertino fullscreenDialog breaks parallax effect
6 participants