Skip to content
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

Fix token usages on Regular Chip and Action Chip #141701

Merged
merged 8 commits into from Feb 1, 2024

Conversation

davidmartos96
Copy link
Contributor

The regular chip and the action chip templates were referencing non existent M3 design tokens.

Fixes #141288

The ActionChip doesn't have any visual difference. Even though the template and file changes, the default labelStyle color already uses onSurface.
For the reviewer, I've changed the action_chip_test to expect a color from the colorScheme so that it is more explicit that the color might not be the same as the labelLarge default in the global textTheme, even if for this case the color is the same.

The regular Chip does have visual differences, in particular, the label and trailing icon colors, which were not following the specification. In order to fix this, the regular chip now is based from the filter-chip spec as described in the linked issue.

Before

image

After

image

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. f: material design flutter/packages/flutter/material repository. labels Jan 17, 2024
@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 #141701 at sha 6907182

@flutter-dashboard flutter-dashboard bot added the will affect goldens Changes to golden files label Jan 17, 2024
Copy link
Contributor

@QuncCccccc QuncCccccc left a comment

Choose a reason for hiding this comment

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

Thanks so much for the contribution! Just left some questions below:)

@@ -60,10 +64,10 @@ class _${blockName}DefaultsM3 extends ChipThemeData {
Color? get surfaceTintColor => ${colorOrTransparent("$tokenGroup.container.surface-tint-layer.color")};

@override
Color? get checkmarkColor => ${color("$tokenGroup.with-icon.selected.icon.color")};
Color? get checkmarkColor => null;
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we here use "$tokenGroup.with-icon.icon.color"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@QuncCccccc I've written my thoughts on this in the main thread: #141701 (comment)
Let me know what you think


@override
Color? get deleteIconColor => ${color("$tokenGroup.with-icon.selected.icon.color")};
Color? get deleteIconColor => null;
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here

@@ -10,7 +10,7 @@ class ChipTemplate extends TokenTemplate {
super.textThemePrefix = '_textTheme.'
});

static const String tokenGroup = 'md.comp.assist-chip';
static const String tokenGroup = 'md.comp.filter-chip';
Copy link
Contributor

Choose a reason for hiding this comment

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

Based on the comment in the original issue, this change makes sense to me. Maybe @TahaTesser has more context about this:)

Copy link
Member

Choose a reason for hiding this comment

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

Since chip_template is for generic chip, using filter chip tokens to get most tokens available makes sense.

@@ -41,21 +45,23 @@ class _${blockName}DefaultsM3 extends ChipThemeData {
Color? get surfaceTintColor => ${colorOrTransparent("$tokenGroup.container.surface-tint-layer.color")};

@override
Color? get checkmarkColor => ${color("$tokenGroup.with-icon.selected.icon.color")};
Color? get checkmarkColor => null;
Copy link
Contributor

Choose a reason for hiding this comment

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

If we change tokenGroup to filterChip, should we here use with-leading-icon.selected.leading-icon.color?

@davidmartos96
Copy link
Contributor Author

@QuncCccccc Thanks for reviewing! I'll try to answer the comments here, as all of them are related.

I've purposely set those as null for a couple reasons. Described in the linked issue, but I'll try to summarize.

  1. The checkmark and delete icons are not part of the ActionChip API, so I think it would only add confusion if we assign a token. null is giving some meaning saying there is not a token defined for those colors, as it is not in the spec.
  2. There is already an iconTheme which applies to the leading icon.
  3. If we were to give a color to the ActionChip delete icon, imagining it did have the API for such icon, it would be colored with the primary color (i.e. purple in the default M3 theme), instead of the the label color.

But it would be great to read some other opinion 😄

@flutter-dashboard
Copy link

Golden file changes are available for triage from new commit, Click here to view.

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 #141701 at sha 5cd04a5

@QuncCccccc
Copy link
Contributor

@QuncCccccc Thanks for reviewing! I'll try to answer the comments here, as all of them are related.

I've purposely set those as null for a couple reasons. Described in the linked issue, but I'll try to summarize.

  1. The checkmark and delete icons are not part of the ActionChip API, so I think it would only add confusion if we assign a token. null is giving some meaning saying there is not a token defined for those colors, as it is not in the spec.
  2. There is already an iconTheme which applies to the leading icon.
  3. If we were to give a color to the ActionChip delete icon, imagining it did have the API for such icon, it would be colored with the primary color (i.e. purple in the default M3 theme), instead of the the label color.

But it would be great to read some other opinion 😄

Thanks for the explanation! That makes sense to me:) LGTM.

