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
Added parallax effect for cupertino fullscreenDialog #50180
Conversation
// | ||
// In the middle of a back gesture drag, let the transition be linear to | ||
// match finger motions. | ||
linearTransition: isPopGestureInProgress(route), |
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 suspect this might not be needed. Can you find a native example in iOS where a fullscreen modal page is back swipable?
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.
Indeed the primaryanimation does not use this, however, the secondary animation does still need it
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.
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, |
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.
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
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.
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 { |
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.
fullscreen dialog route has parallax exit animation when non fullscreen route is pushed on top
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.
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>( |
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.
you're not testing the new functionality on CupertinoFullscreenDialogTransition you created right? That would involve 2 routes with the bottom one having fullscreenDialog true
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.
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)
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.
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), |
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.
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, |
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.
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 { |
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.
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>( |
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.
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)
58ce152
to
af12d72
Compare
af12d72
to
e78fc94
Compare
@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 |
2684065
to
1935c40
Compare
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.
LGTM. Thanks for your patience!
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
|
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. |
Sure I’ll do that. Shouldn’t the changelog also reflect that two other required parameters where added @xster? |
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.///
).flutter analyze --flutter-repo
) does not report any problems on my PR.Breaking Change
Did any tests fail when you ran them? Please read Handling breaking changes.