Skip to content

Conversation

@rkishan516
Copy link
Contributor

Style: Rename CupertinoSwitch activeColor and trackColor to activeTrackColor and InactiveTrackColor

Resolves #151256

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].
  • I followed the [breaking change policy] and added [Data Driven Fixes] where supported.
  • All existing and new tests are passing.

@github-actions github-actions bot added framework flutter/packages/flutter repository. See also f: labels. f: cupertino flutter/packages/flutter/cupertino repository d: api docs Issues with https://api.flutter.dev/ d: examples Sample code and demos labels Jul 6, 2024
@Piinks Piinks requested review from Piinks and victorsanni July 11, 2024 18:21
Copy link
Contributor

@victorsanni victorsanni left a 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.

@rkishan516
Copy link
Contributor Author

@victorsanni Sure I will do respective changes and push.

@rkishan516 rkishan516 force-pushed the rename-cupertino-switch-properties branch from 20e2acd to 673716a Compare July 12, 2024 03:25
@github-actions github-actions bot added the c: tech-debt Technical debt, code quality, testing, etc. label Jul 15, 2024
@rkishan516 rkishan516 force-pushed the rename-cupertino-switch-properties branch from f04e07e to f02800b Compare July 15, 2024 15:47
@rkishan516
Copy link
Contributor Author

@victorsanni & @Piinks I have done required changes as per my understanding.

Copy link
Contributor

@Piinks Piinks left a 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;

@rkishan516 rkishan516 force-pushed the rename-cupertino-switch-properties branch 2 times, most recently from 69077dd to 751dc04 Compare July 16, 2024 01:27
@rkishan516
Copy link
Contributor Author

rkishan516 commented Jul 16, 2024

@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.'
Copy link
Contributor

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

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.

Copy link
Contributor

@justinmc justinmc left a 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.

Copy link
Contributor

@MitchellGoodwin MitchellGoodwin left a 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.

@rkishan516 rkishan516 force-pushed the rename-cupertino-switch-properties branch 6 times, most recently from 12c8f22 to b3146f7 Compare July 17, 2024 15:04
Copy link
Contributor

@justinmc justinmc left a 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.'
Copy link
Contributor

Choose a reason for hiding this comment

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

///
/// See also:
///
/// * [trackColor], the color to use for the track when the switch is off.
Copy link
Contributor

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.
Copy link
Contributor

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.'
Copy link
Contributor

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 {
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
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 {
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
testWidgets('Switch is using active track color when set', (WidgetTester tester) async {
testWidgets('Switch uses active track color when set', (WidgetTester tester) async {

@rkishan516 rkishan516 force-pushed the rename-cupertino-switch-properties branch from 2f89307 to 5b6d849 Compare July 30, 2024 02:01
Copy link
Contributor

@MitchellGoodwin MitchellGoodwin 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 putting up with our feedback.

this.trackColor,
@Deprecated(
'Use activeTrackColor instead. '
'This feature was deprecated after v3.24.0-0.1.pre.'
Copy link
Contributor

Choose a reason for hiding this comment

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

@rkishan516 rkishan516 force-pushed the rename-cupertino-switch-properties branch from b743bde to 2cd111c Compare August 7, 2024 02:54
@rkishan516 rkishan516 force-pushed the rename-cupertino-switch-properties branch from 2cd111c to 0a1b946 Compare August 7, 2024 04:19
Copy link
Contributor

@justinmc justinmc left a 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);
Copy link
Contributor

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.

Copy link
Contributor

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.

@Piinks Piinks added the autosubmit Merge PR when tree becomes green via auto submit App label Aug 7, 2024
@auto-submit auto-submit bot merged commit 0f7bceb into flutter:master Aug 7, 2024
TytaniumDev pushed a commit to TytaniumDev/flutter that referenced this pull request Aug 7, 2024
…ckColor and InactiveTrackColor (flutter#151367)

Style: Rename CupertinoSwitch `activeColor` and `trackColor` to `activeTrackColor` and `InactiveTrackColor`

Resolves flutter#151256
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 8, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 8, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 8, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 8, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 8, 2024
auto-submit bot pushed a commit to flutter/packages that referenced this pull request Aug 8, 2024
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
DBowen33 pushed a commit to DBowen33/flutter that referenced this pull request Aug 16, 2024
…ckColor and InactiveTrackColor (flutter#151367)

Style: Rename CupertinoSwitch `activeColor` and `trackColor` to `activeTrackColor` and `InactiveTrackColor`

Resolves flutter#151256
Buchimi pushed a commit to Buchimi/flutter that referenced this pull request Sep 2, 2024
…ckColor and InactiveTrackColor (flutter#151367)

Style: Rename CupertinoSwitch `activeColor` and `trackColor` to `activeTrackColor` and `InactiveTrackColor`

Resolves flutter#151256
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
@rkishan516 rkishan516 deleted the rename-cupertino-switch-properties branch July 26, 2025 05:46
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 c: tech-debt Technical debt, code quality, testing, etc. d: api docs Issues with https://api.flutter.dev/ d: examples Sample code and demos f: cupertino flutter/packages/flutter/cupertino repository framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rename CupertinoSwitch properties activeColor and trackColor to activeTrackColor and inactiveTrackColor

5 participants