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 an AnimationController API doc example #137975

Merged
merged 3 commits into from Nov 7, 2023

Conversation

HansMuller
Copy link
Contributor

This example shows how to use AnimationController and SlideTransition to create an animated digit like you might find on a digital clock. New digit values slide into place from below, as the old value slides upwards and out of view. Taps that occur while the controller is already animating cause the controller's AnimationController.duration to be reduced so that the visuals don't fall behind.

You can try the example here: https://dartpad.dev/?id=9553c20fe0fdb0c5447c1293e02400eb

@github-actions github-actions bot added framework flutter/packages/flutter repository. See also f: labels. a: animation Animation APIs d: api docs Issues with https://api.flutter.dev/ d: examples Sample code and demos labels Nov 7, 2023
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a nice example. Could you maybe add some more implementation comments? A novice isn't going to know what's going on here. Maybe more explanation of why a placeholder digit is needed, and around where the animation duration is updated?

@@ -208,6 +208,16 @@ enum AnimationBehavior {
/// controllers are created in [State.initState] and disposed in
/// [State.dispose], as described in the previous section.)
///
/// {@tool dartpad}
/// This example shows how to use [AnimationController] and [SlideTransition] to create an
/// animated digit like you might find on a digital clock. New digit values slide
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
/// animated digit like you might find on a digital clock. New digit values slide
/// animated digit like you might find on a mechanical digital clock. New digit values slide

Maybe? I want to say "analog digital", but that definitely isn't right. When I think of "digital clock", I think of something with a seven-segment display, and this isn't that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point. A better analog would be the circular digit counters in old pinball machine or a car's odometer. Will update the text.

Copy link
Contributor

@gspencergoog gspencergoog left a comment

Choose a reason for hiding this comment

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

32384589-a60f0e74-c078-11e7-9bc1-e5b5287aea9d

@HansMuller HansMuller merged commit 84bfe64 into flutter:master Nov 7, 2023
67 checks passed
@HansMuller HansMuller deleted the animation_controller_example branch November 7, 2023 21:33
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 8, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 8, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 8, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 8, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 8, 2023
auto-submit bot pushed a commit to flutter/packages that referenced this pull request Nov 8, 2023
flutter/flutter@5a6a322...4b4a1fe

2023-11-08 engine-flutter-autoroll@skia.org Roll Flutter Engine from 117d47aa3f88 to b0310da3254d (1 revision) (flutter/flutter#138096)
2023-11-08 15619084+vashworth@users.noreply.github.com Run a couple of iOS tests in presubmit (flutter/flutter#138089)
2023-11-08 engine-flutter-autoroll@skia.org Roll Flutter Engine from 3e3be5e33bda to 117d47aa3f88 (20 revisions) (flutter/flutter#138091)
2023-11-08 engine-flutter-autoroll@skia.org Roll Packages from be18d28 to 94c7623 (6 revisions) (flutter/flutter#138086)
2023-11-08 sokolovskyi.konstantin@gmail.com Ticker should dispatch creation and disposal events. (flutter/flutter#137844)
2023-11-08 christopherfujino@gmail.com [flutter_tools] Fix local engine preview device (flutter/flutter#138046)
2023-11-07 dnfield@google.com Revert "Add no-shuffle to reorderable_list_test.dart" (flutter/flutter#137715)
2023-11-07 greg@zulip.com Document where `Curves` curves correspond to CSS easing functions (flutter/flutter#137318)
2023-11-07 engine-flutter-autoroll@skia.org Roll Flutter Engine from f8961d203039 to 3e3be5e33bda (1 revision) (flutter/flutter#138039)
2023-11-07 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Use no-response from cocoon." (flutter/flutter#138042)
2023-11-07 godofredoc@google.com Use no-response from cocoon. (flutter/flutter#138037)
2023-11-07 engine-flutter-autoroll@skia.org Roll Flutter Engine from 1b20752e2a63 to f8961d203039 (6 revisions) (flutter/flutter#138034)
2023-11-07 hans.muller@gmail.com Added an AnimationController API doc example (flutter/flutter#137975)
2023-11-07 christopherfujino@gmail.com [flutter_tools] toolexit when using plugins with preview device (flutter/flutter#136936)
2023-11-07 engine-flutter-autoroll@skia.org Roll Flutter Engine from 38895fbd9468 to 1b20752e2a63 (1 revision) (flutter/flutter#138020)
2023-11-07 engine-flutter-autoroll@skia.org Roll Flutter Engine from a9e0f9514f78 to 38895fbd9468 (1 revision) (flutter/flutter#138016)
2023-11-07 zanderso@users.noreply.github.com Move Skia new_gallery_transition_perf on a02 from staging to prod (flutter/flutter#138013)
2023-11-07 36861262+QuncCccccc@users.noreply.github.com Adaptive `Switch` (flutter/flutter#130425)
2023-11-07 engine-flutter-autoroll@skia.org Roll Flutter Engine from e2810f07abb5 to a9e0f9514f78 (1 revision) (flutter/flutter#138005)
2023-11-07 engine-flutter-autoroll@skia.org Roll Flutter Engine from b91400976b4a to e2810f07abb5 (1 revision) (flutter/flutter#138002)
2023-11-07 dacoharkes@google.com [native assets] Tool exit on build failure (flutter/flutter#137995)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC bmparr@google.com,rmistry@google.com,stuartmorgan@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
HugoOlthof pushed a commit to moneybird/packages that referenced this pull request Dec 13, 2023
…r#5354)

flutter/flutter@5a6a322...4b4a1fe

2023-11-08 engine-flutter-autoroll@skia.org Roll Flutter Engine from 117d47aa3f88 to b0310da3254d (1 revision) (flutter/flutter#138096)
2023-11-08 15619084+vashworth@users.noreply.github.com Run a couple of iOS tests in presubmit (flutter/flutter#138089)
2023-11-08 engine-flutter-autoroll@skia.org Roll Flutter Engine from 3e3be5e33bda to 117d47aa3f88 (20 revisions) (flutter/flutter#138091)
2023-11-08 engine-flutter-autoroll@skia.org Roll Packages from be18d28 to 94c7623 (6 revisions) (flutter/flutter#138086)
2023-11-08 sokolovskyi.konstantin@gmail.com Ticker should dispatch creation and disposal events. (flutter/flutter#137844)
2023-11-08 christopherfujino@gmail.com [flutter_tools] Fix local engine preview device (flutter/flutter#138046)
2023-11-07 dnfield@google.com Revert "Add no-shuffle to reorderable_list_test.dart" (flutter/flutter#137715)
2023-11-07 greg@zulip.com Document where `Curves` curves correspond to CSS easing functions (flutter/flutter#137318)
2023-11-07 engine-flutter-autoroll@skia.org Roll Flutter Engine from f8961d203039 to 3e3be5e33bda (1 revision) (flutter/flutter#138039)
2023-11-07 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Use no-response from cocoon." (flutter/flutter#138042)
2023-11-07 godofredoc@google.com Use no-response from cocoon. (flutter/flutter#138037)
2023-11-07 engine-flutter-autoroll@skia.org Roll Flutter Engine from 1b20752e2a63 to f8961d203039 (6 revisions) (flutter/flutter#138034)
2023-11-07 hans.muller@gmail.com Added an AnimationController API doc example (flutter/flutter#137975)
2023-11-07 christopherfujino@gmail.com [flutter_tools] toolexit when using plugins with preview device (flutter/flutter#136936)
2023-11-07 engine-flutter-autoroll@skia.org Roll Flutter Engine from 38895fbd9468 to 1b20752e2a63 (1 revision) (flutter/flutter#138020)
2023-11-07 engine-flutter-autoroll@skia.org Roll Flutter Engine from a9e0f9514f78 to 38895fbd9468 (1 revision) (flutter/flutter#138016)
2023-11-07 zanderso@users.noreply.github.com Move Skia new_gallery_transition_perf on a02 from staging to prod (flutter/flutter#138013)
2023-11-07 36861262+QuncCccccc@users.noreply.github.com Adaptive `Switch` (flutter/flutter#130425)
2023-11-07 engine-flutter-autoroll@skia.org Roll Flutter Engine from e2810f07abb5 to a9e0f9514f78 (1 revision) (flutter/flutter#138005)
2023-11-07 engine-flutter-autoroll@skia.org Roll Flutter Engine from b91400976b4a to e2810f07abb5 (1 revision) (flutter/flutter#138002)
2023-11-07 dacoharkes@google.com [native assets] Tool exit on build failure (flutter/flutter#137995)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC bmparr@google.com,rmistry@google.com,stuartmorgan@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a: animation Animation APIs 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.

None yet

2 participants