Skip to content

[material_ui] Add Material tokens (version 38.2.50) - #12471

Open
elliette wants to merge 1 commit into
flutter:mainfrom
elliette:material_tokens_v38.2.50_b7e00291
Open

[material_ui] Add Material tokens (version 38.2.50)#12471
elliette wants to merge 1 commit into
flutter:mainfrom
elliette:material_tokens_v38.2.50_b7e00291

Conversation

@elliette

@elliette elliette commented Aug 13, 2026

Copy link
Copy Markdown
Member

Export the Material tokens to material_ui. This PR simply exports the existing tokens from g3 to Github.

Work towards flutter/flutter#186906

Pre-Review Checklist

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I read the [AI contribution guidelines] and understand my responsibilities, or I am not using AI tools.
  • I read the [Tree Hygiene] page, which explains my responsibilities.
  • I read and followed the [relevant style guides] and ran [the auto-formatter].
  • I signed the [CLA].
  • The title of the PR starts with the name of the package surrounded by square brackets, e.g. [shared_preferences]
  • I [linked to at least one issue that this PR fixes] in the description above.
  • I followed [the version and CHANGELOG instructions], using [semantic versioning] and the [repository CHANGELOG style], or I have commented below to indicate which documented exception this PR falls under1.
  • I updated/added any relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or I have commented below to indicate which [test exemption] this PR falls under1.
  • All existing and new tests are passing.

Test exemption: All generated code.

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

Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the gemini-code-assist bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.

Footnotes

  1. Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. 2

FolderOrigin-RevId: /google/src/cloud/elliottbrooks/update-tokens-main/google3/ux/tokens/design_systems/md/versions/latest/flutter
@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label Aug 13, 2026
@flutter-dashboard

Copy link
Copy Markdown

It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging.

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. If you believe this PR qualifies for a test exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). 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 triage-framework Should be looked at in framework triage p: material_ui labels Aug 13, 2026

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request introduces a comprehensive set of Material 3 design token definitions under packages/material_ui/tool/gen_defaults/data/, covering components like app bars, buttons, chips, dialogs, sliders, and system tokens such as colors, motion, and typescales. Feedback on these changes suggests improving type safety and performance by defining color tokens directly as Color constants rather than String literals, representing the easingEmphasized motion curves as Cubic objects instead of strings, and changing the fontWeight property in TypescaleStruct from double to int to align with Flutter's standard representation.


class TokenColorDark {
/// md.sys.color.background
static const String background = '0xFF141218';

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.

high

Defining colors as String literals is not ideal in Dart. This requires runtime parsing to convert them into Color objects, which is inefficient and not type-safe. It would be much better to define them as Color constants directly. You will also need to add import 'package:flutter/painting.dart'; at the top of the file.

This comment applies to all color definitions in this file and other similar color token files in this PR (color_*.dart, palette.dart).

Suggested change
static const String background = '0xFF141218';
static const Color background = Color(0xFF141218);

Comment on lines +59 to +60
static const String easingEmphasized =
'M 0,0 C 0.05, 0, 0.133333, 0.06, 0.166666, 0.4 C 0.208333, 0.82, 0.25, 1, 1, 1';

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.

medium

The easingEmphasized constant is defined as a String, which is inconsistent with other easing constants defined as Cubic. Using a string for an easing curve requires runtime parsing, which is inefficient. It's better to use a Curve object directly.

For Material 3's emphasized easing, the recommended implementation in Flutter is const Cubic(0.2, 0.0, 0.0, 1.0). I suggest changing the type to Cubic and using this value for consistency and performance.

  static const Cubic easingEmphasized = Cubic(0.2, 0.0, 0.0, 1.0);

Comment on lines +59 to +60
static const String easingEmphasized =
'M 0,0 C 0.05, 0, 0.133333, 0.06, 0.166666, 0.4 C 0.208333, 0.82, 0.25, 1, 1, 1';

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.

medium

The easingEmphasized constant is defined as a String, which is inconsistent with other easing constants defined as Cubic. Using a string for an easing curve requires runtime parsing, which is inefficient. It's better to use a Curve object directly.

For Material 3's emphasized easing, the recommended implementation in Flutter is const Cubic(0.2, 0.0, 0.0, 1.0). I suggest changing the type to Cubic and using this value for consistency and performance.

  static const Cubic easingEmphasized = Cubic(0.2, 0.0, 0.0, 1.0);

final String name;
final String fontFamily;
final double fontSize;
final double fontWeight;

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.

medium

The fontWeight property should be of type int instead of double. In Flutter's TextStyle, fontWeight is represented by FontWeight constants, which have integer values (e.g., 400 for normal, 700 for bold). Using double is semantically incorrect for this property.

Suggested change
final double fontWeight;
final int fontWeight;

@elliette
elliette requested a review from QuncCccccc August 13, 2026 22:59

@QuncCccccc QuncCccccc 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!

The PR description shows 2 Pre-Review Checklist sets=)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CICD Run CI/CD p: material_ui triage-framework Should be looked at in framework triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants