Skip to content

Support custom transition duration for DialogRoute, CupertinoDialogRoute and show dialog methods. - #154048

Merged
auto-submit[bot] merged 14 commits into
flutter:masterfrom
nploi:master
Sep 6, 2024
Merged

auto-submit[bot] merged 14 commits into
flutter:masterfrom
nploi:master

Conversation

@nploi

@nploi nploi commented Aug 24, 2024 •

Copy link
Copy Markdown
Contributor

Currently we don't support custom transition duration for DialogRoute, CupertinoDialogRoute and show dialog methods , This PR will to support that.

Pre-launch Checklist

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

@flutter-dashboard

Copy link
Copy Markdown

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!).

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group.

@github-actions github-actions Bot added framework flutter/packages/flutter repository. See also f: labels. p: material_ui material_ui package in flutter/packages labels Aug 24, 2024

@Piinks Piinks left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hey @nploi thanks for the contribution! Can you add a test that verifies it works as expected? That will also ensure we do not undo this work in the future. Thanks!

@github-actions github-actions Bot added p: cupertino_ui cupertino_ui package in flutter/packages f: routes Navigator, Router, and related APIs. labels Aug 31, 2024
@nploi nploi changed the title Support custom transition duration for DialogRoute Support custom transition duration for DialogRoute, CupertinoDialogRoute and show dialogs. Aug 31, 2024
@nploi

nploi commented Aug 31, 2024

Copy link
Copy Markdown
Contributor Author

Hey @nploi thanks for the contribution! Can you add a test that verifies it works as expected? That will also ensure we do not undo this work in the future. Thanks!

Hi @Piinks, i added the tests for my changes. pls help to review. Thank you.

@nploi
nploi requested a review from Piinks August 31, 2024 05:14
@nploi nploi changed the title Support custom transition duration for DialogRoute, CupertinoDialogRoute and show dialogs. Support custom transition duration for DialogRoute, CupertinoDialogRoute and show dialog methods. Aug 31, 2024

@nate-thegrate nate-thegrate left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I left a couple of suggestions, but overall this is a fantastic improvement. Thanks!

Comment thread packages/flutter/lib/src/material/dialog.dart Outdated
Comment thread packages/flutter/test/material/dialog_test.dart Outdated
@nploi
nploi requested a review from nate-thegrate September 5, 2024 04:02

@nate-thegrate nate-thegrate left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM, thanks for making this improvement!

Comment thread packages/flutter/test/material/dialog_test.dart Outdated

@piedcipher piedcipher left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

some smol clean-up

Comment thread packages/flutter/test/material/dialog_test.dart Outdated
Comment thread packages/flutter/test/material/dialog_test.dart Outdated
Comment thread packages/flutter/test/material/dialog_test.dart Outdated
Comment thread packages/flutter/lib/src/cupertino/route.dart Outdated
Comment thread packages/flutter/lib/src/material/dialog.dart Outdated
@nploi

nploi commented Sep 5, 2024

Copy link
Copy Markdown
Contributor Author

some smol clean-up

thank for your review, i just fixed, pls help me check again 👍

@nploi
nploi requested a review from piedcipher September 5, 2024 15:44

@dkwingsmt dkwingsmt left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The changes look OK. The new argument needs documentation though.

bool barrierDismissible = false,
RouteSettings? routeSettings,
Offset? anchorPoint,
Duration? transitionDuration = _kCupertinoDialogRouteTransitionDuration,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Add a paragraph to the doc to explain the transitionDuration and its default value, such as

///
/// The `transitionDuration` argument determines the duration of the transition animation. If it's
/// not provided or null, then it uses the default value as set by [CupertinoDialogRoute].

And also, either use the default value, or use a nullable value, but not default and nullable at the same time. I suggest using a nullable value so that the default duration is determined by CupertinoDialogRoute alone, meaning changing this line to

Suggested change
Duration? transitionDuration = _kCupertinoDialogRouteTransitionDuration,
Duration? transitionDuration,

and removing the ?? in L1330.

String? barrierLabel,
// This transition duration was eyeballed comparing with iOS
super.transitionDuration = const Duration(milliseconds: 250),
super.transitionDuration = _kCupertinoDialogRouteTransitionDuration,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Add a paragraph to the doc of the constructor to explain the transitionDuration and its default value.

themes: themes,
anchorPoint: anchorPoint,
traversalEdgeBehavior: traversalEdgeBehavior ?? TraversalEdgeBehavior.closedLoop,
transitionDuration: transitionDuration ?? _kDialogRouteTransitionDuration,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

As suggested above,

