-
Notifications
You must be signed in to change notification settings - Fork 3.4k
docs: Add new 'Animating widgets' how-to guide. #283
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
Conversation
| output: web | ||
|
|
||
| - title: Animate Widgets | ||
| url: /animating-widgets/ |
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.
Probably the title and URL should match.
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.
The titles in the sidebar (left-nav) are shortened by design, to make them easier to scan. The full title ('Animating Widgets') is shown when users open the link to that page.
| available. | ||
|
|
||
| The [`flutter/animation`](https://docs.flutter.io/flutter/animation/animation-library.html) | ||
| package in the Flutter SDK provides APIs to create animation effects in user |
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.
Technically animation is a library rather than a package.
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.
changed to "library".
| time) as it runs. | ||
|
|
||
| Based on the animation object’s properties at a specific frame, Flutter | ||
| dynamically modifies your widget visual appearence, and rebuilds the widget |
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.
widget's visual appearance
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.
fixed.
| To learn more about | ||
| using the other key classes in the | ||
| [`flutter/animation`](https://docs.flutter.io/flutter/animation/animation-library.html) | ||
| package, see the [Animations in Flutter](/animations) guide. |
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.
s/package/library/
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.
fixed.
|
|
||
| To render your widget with an animation, set one or more of the widget’s | ||
| members to the animation object, then use the animation’s value to decide how | ||
| to draw your object. |
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.
draw is kind of an unusual case. It's much more common to use the animation's value to decide how to build child widgets.
| You can also specify a progression between two colors. For example: | ||
|
|
||
| ```dart | ||
| final Tween colorTween = |
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'd drop the final from all these example. Here I'd use the more specific ColorTween type.
| interpolates between the double values of -200.0 to 0.0. | ||
|
|
||
| ```dart | ||
| final Tween doubleTween = new Tween<double>(begin: -200.0, end: 0.0); |
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.
Dropping the type parameter here is dodgy. Better to keep it in.
| new ColorTween(begin: Colors.transparent, end: Colors.black54); | ||
| ``` | ||
|
|
||
| To apply a Tween to a given animation object, use the [`animate()`]() |
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.
Extra ()
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.
fixed
| Animation<int> alpha = new IntTween( | ||
| begin: 0, | ||
| end: 255) |
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 whitespace is odd. I'd just put it all on one line.
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.
fixed.
| useful for widgets that are already listening to the animation and hence | ||
| rebuilding whenever the animation changes value. | ||
| + [`animate()`](http://docs.flutter.io/flutter/animation/Animatable/animate.html) | ||
| Animates the tween based on the animation object's properties. Rather than |
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.
Inconsistent indent between these two bullets.
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.
fixed.
| height: animation.value, | ||
| width: animation.value, | ||
| child: new AssetImage( | ||
| name: 'assets/flutter_logo.png', |
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.
Why were these changed from web-based images to local images? With web-based images, readers can copy and paste the examples and they'll work. With local examples, readers have to create a project with the directory structure exactly right, and get the flutter.yaml file right, none of which is shown here. This was identified during usability testing of the original examples.
|
This PR has a dependency on flutter/flutter#1322 for improved animation code samples. |
|
@sethladd maybe you can find a new owner for this? |
|
Closing as stale. We can reopen if a new owner is found. |
Staged preview:
@abarth @HansMuller ptal.