Skip to content

[animations] Set FadeScaleTransitionConfiguration to configuration default value #136

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

Merged
merged 4 commits into from
Apr 23, 2020

Conversation

mono0926
Copy link
Contributor

showModal works well with configuration: const FadeScaleTransitionConfiguration() for typical use cases.

#124 made it possible to set FadeScaleTransitionConfiguration to configuration default value.
With this change, showModal can be just as easy to handle as showDialog.

@mono0926 mono0926 changed the title [animations] Set FadeScaleTransitionConfiguration to configuration default value [animations] Set FadeScaleTransitionConfiguration to configuration default value Apr 11, 2020
@goderbauer goderbauer requested a review from shihaohong April 14, 2020 20:38
Copy link

@shihaohong shihaohong left a comment

Choose a reason for hiding this comment

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

Hi, thank you for the PR! I have some comments about some of the changes, but the bigger task would be to write unit tests to ensure that the default configuration used is respected.

@@ -45,7 +47,7 @@ typedef _ModalTransitionBuilder = Widget Function(
/// the modal's characteristics.

Choose a reason for hiding this comment

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

Specify in the API documentation for showModal that FadeScaleTransitionConfiguration will be used by default if it not specified.

Choose a reason for hiding this comment

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

You need to add new tests to packages/animations/test/modal.dart ensuring that configuration is FadeScaleTransitionConfiguration by default.

What I would do is call showModal without specifying a configuration, but making sure that the animations forwards and reverse are the ones for FadeScaleTransitionConfiguration. Another thing that would be good to test here is that the barrier properties for FadeScaleTransitionConfiguration are used as well.

You can use some of the existing tests in that test file and the tests from packages/animations/test/fade_scale_transition_test.dart to guide you.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, I've added the tests: b158029

@@ -21,7 +20,6 @@ void main() {
onPressed: () {
showModal<void>(
context: context,
configuration: const FadeScaleTransitionConfiguration(),

Choose a reason for hiding this comment

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

I would not take this line out of the test, since we still want to explicitly test that when FadeScaleTransitionConfiguration is used, we have the expected behavior. For example, if the default configuration for showModal were to ever change, this test would break

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay, I'll revert this 👍

@@ -53,7 +51,6 @@ void main() {
onPressed: () {
showModal<void>(
context: context,
configuration: const FadeScaleTransitionConfiguration(),

Choose a reason for hiding this comment

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

Ditto

@@ -121,7 +118,6 @@ void main() {
onPressed: () {
showModal<void>(
context: context,
configuration: const FadeScaleTransitionConfiguration(),

Choose a reason for hiding this comment

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

Ditto

@@ -186,7 +182,6 @@ void main() {
onPressed: () {
showModal<void>(
context: context,
configuration: const FadeScaleTransitionConfiguration(),

Choose a reason for hiding this comment

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

Ditto

@@ -287,8 +282,6 @@ void main() {
onPressed: () {
showModal<void>(
context: context,
configuration:

Choose a reason for hiding this comment

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

Ditto

@@ -67,7 +67,6 @@ class _FadeScaleTransitionDemoState extends State<FadeScaleTransitionDemo>
onPressed: () {
showModal<void>(
context: context,
configuration: const FadeScaleTransitionConfiguration(),

Choose a reason for hiding this comment

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

I think we can just leave this here, but it's up to you if this becomes the default behavior

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, I think the sample code should be simple, so omitting default value is better 🤔

@mono0926 mono0926 force-pushed the show-modal-configuration-default branch from b0b5d92 to a9430dc Compare April 15, 2020 04:38
@mono0926 mono0926 force-pushed the show-modal-configuration-default branch from a9430dc to b158029 Compare April 15, 2020 04:39
@mono0926 mono0926 requested a review from shihaohong April 15, 2020 04:42
@mono0926
Copy link
Contributor Author

@shihaohong

Thanks for the polite review. I've reflected the points you've made, so please review it again 🙏

Copy link

@shihaohong shihaohong left a comment

Choose a reason for hiding this comment

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

Sorry for the delay in my code review, I've been busy with some other work lately and had not had the chance to look at the animations library PRs.

The changes look good! Just a small nit on the API documentation :)

@@ -27,6 +29,7 @@ typedef _ModalTransitionBuilder = Widget Function(
/// modal route that will be displayed, such as the enter and exit
/// transitions, the duration of the transitions, and modal barrier
/// properties.
/// By default, `configuration` is [FadeScaleTransitionConfiguration].

Choose a reason for hiding this comment

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

We usually specify the default at the end of the API doc. Could you shift this to be the last line? Thank you!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@shihaohong

Thanks for the review again 🙏

But, I don't understand what change is desired 🤔

I think current default position is same as like this:

image

/// A configuration object containing the properties needed to implement a
/// modal route.
///
/// The `barrierDismissible` argument is used to determine whether this route
/// can be dismissed by tapping the modal barrier. This argument defaults
/// to true. If `barrierDismissible` is true, a non-null `barrierLabel` must be
/// provided.
///
/// The `barrierLabel` argument is the semantic label used for a dismissible
/// barrier. This argument defaults to "Dismiss".
abstract class ModalConfiguration {


Could you suggest the change by using multi-line code suggestions?

@mono0926 mono0926 force-pushed the show-modal-configuration-default branch 2 times, most recently from 27f7511 to 41ae76a Compare April 23, 2020 05:43
@mono0926 mono0926 force-pushed the show-modal-configuration-default branch from 41ae76a to 0bd1dcf Compare April 23, 2020 05:46
@mono0926
Copy link
Contributor Author

@shihaohong

Thanks for the suggestion 🙏
I reflect it: 0bd1dcf

Copy link

@shihaohong shihaohong left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you for working on this!

@shihaohong shihaohong merged commit bf3f380 into flutter:master Apr 23, 2020
stuartmorgan-g pushed a commit to stuartmorgan-g/packages that referenced this pull request Apr 30, 2021
stuartmorgan-g pushed a commit that referenced this pull request Oct 31, 2024
* Transform clip path when applied to a group

Fix #136, #343, #566

* Golden test added
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants