-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Style: Rename CupertinoSwitch activeColor and trackColor to activeTrackColor and InactiveTrackColor #151367
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
Style: Rename CupertinoSwitch activeColor and trackColor to activeTrackColor and InactiveTrackColor #151367
Conversation
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.
Thanks for this PR! Renaming parameters would be a breaking change for many users, so we typically have a different process for these types of changes. This process involves deprecating these parameters (the old names), adding new parameters (the new names), and adding a flutter fix to automate the migration for users.
See the breaking change policy and adding Data Driven Fixes for more information.
|
@victorsanni Sure I will do respective changes and push. |
20e2acd to
673716a
Compare
f04e07e to
f02800b
Compare
|
@victorsanni & @Piinks I have done required changes as per my understanding. |
Piinks
left a comment
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.
Hey @rkishan516 thanks for contributing! This is a good example of how we implement a deprecation like this while maintaining backwards compatibility, by making the original field a getter:
| TextStyle? get headline3 => displaySmall; |
69077dd to
751dc04
Compare
|
@MitchellGoodwin & @Piinks Thanks for review, I have updated code. |
| this.trackColor, | ||
| @Deprecated( | ||
| 'Use activeTrackColor instead. ' | ||
| 'This feature was deprecated after v3.24.0-0.0.pre.' |
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.
Note to self/ other reviewers: check that this is still the up to date message before merging
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.
Because I often forget where to check for this: https://github.com/flutter/flutter/tags
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.
Can you check and update this version number in the deprecation messages? I think we are really close now.
justinmc
left a comment
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 think it makes sense to change to these names 👍 . There doesn't seem to be a clear standard to follow here from Material. I checked the Material 3 Switch spec and it seems to not give names for these kinds of things. Other implementations like in Jetpack Compose, Android, and Material web seem to all use their own names.
So we should probably pick something and stick with it everywhere, and activeTrackColor and inactiveTrackColor sound good to me.
MitchellGoodwin
left a comment
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.
Thank you for the update. This is getting close. A couple more comments.
12c8f22 to
b3146f7
Compare
justinmc
left a comment
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.
Just some small things to look at here, thanks for cleaning up this API.
| this.trackColor, | ||
| @Deprecated( | ||
| 'Use activeTrackColor instead. ' | ||
| 'This feature was deprecated after v3.24.0-0.0.pre.' |
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.
Because I often forget where to check for this: https://github.com/flutter/flutter/tags
| /// | ||
| /// See also: | ||
| /// | ||
| /// * [trackColor], the color to use for the track when the switch is off. |
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.
Should this see also point to activeTrackColor?
| /// | ||
| /// See also: | ||
| /// | ||
| /// * [activeTrackColor], the color to use for the track when the switch is on. |
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 see also is pointing to itself. :)
| this.trackColor, | ||
| @Deprecated( | ||
| 'Use activeTrackColor instead. ' | ||
| 'This feature was deprecated after v3.24.0-0.0.pre.' |
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.
Can you check and update this version number in the deprecation messages? I think we are really close now.
| expect(tester.takeException(), isNull); | ||
| }); | ||
|
|
||
| testWidgets('Switch is using inactive track color when set', (WidgetTester tester) async { |
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.
| testWidgets('Switch is using inactive track color when set', (WidgetTester tester) async { | |
| testWidgets('Switch uses inactive track color when set', (WidgetTester tester) async { |
| expect(find.byType(CupertinoSwitch), paints..rrect(color: inactiveTrackColor)); | ||
| }); | ||
|
|
||
| testWidgets('Switch is using active track color when set', (WidgetTester tester) async { |
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.
| testWidgets('Switch is using active track color when set', (WidgetTester tester) async { | |
| testWidgets('Switch uses active track color when set', (WidgetTester tester) async { |
2f89307 to
5b6d849
Compare
MitchellGoodwin
left a comment
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.
LGTM! Thank you for putting up with our feedback.
| this.trackColor, | ||
| @Deprecated( | ||
| 'Use activeTrackColor instead. ' | ||
| 'This feature was deprecated after v3.24.0-0.1.pre.' |
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.
Looks like the version went up again https://github.com/flutter/flutter/tags
b743bde to
2cd111c
Compare
…ackColor and inactiveTrackColor
2cd111c to
0a1b946
Compare
justinmc
left a comment
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.
LGTM 👍
| }); | ||
|
|
||
| testWidgets('Switch uses inactive track color when set', (WidgetTester tester) async { | ||
| const Color inactiveTrackColor = Color(0xFF00FF00); |
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.
Nit: The contents of both tests should probably be outdented.
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.
Ah good catch. I think it's ok to land this, we can tidy it up after. The tag on the deprecation is time sensitive.
…ckColor and InactiveTrackColor (flutter#151367) Style: Rename CupertinoSwitch `activeColor` and `trackColor` to `activeTrackColor` and `InactiveTrackColor` Resolves flutter#151256
…ctiveTrackColor and InactiveTrackColor (flutter/flutter#151367)
…ctiveTrackColor and InactiveTrackColor (flutter/flutter#151367)
…ctiveTrackColor and InactiveTrackColor (flutter/flutter#151367)
…ctiveTrackColor and InactiveTrackColor (flutter/flutter#151367)
…ctiveTrackColor and InactiveTrackColor (flutter/flutter#151367)
Manual roll requested by [email protected] flutter/flutter@d595e98...b6cd31e 2024-08-08 [email protected] Add a contribution doc on using reliable links in tooling (flutter/flutter#150962) 2024-08-08 [email protected] Roll Flutter Engine from 94cf8c8fad31 to 3978ddd8d7a7 (1 revision) (flutter/flutter#153086) 2024-08-08 [email protected] Roll Flutter Engine from 9dd4a2303898 to 94cf8c8fad31 (2 revisions) (flutter/flutter#153073) 2024-08-08 [email protected] Roll Flutter Engine from 9932f34aac4e to 9dd4a2303898 (1 revision) (flutter/flutter#153067) 2024-08-08 [email protected] Add drawer and navigation drawer in a11y assessment app, also run `dart format` under a11y_assessments/ (flutter/flutter#153034) 2024-08-07 [email protected] Roll Flutter Engine from d4d9537bccdf to 9932f34aac4e (1 revision) (flutter/flutter#153063) 2024-08-07 [email protected] Clean up MenuAnchor (flutter/flutter#152946) 2024-08-07 [email protected] Set default Cupertino `primaryContrastingColor` to white (flutter/flutter#153039) 2024-08-07 [email protected] Roll Flutter Engine from 317eb6107646 to d4d9537bccdf (2 revisions) (flutter/flutter#153058) 2024-08-07 [email protected] Allow dropdown_menu to accept any EdgeInsetsGeometry (flutter/flutter#153053) 2024-08-07 [email protected] Add xcresulttool --legacy flag for deprecated usage (flutter/flutter#152988) 2024-08-07 [email protected] Revert "Marks Mac channels_integration_test to be flaky" (flutter/flutter#153044) 2024-08-07 [email protected] Roll Flutter Engine from 69c29fb309bb to 317eb6107646 (2 revisions) (flutter/flutter#153048) 2024-08-07 [email protected] Marks Linux android_java17_dependency_smoke_tests to be unflaky (flutter/flutter#153011) 2024-08-07 [email protected] Marks Linux android_java11_dependency_smoke_tests to be unflaky (flutter/flutter#153010) 2024-08-07 [email protected] [web] hide the --web-renderer option in the tool (flutter/flutter#152683) 2024-08-07 [email protected] Doc imports again (flutter/flutter#152958) 2024-08-07 [email protected] Roll Flutter Engine from 5a0fd5fbecc6 to 69c29fb309bb (6 revisions) (flutter/flutter#153035) 2024-08-07 [email protected] Roll Packages from 551bde5 to 5cc0a01 (12 revisions) (flutter/flutter#153040) 2024-08-07 [email protected] MenuAnchor hover traversal fixes (flutter/flutter#150914) 2024-08-07 [email protected] Style: Rename CupertinoSwitch activeColor and trackColor to activeTrackColor and InactiveTrackColor (flutter/flutter#151367) 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
…ckColor and InactiveTrackColor (flutter#151367) Style: Rename CupertinoSwitch `activeColor` and `trackColor` to `activeTrackColor` and `InactiveTrackColor` Resolves flutter#151256
…ckColor and InactiveTrackColor (flutter#151367) Style: Rename CupertinoSwitch `activeColor` and `trackColor` to `activeTrackColor` and `InactiveTrackColor` Resolves flutter#151256
…ctiveTrackColor and InactiveTrackColor (flutter/flutter#151367)
…ctiveTrackColor and InactiveTrackColor (flutter/flutter#151367)
Style: Rename CupertinoSwitch
activeColorandtrackColortoactiveTrackColorandInactiveTrackColorResolves #151256
Pre-launch Checklist
///).