Skip to content

Conversation

@TahaTesser
Copy link
Member

@TahaTesser TahaTesser commented Nov 6, 2023

This PR introduces AnimationStyle, it is used to override default animation curves and durations in several widgets.

fixes Add the ability to customize MaterialApp theme animation duration
fixes Allow customization of showMenu transition animation curves and duration

Here is an example where popup menu curve and transition duration is overriden:

          popUpAnimationStyle: AnimationStyle(
            curve: Easing.emphasizedAccelerate,
            duration: Durations.medium4,
          ),

Set AnimationStyle.noAnimation to disable animation.

    return MaterialApp(
      themeAnimationStyle: AnimationStyle.noAnimation,

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I signed the CLA.
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@github-actions github-actions bot added framework flutter/packages/flutter repository. See also f: labels. a: animation Animation APIs f: material design flutter/packages/flutter/material repository. labels Nov 6, 2023
@TahaTesser

This comment was marked as resolved.

@HansMuller

This comment was marked as resolved.

@TahaTesser

This comment was marked as resolved.

@TahaTesser TahaTesser changed the title [WIP]: Animation Overrides [WIP]: Introduce AnimationOverride Nov 8, 2023
@github-actions github-actions bot added d: api docs Issues with https://api.flutter.dev/ d: examples Sample code and demos labels Nov 8, 2023
@TahaTesser
Copy link
Member Author

TahaTesser commented Nov 8, 2023

@hans
Updated the animation override class and provide it to PopupMenuButton and MaterialApp widgets to start.

I think just animationOverride is enough for the PopupMenuButton, instead of open and close animation override. It seems to be reverse the same animation.

I also included an example

Screen.Recording.2023-11-08.at.15.54.37.mov

I can see some widgets see have duration and some widgets with route have transitionDuration and reverseTransitionDuration (like modal bottom sheet)

Do we add transitionDuration and reverseTransitionDuration properties to the class or just duration or reverseDuration is enough to override such properties?

@HansMuller
Copy link
Contributor

I think just having duration and reverseDuration is enough. Adding a transitionDuration parameter would make the AnimationOverrides class a little confusing.

Copy link
Contributor

Choose a reason for hiding this comment

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

A request that comes up now and then is for a way to prevent an animation from happening at all. Perhaps we should provide a constant like AnimationOverride.noAnimation that has the durations set to zero. This feature would be useful to include here, since that's sometimes what developers want to do to the theme animation.

Copy link
Member Author

Choose a reason for hiding this comment

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

Great idea!

@TahaTesser
Copy link
Member Author

@HansMuller appreciate the review!

@TahaTesser TahaTesser changed the title [WIP]: Introduce AnimationOverride Introduce AnimationOverride Nov 10, 2023
@TahaTesser TahaTesser marked this pull request as ready for review November 10, 2023 16:00
@TahaTesser
Copy link
Member Author

Added the suggestions and updated PR description

@flutter-dashboard
Copy link

Golden file changes have been found for this pull request. Click here to view and triage (e.g. because this is an intentional change).

If you are still iterating on this change and are not ready to resolve the images on the Flutter Gold dashboard, consider marking this PR as a draft pull request above. You will still be able to view image results on the dashboard, commenting will be silenced, and the check will not try to resolve itself until marked ready for review.

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.

Changes reported for pull request #137945 at sha f13e53449485c7e23b088372b763a3dff7cf2024

@flutter-dashboard flutter-dashboard bot added the will affect goldens Changes to golden files label Nov 10, 2023
@TahaTesser
Copy link
Member Author

Some unexpected and unrelated widget goldens are detected for some reason. cc: @Piinks

@HansMuller
Copy link
Contributor

We already have TextStyle, MenuStyle, ButtonStyle, all classes that are just bundles of properties that modify the appearance of a class. Maybe we should call this class AnimationStyle instead of AnimationOverrides.

@TahaTesser
Copy link
Member Author

Resolved conflict from another PR just landed today and rename class to AnimationStyle

@TahaTesser TahaTesser force-pushed the animation_overrides branch 2 times, most recently from 3b6d3a3 to 7113dab Compare November 15, 2023 21:37
Copy link
Contributor

@HansMuller HansMuller left a comment

Choose a reason for hiding this comment

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

LGTM

@HansMuller HansMuller added the autosubmit Merge PR when tree becomes green via auto submit App label Nov 16, 2023
@auto-submit auto-submit bot merged commit 19e284f into flutter:master Nov 16, 2023
@TahaTesser TahaTesser deleted the animation_overrides branch November 17, 2023 14:53
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 17, 2023
@HansMuller HansMuller added the revert Autorevert PR (with "Reason for revert:" comment) label Nov 17, 2023
@auto-submit auto-submit bot mentioned this pull request Nov 17, 2023
8 tasks
@auto-submit auto-submit bot removed the revert Autorevert PR (with "Reason for revert:" comment) label Nov 17, 2023
auto-submit bot pushed a commit that referenced this pull request Nov 17, 2023
@HansMuller
Copy link
Contributor

HansMuller commented Nov 17, 2023

@TahaTesser - I had to revert this (#138628) due to an internal name collision.

When we reland this, we should include copyWith, hashCode methods, and the changes from #138619

auto-submit bot added a commit that referenced this pull request Nov 17, 2023
Reverts #137945
Initiated by: HansMuller
This change reverts the following previous change:
Original Description:
This PR introduces `AnimationStyle`, it is used to override default animation curves and durations in several widgets.

fixes  [Add the ability to customize MaterialApp theme animation duration](#78372)
fixes [Allow customization of showMenu transition animation curves and duration](#135638)

Here is an example where popup menu curve and transition duration is overriden:

```dart
          popUpAnimationStyle: AnimationStyle(
            curve: Easing.emphasizedAccelerate,
            duration: Durations.medium4,
          ),
```

Set `AnimationStyle.noAnimation` to disable animation.
```dart
    return MaterialApp(
      themeAnimationStyle: AnimationStyle.noAnimation,
```
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 17, 2023
@TahaTesser

This comment was marked as resolved.

engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 17, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 18, 2023
auto-submit bot pushed a commit to flutter/packages that referenced this pull request Nov 18, 2023
flutter/flutter@53a57ad...6cf9ab0

2023-11-18 [email protected] Roll Flutter Engine from 53c4fde7732b to d7af5fb60b4c (2 revisions) (flutter/flutter#138668)
2023-11-18 [email protected] Update release.yml (flutter/flutter#138561)
2023-11-18 [email protected] Roll Flutter Engine from 384f75061257 to 53c4fde7732b (2 revisions) (flutter/flutter#138660)
2023-11-18 [email protected] Roll Flutter Engine from 5f40c9f49f88 to 384f75061257 (2 revisions) (flutter/flutter#138658)
2023-11-18 [email protected] Roll Flutter Engine from 66f764a16610 to 5f40c9f49f88 (1 revision) (flutter/flutter#138655)
2023-11-18 [email protected] Roll Flutter Engine from 1d2ee544c5e5 to 66f764a16610 (1 revision) (flutter/flutter#138652)
2023-11-18 [email protected] Roll Flutter Engine from c38272b5e036 to 1d2ee544c5e5 (3 revisions) (flutter/flutter#138650)
2023-11-17 [email protected] Roll Flutter Engine from e010f17eeb10 to c38272b5e036 (4 revisions) (flutter/flutter#138647)
2023-11-17 [email protected] Update links and surrounding text for new `main-api` docs (flutter/flutter#138602)
2023-11-17 [email protected] Roll Flutter Engine from 141a01c5c70b to e010f17eeb10 (2 revisions) (flutter/flutter#138643)
2023-11-17 [email protected] Roll Flutter Engine from 90c3ada3682c to 141a01c5c70b (16 revisions) (flutter/flutter#138637)
2023-11-17 [email protected] Roll Flutter Engine from 5064aeff00de to 90c3ada3682c (9 revisions) (flutter/flutter#138599)
2023-11-17 [email protected] Fix NoSplash not being disposed (flutter/flutter#138542)
2023-11-17 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Introduce `AnimationStyle`" (flutter/flutter#138628)
2023-11-17 [email protected] Enable `flutter screenshot` outside Flutter project directory (flutter/flutter#138160)
2023-11-17 [email protected] Roll Flutter Engine from aae07e989b0a to 5064aeff00de (2 revisions) (flutter/flutter#138585)
2023-11-16 [email protected] Improves output file path logic in Android analyze (flutter/flutter#136981)
2023-11-16 [email protected] Turn off leak tracker in master to make found leaks not blocking. (flutter/flutter#138567)
2023-11-16 [email protected] Roll Flutter Engine from 094a3383a406 to aae07e989b0a (2 revisions) (flutter/flutter#138574)
2023-11-16 [email protected] Enable the silent flag for invalid string exceptions when building a TextSpan (flutter/flutter#138564)
2023-11-16 [email protected] Roll Flutter Engine from 22baa83db63b to 094a3383a406 (13 revisions) (flutter/flutter#138568)
2023-11-16 [email protected] #60704: Pass cert for TLS localhost connection (flutter/flutter#106635)
2023-11-16 [email protected] Bump cupertino_icons to 1.0.6 (flutter/flutter#136962)
2023-11-16 [email protected] Fix sliver persistent header expand animation (flutter/flutter#137913)
2023-11-16 [email protected] Reduce animations further when --no-cli-animations is set. (flutter/flutter#133598)
2023-11-16 [email protected] Roll Flutter Engine from 0c57a50810e8 to 22baa83db63b (4 revisions) (flutter/flutter#138560)
2023-11-16 [email protected] Introduce `AnimationStyle` (flutter/flutter#137945)
2023-11-16 [email protected] Just use string interpolation for ws url for tests (flutter/flutter#138235)
2023-11-16 [email protected] Adding new packages to the first-party package issue template (flutter/flutter#138540)
2023-11-16 [email protected] Roll Packages from 0cd2378 to 07b4b29 (3 revisions) (flutter/flutter#138549)
2023-11-16 [email protected] Roll Flutter Engine from 2e9f0df868b3 to 0c57a50810e8 (1 revision) (flutter/flutter#138546)

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 [email protected],[email protected],[email protected] 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 autosubmit Merge PR when tree becomes green via auto submit App d: api docs Issues with https://api.flutter.dev/ d: examples Sample code and demos f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels. will affect goldens Changes to golden files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow customization of showMenu transition animation curves and duration Add the ability to customize MaterialApp theme animation duration

2 participants