Copy link
Contributor

@QuncCccccc QuncCccccc left a comment

Choose a reason for hiding this comment

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

LGTM

@QuncCccccc
Copy link
Contributor

Same here. Doing a local test for G3 before we merge this in master.

@QuncCccccc
Copy link
Contributor

Could you help solve the conflicts:)?

@davidmartos96
Copy link
Contributor Author

Could you help solve the conflicts:)?

It should be good now. The conflict was in used_tokens.csv, so it only was neccessary to run gen_defaults again

@QuncCccccc QuncCccccc added the autosubmit Merge PR when tree becomes green via auto submit App label Feb 1, 2024
@auto-submit auto-submit bot merged commit b34ee07 into flutter:master Feb 1, 2024
132 checks passed
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 1, 2024
auto-submit bot pushed a commit to flutter/packages that referenced this pull request Feb 1, 2024
…6028)

Manual roll Flutter from c65ab4d513da to e02e2079bea7 (38 revisions)

Manual roll requested by stuartmorgan@google.com

flutter/flutter@c65ab4d...e02e207

2024-02-01 engine-flutter-autoroll@skia.org Roll Flutter Engine from f4fbabf1eb9f to 68943afd62d1 (9 revisions) (flutter/flutter#142690)
2024-02-01 36861262+QuncCccccc@users.noreply.github.com Introduce tone-based surfaces and accent color add-ons - Part 1 (flutter/flutter#142654)
2024-02-01 andrewrkolos@gmail.com improve error message when `--base-href` argument does not start with `/` (flutter/flutter#142667)
2024-02-01 engine-flutter-autoroll@skia.org Roll Flutter Engine from c4247c5e31ba to f4fbabf1eb9f (1 revision) (flutter/flutter#142675)
2024-02-01 engine-flutter-autoroll@skia.org Roll Flutter Engine from c83617eee093 to c4247c5e31ba (3 revisions) (flutter/flutter#142662)
2024-02-01 jonahwilliams@google.com [Impeller] opt vulkan tests into GPU tracing. (flutter/flutter#142649)
2024-02-01 gspencergoog@users.noreply.github.com Convert button `.icon` and `.tonalIcon` constructors to take nullable icons. (flutter/flutter#142644)
2024-02-01 davidmartos96@gmail.com Fix token usages on Regular Chip and Action Chip (flutter/flutter#141701)
2024-02-01 hans.muller@gmail.com Added ButtonStyle.foregroundBuilder and ButtonStyle.backgroundBuilder (flutter/flutter#141818)
2024-01-31 engine-flutter-autoroll@skia.org Roll Flutter Engine from 5b89189b8b5f to c83617eee093 (2 revisions) (flutter/flutter#142656)
2024-01-31 christopherfujino@gmail.com [flutter_tools] add debugging to ios/core_devices.dart (flutter/flutter#142187)
2024-01-31 gspencergoog@users.noreply.github.com Fix showDialog docs (flutter/flutter#142458)
2024-01-31 49699333+dependabot[bot]@users.noreply.github.com Bump peter-evans/create-pull-request from 5.0.2 to 6.0.0 (flutter/flutter#142650)
2024-01-31 engine-flutter-autoroll@skia.org Roll Flutter Engine from 20e53614c16c to 5b89189b8b5f (2 revisions) (flutter/flutter#142640)
2024-01-31 dnfield@google.com Refactor ShaderTarget to not explicitly mention impeller or Skia (flutter/flutter#141460)
2024-01-31 engine-flutter-autoroll@skia.org Roll Flutter Engine from 9ccd81d7595b to 20e53614c16c (3 revisions) (flutter/flutter#142628)
2024-01-31 louisehsu@google.com Show Mac Designed For iPad in 'flutter devices' (flutter/flutter#141718)
2024-01-31 fluttergithubbot@gmail.com Marks Mac_arm64_ios basic_material_app_ios__compile to be unflaky (flutter/flutter#142594)
2024-01-31 goderbauer@google.com Fix ParentDataWidget crash for  multi view scenarios (flutter/flutter#142486)
2024-01-31 engine-flutter-autoroll@skia.org Roll Flutter Engine from e0d8f472a1b6 to 9ccd81d7595b (1 revision) (flutter/flutter#142625)
2024-01-31 fluttergithubbot@gmail.com Marks Mac_arm64 tool_tests_commands to be unflaky (flutter/flutter#142593)
2024-01-31 jmccandless@google.com "System back gesture" explanation (flutter/flutter#142254)
2024-01-31 fluttergithubbot@gmail.com Marks Mac_x64 tool_tests_commands to be unflaky (flutter/flutter#142592)
2024-01-31 fluttergithubbot@gmail.com Marks Mac_x64_ios integration_test_test_ios to be unflaky (flutter/flutter#142595)
2024-01-31 fluttergithubbot@gmail.com Marks Mac_x64 native_ui_tests_macos to be unflaky (flutter/flutter#142598)
2024-01-31 fluttergithubbot@gmail.com Marks Mac_x64_ios hot_mode_dev_cycle_ios__benchmark to be unflaky (flutter/flutter#142597)
2024-01-31 fluttergithubbot@gmail.com Marks Mac_arm64 native_ui_tests_macos to be unflaky (flutter/flutter#142599)
2024-01-31 fluttergithubbot@gmail.com Marks Windows_android hot_mode_dev_cycle_win__benchmark to be flaky (flutter/flutter#142609)
2024-01-31 fluttergithubbot@gmail.com Marks Mac_arm64_ios integration_test_test_ios to be unflaky (flutter/flutter#142596)
2024-01-31 polinach@google.com Mark test that leaks image. (flutter/flutter#142539)
2024-01-31 engine-flutter-autoroll@skia.org Roll Flutter Engine from b9bc256156b8 to e0d8f472a1b6 (1 revision) (flutter/flutter#142623)
2024-01-31 31859944+LongCatIsLooong@users.noreply.github.com Fix unresponsive mouse tooltip (flutter/flutter#142282)
2024-01-31 fluttergithubbot@gmail.com Marks Linux_android_emu android_defines_test to be unflaky (flutter/flutter#142591)
2024-01-31 engine-flutter-autoroll@skia.org Roll Flutter Engine from 447dd212447e to b9bc256156b8 (6 revisions) (flutter/flutter#142617)
2024-01-31 engine-flutter-autoroll@skia.org Roll Packages from 25abb5d to 5b48c44 (4 revisions) (flutter/flutter#142616)
2024-01-31 64037520+SelaseKay@users.noreply.github.com Fix null operator error when tapping on 'MenuItemButton' (flutter/flutter#142230)
2024-01-31 engine-flutter-autoroll@skia.org Roll Flutter Engine from 8e7df85f7d11 to 447dd212447e (2 revisions) (flutter/flutter#142587)
2024-01-31 katelovett@google.com Split out AppBar/SliverAppBar material tests (flutter/flutter#142560)

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 rmistry@google.com,stuartmorgan@google.com on the revert to ensure that a human
is aware of the problem.
...
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: 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.

Material 3 - Regular chip and Action chip templates using invalid tokens
3 participants