Suggested change
transitionDuration: transitionDuration ?? _kDialogRouteTransitionDuration,
transitionDuration: transitionDuration,

and add to doc.

RouteSettings? routeSettings,
Offset? anchorPoint,
TraversalEdgeBehavior? traversalEdgeBehavior,
Duration? transitionDuration,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

As suggested above, add to doc.

super.requestFocus,
super.anchorPoint,
super.traversalEdgeBehavior,
super.transitionDuration = _kDialogRouteTransitionDuration,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Add to doc and explain default value.

@piedcipher piedcipher left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

can we add set of tests for testing defaults too?

@nploi

nploi commented Sep 6, 2024

Copy link
Copy Markdown
Contributor Author

Looks like Linux Analyze is reporting a few trailing whitespace characters.

fixed.

@nate-thegrate

Copy link
Copy Markdown
Contributor

@nploi thanks for addressing all the feedback!

@nate-thegrate nate-thegrate added the autosubmit Merge PR when tree becomes green via auto submit App label Sep 6, 2024
@auto-submit
auto-submit Bot merged commit 0eaeb0d into flutter:master Sep 6, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Sep 6, 2024
@TahaTesser

Copy link
Copy Markdown
Contributor

@dkwingsmt @nate-thegrate
We introduced AnimationStyle class to override animation durations and curves.

Instead of introducing new durations and curves parameters, we used this class to override transitionDuration
For instance here

Duration get transitionDuration => popUpAnimationStyle?.duration ?? _kMenuDuration;

@TahaTesser

Copy link
Copy Markdown
Contributor

Just below this newly added transitionDuration, there are hard coded animation curves. If and when there is request to add support to customize these curves, we wouldn't want to add more new parameters.

image

Instead we could use AnimationStyle to override durations as well as curve, something like TextStyle for text

image

@TahaTesser

Copy link
Copy Markdown
Contributor

I would recommend reverting this PR in favor of AnimationStyle for complete animation duration and curve customization.

@nate-thegrate nate-thegrate added the revert Autorevert PR (with "Reason for revert:" comment) label Sep 6, 2024
@auto-submit

This comment was marked as resolved.

@auto-submit auto-submit Bot removed the revert Autorevert PR (with "Reason for revert:" comment) label Sep 6, 2024
@nate-thegrate

Copy link
Copy Markdown
Contributor

Reason for revert: using AnimationStyle instead would allow for complete animation duration and curve customization.

