Skip to content

add AnimatedScale and AnimatedRotation widgets#83428

Merged
fluttergithubbot merged 3 commits intoflutter:masterfrom
flar:add-AnimatedScale-AnimatedRotation
Jun 30, 2021
Merged

add AnimatedScale and AnimatedRotation widgets#83428
fluttergithubbot merged 3 commits intoflutter:masterfrom
flar:add-AnimatedScale-AnimatedRotation

Conversation

@flar
Copy link
Contributor

@flar flar commented May 26, 2021

The need for these 2 widgets was discovered/expressed during the implementation of #76742

This is the follow-on PR to implement these 2 simple widgets to plug a gap in the animated transitions API.

Fixes: #77081
Fixes: #65183

@flar flar requested a review from Hixie May 26, 2021 17:44
@flutter-dashboard flutter-dashboard bot added the framework flutter/packages/flutter repository. See also f: labels. label May 26, 2021
@google-cla google-cla bot added the cla: yes label May 26, 2021
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.

LGTM

Copy link
Contributor

Choose a reason for hiding this comment

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

we should probably also verify that the widget itself didn't change (i.e. that we're not rebuilding the AnimatedRotation).

also we should probably verify that the rotation is having an effect (e.g. by using the transformation matrix logic to convert a point from global coordinates to the child's coordinates).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wasn't sure how to reach in and verify that the AnimatedScale and AnimatedRotation widgets themselves (or their implicitly associated AnimatedState objects) were being rebuilt so I added the next best thing which is to ensure that the test harness State object that encloses them is not rebuilt. I also upgraded other tests in the same file to use the same mechanism.

With respect to verifying the actual rotation/scale of the child, since the tests verify that there is a FooTransition object underneath them and that said FooTransition object has been updated with the correct scale/rotation, wouldn't the testing that the transform is really being applied fall to the FooTransition widget tests?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Hixie are the new mechanisms sufficient to test your concerns?

@flar flar requested a review from Hixie June 7, 2021 21:49
@Piinks Piinks added a: animation Animation APIs c: new feature Nothing broken; request for a new capability d: api docs Issues with https://api.flutter.dev/ d: examples Sample code and demos documentation labels Jun 10, 2021
@flutter-dashboard
Copy link

This pull request executed golden file tests, but it has not been updated in a while (20+ days). Test results from Gold expire after as many days, so this pull request will need to be updated with a fresh commit in order to get results from Gold.

For more guidance, visit Writing a golden file test for package:flutter.

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@flar flar force-pushed the add-AnimatedScale-AnimatedRotation branch from a0d9596 to f437461 Compare June 30, 2021 21:36
@fluttergithubbot fluttergithubbot merged commit 6472797 into flutter:master Jun 30, 2021
@emvaized
Copy link
Contributor

emvaized commented Jul 6, 2021

@flar
It will be great to also add AnimatedOffset widget, which would be kind of an animated version of Transform.translate. Here's a quick gist to illustrate the idea:
https://gist.github.com/emvaized/9660d975a11d614eb4b37a749f380214

@flar
Copy link
Contributor Author

flar commented Jul 7, 2021

@emvaized you should file a Github issue with that GIST.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: animation Animation APIs c: new feature Nothing broken; request for a new capability d: api docs Issues with https://api.flutter.dev/ d: examples Sample code and demos framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing animated widgets for common transformations Animated Scale as implicit animation will be great to have!

6 participants