@nate-thegrate nate-thegrate added the revert Autorevert PR (with "Reason for revert:" comment) label Sep 6, 2024
auto-submit Bot pushed a commit that referenced this pull request Sep 6, 2024
…inoDialogRoute` and show dialog methods. (#154048)"

This reverts commit 0eaeb0d.
@auto-submit auto-submit Bot removed the revert Autorevert PR (with "Reason for revert:" comment) label Sep 6, 2024
auto-submit Bot added a commit that referenced this pull request Sep 6, 2024
…tinoDialogRoute` and show dialog methods. (#154048)" (#154743)

Reverts: #154048
Initiated by: nate-thegrate
Reason for reverting: using `AnimationStyle` instead would allow for complete animation duration and curve customization.

Original PR Author: nploi

Reviewed By: {piedcipher, nate-thegrate}

This change reverts the following previous change:
Currently we don't support custom transition duration for `DialogRoute`, `CupertinoDialogRoute` and show dialog methods , This PR will to support that.
@TahaTesser

TahaTesser commented Sep 6, 2024 •

Copy link
Copy Markdown
Contributor

Since AnimationStyle is relatively new, for every widget I included a sample. We should also add sample for this change too.
Please look at an existing animation style sample for default, custom, and no animation controls. You can copy this and replace the widget using new parameter.
https://api.flutter.dev/flutter/material/PopupMenuButton-class.html#material.PopupMenuButton.4

Add the widget supporting AnimationStyle in the docs

cc: @nate-thegrate

@nate-thegrate

Copy link
Copy Markdown
Contributor

@TahaTesser thanks very much for this information!

I've created an issue to track progress on this feature: #154744

cc: @nploi

@dkwingsmt

Copy link
Copy Markdown
Contributor

Thank you very much for this information! Learning something today!

auto-submit Bot pushed a commit to flutter/packages that referenced this pull request Sep 6, 2024
flutter/flutter@45ef8f3...2e221e7

2024-09-06 [email protected] Fix DropdownMenu focused item styles (flutter/flutter#153159)
2024-09-06 [email protected] Support custom transition duration for `DialogRoute`, `CupertinoDialogRoute` and show dialog methods. (flutter/flutter#154048)
2024-09-06 [email protected] [tool] Add `dartFileName` setting for platform plugins  (flutter/flutter#153099)
2024-09-06 [email protected] [Conductor] Add ability to override mirror, add tests for default arg parsing and custom arg parsing (flutter/flutter#154363)
2024-09-06 [email protected] Improve CupertinoPopupSurface appearance (flutter/flutter#151430)
2024-09-06 [email protected] Roll Packages from 71e827e to 56df73e (1 revision) (flutter/flutter#154725)
2024-09-06 [email protected] Quick access to style guide (flutter/flutter#154689)
2024-09-06 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Roll Flutter Engine from c50eb8a65097 to 015f3b1dec53 (2 revisions) (#154691)" (flutter/flutter#154726)
2024-09-05 [email protected] Improve iOS unpack target's error messages (flutter/flutter#154649)
2024-09-05 [email protected] Made some pixel tests fuzzy (flutter/flutter#154680)
2024-09-05 [email protected] Roll Flutter Engine from c50eb8a65097 to 015f3b1dec53 (2 revisions) (flutter/flutter#154691)
2024-09-05 49699333+dependabot[bot]@users.noreply.github.com Bump peter-evans/create-pull-request from 7.0.0 to 7.0.1 (flutter/flutter#154690)
2024-09-05 [email protected] Normalize Dialog theme (flutter/flutter#153982)
2024-09-05 [email protected] iOS,macOS: Do not copy unsigned_binaries.txt to build outputs (flutter/flutter#154684)
2024-09-05 [email protected] Roll Flutter Engine from e042ff5df7af to c50eb8a65097 (1 revision) (flutter/flutter#154679)
2024-09-05 [email protected] Add proguard rule to keep the class for all implementations of FlutterPlugin (flutter/flutter#154677)
2024-09-05 [email protected] Fix DropdownMenu menu does not follow the text field (flutter/flutter#154667)
2024-09-05 [email protected] Roll Flutter Engine from a156e713f4dc to e042ff5df7af (1 revision) (flutter/flutter#154678)
2024-09-05 [email protected] Fix ZoomPageTransitionsBuilder hardcoded fill color (flutter/flutter#154057)
2024-09-05 [email protected] Roll Flutter Engine from 34b61eb53b99 to a156e713f4dc (1 revision) (flutter/flutter#154672)

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
@nate-thegrate nate-thegrate added the was reverted (optionally) marks a pull request as having been reverted after it was merged label Sep 6, 2024
@nploi

nploi commented Sep 7, 2024

Copy link
Copy Markdown
Contributor Author

@TahaTesser thanks very much for this information!

I've created an issue to track progress on this feature: #154744

cc: @nploi

Thank you @nate-thegrate @TahaTesser, i will support AnimationStyle for show dialog methods.

can you assign me this #154744 @nate-thegrate ?

engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Dec 11, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Dec 12, 2024
creatorpiyush pushed a commit to creatorpiyush/packages that referenced this pull request Jun 10, 2026
flutter/flutter@45ef8f3...2e221e7

2024-09-06 [email protected] Fix DropdownMenu focused item styles (flutter/flutter#153159)
2024-09-06 [email protected] Support custom transition duration for `DialogRoute`, `CupertinoDialogRoute` and show dialog methods. (flutter/flutter#154048)
2024-09-06 [email protected] [tool] Add `dartFileName` setting for platform plugins  (flutter/flutter#153099)
2024-09-06 [email protected] [Conductor] Add ability to override mirror, add tests for default arg parsing and custom arg parsing (flutter/flutter#154363)
2024-09-06 [email protected] Improve CupertinoPopupSurface appearance (flutter/flutter#151430)
2024-09-06 [email protected] Roll Packages from 71e827e to 56df73e (1 revision) (flutter/flutter#154725)
2024-09-06 [email protected] Quick access to style guide (flutter/flutter#154689)
2024-09-06 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Roll Flutter Engine from c50eb8a65097 to 015f3b1dec53 (2 revisions) (#154691)" (flutter/flutter#154726)
2024-09-05 [email protected] Improve iOS unpack target's error messages (flutter/flutter#154649)
2024-09-05 [email protected] Made some pixel tests fuzzy (flutter/flutter#154680)
2024-09-05 [email protected] Roll Flutter Engine from c50eb8a65097 to 015f3b1dec53 (2 revisions) (flutter/flutter#154691)
2024-09-05 49699333+dependabot[bot]@users.noreply.github.com Bump peter-evans/create-pull-request from 7.0.0 to 7.0.1 (flutter/flutter#154690)
2024-09-05 [email protected] Normalize Dialog theme (flutter/flutter#153982)
2024-09-05 [email protected] iOS,macOS: Do not copy unsigned_binaries.txt to build outputs (flutter/flutter#154684)
2024-09-05 [email protected] Roll Flutter Engine from e042ff5df7af to c50eb8a65097 (1 revision) (flutter/flutter#154679)
2024-09-05 [email protected] Add proguard rule to keep the class for all implementations of FlutterPlugin (flutter/flutter#154677)
2024-09-05 [email protected] Fix DropdownMenu menu does not follow the text field (flutter/flutter#154667)
2024-09-05 [email protected] Roll Flutter Engine from a156e713f4dc to e042ff5df7af (1 revision) (flutter/flutter#154678)
2024-09-05 [email protected] Fix ZoomPageTransitionsBuilder hardcoded fill color (flutter/flutter#154057)
2024-09-05 [email protected] Roll Flutter Engine from 34b61eb53b99 to a156e713f4dc (1 revision) (flutter/flutter#154672)

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
chunhtai pushed a commit to chunhtai/packages that referenced this pull request Jun 12, 2026
…tinoDialogRoute` and show dialog methods. (#154048)" (#154743)

Reverts: flutter/flutter#154048
Initiated by: nate-thegrate
Reason for reverting: using `AnimationStyle` instead would allow for complete animation duration and curve customization.

Original PR Author: nploi

Reviewed By: {piedcipher, nate-thegrate}

This change reverts the following previous change:
Currently we don't support custom transition duration for `DialogRoute`, `CupertinoDialogRoute` and show dialog methods , This PR will to support that.
bisor0627 pushed a commit to bisor0627/packages that referenced this pull request Jun 19, 2026
flutter/flutter@45ef8f3...2e221e7

2024-09-06 [email protected] Fix DropdownMenu focused item styles (flutter/flutter#153159)
2024-09-06 [email protected] Support custom transition duration for `DialogRoute`, `CupertinoDialogRoute` and show dialog methods. (flutter/flutter#154048)
2024-09-06 [email protected] [tool] Add `dartFileName` setting for platform plugins  (flutter/flutter#153099)
2024-09-06 [email protected] [Conductor] Add ability to override mirror, add tests for default arg parsing and custom arg parsing (flutter/flutter#154363)
2024-09-06 [email protected] Improve CupertinoPopupSurface appearance (flutter/flutter#151430)
2024-09-06 [email protected] Roll Packages from 64aff14 to 5e19df0 (1 revision) (flutter/flutter#154725)
2024-09-06 [email protected] Quick access to style guide (flutter/flutter#154689)
2024-09-06 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Roll Flutter Engine from c50eb8a65097 to 015f3b1dec53 (2 revisions) (#154691)" (flutter/flutter#154726)
2024-09-05 [email protected] Improve iOS unpack target's error messages (flutter/flutter#154649)
2024-09-05 [email protected] Made some pixel tests fuzzy (flutter/flutter#154680)
2024-09-05 [email protected] Roll Flutter Engine from c50eb8a65097 to 015f3b1dec53 (2 revisions) (flutter/flutter#154691)
2024-09-05 49699333+dependabot[bot]@users.noreply.github.com Bump peter-evans/create-pull-request from 7.0.0 to 7.0.1 (flutter/flutter#154690)
2024-09-05 [email protected] Normalize Dialog theme (flutter/flutter#153982)
2024-09-05 [email protected] iOS,macOS: Do not copy unsigned_binaries.txt to build outputs (flutter/flutter#154684)
2024-09-05 [email protected] Roll Flutter Engine from e042ff5df7af to c50eb8a65097 (1 revision) (flutter/flutter#154679)
2024-09-05 [email protected] Add proguard rule to keep the class for all implementations of FlutterPlugin (flutter/flutter#154677)
2024-09-05 [email protected] Fix DropdownMenu menu does not follow the text field (flutter/flutter#154667)
2024-09-05 [email protected] Roll Flutter Engine from a156e713f4dc to e042ff5df7af (1 revision) (flutter/flutter#154678)
2024-09-05 [email protected] Fix ZoomPageTransitionsBuilder hardcoded fill color (flutter/flutter#154057)
2024-09-05 [email protected] Roll Flutter Engine from 34b61eb53b99 to a156e713f4dc (1 revision) (flutter/flutter#154672)

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autosubmit Merge PR when tree becomes green via auto submit App f: routes Navigator, Router, and related APIs. framework flutter/packages/flutter repository. See also f: labels. p: cupertino_ui cupertino_ui package in flutter/packages p: material_ui material_ui package in flutter/packages was reverted (optionally) marks a pull request as having been reverted after it was merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants