Skip to content

[material_ui] Set up gen_defaults sub-directory#11762

Merged
elliette merged 4 commits into
flutter:m3e_migrationfrom
elliette:gen-defaults-impl-2
May 26, 2026
Merged

[material_ui] Set up gen_defaults sub-directory#11762
elliette merged 4 commits into
flutter:m3e_migrationfrom
elliette:gen-defaults-impl-2

Conversation

@elliette
Copy link
Copy Markdown
Member

Work towards flutter/flutter#186906

Adds the initial gen_defaults sub-directory with the initial TokenTemplate and generator. This is simply the initial scaffold, we will need to add additional helper functions as necessary as we begin adding the actual templates.

Pre-Review Checklist

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

@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label May 22, 2026
@github-actions github-actions Bot added triage-framework Should be looked at in framework triage p: material_ui labels May 22, 2026
@elliette elliette requested a review from QuncCccccc May 22, 2026 17:17
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

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 new 'Token Defaults Generator' tool in the material_ui package, consisting of a command-line script, a base template class for code generation, and unit tests. Review feedback identifies a discrepancy between the documented and implemented output paths, a typo in the SDK version constraint which is incompatible with the workspace resolution feature, and a potential runtime error when creating files in non-existent directories.

Comment thread packages/material_ui/tool/m3e_gen_defaults/templates/template.dart Outdated
Comment thread packages/material_ui/tool/gen_defaults/pubspec.yaml
Comment thread packages/material_ui/tool/m3e_gen_defaults/templates/template.dart Outdated
@github-actions github-actions Bot removed the CICD Run CI/CD label May 22, 2026
@QuncCccccc
Copy link
Copy Markdown
Contributor

Do you think whether naming the folder gen_defaults would be better? Since currently the tokens we exported here also include M3 widget tokens, the new gen_defaults could be used for M3 token update (if needed).

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

Overall LGTM! Just left some comments.

Comment thread packages/material_ui/tool/gen_defaults/pubspec.yaml
Comment thread packages/material_ui/tool/gen_defaults/pubspec.yaml
Comment thread packages/material_ui/tool/m3e_gen_defaults/README.md Outdated
Comment thread packages/material_ui/tool/m3e_gen_defaults/templates/template.dart Outdated
Comment thread packages/material_ui/tool/m3e_gen_defaults/test/gen_defaults_test.dart Outdated
@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label May 26, 2026
@github-actions github-actions Bot removed the CICD Run CI/CD label May 26, 2026
@elliette
Copy link
Copy Markdown
Member Author

Do you think whether naming the folder gen_defaults would be better? Since currently the tokens we exported here also include M3 widget tokens, the new gen_defaults could be used for M3 token update (if needed).

Good point, renamed to gen_defaults. I also set it up so the M3 and M3E generated pipelines can both use gen_defaults, but get outputted to slightly different directories:

M3

  • Requires the M3TokenTemplate
  • Outputs generated code to material_ui/lib/src/generated directory
  • Expects parent file to be in material_ui/lib/src

M3E

  • Requires the M3ETokenTemplate
  • Outputs generated code to material_ui/lib/src/generated/material_3_expressive
  • Expects parent file to be in material_ui/lib/src/material_3_expressive

@elliette elliette changed the title [material_ui] Set up m3e_gen_defaults sub-directory [material_ui] Set up gen_defaults sub-directory May 26, 2026
Copy link
Copy Markdown
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! Thanks for set it up!🎉

@QuncCccccc
Copy link
Copy Markdown
Contributor

get outputted to slightly different directories...

The output structure looks good to me! Thanks for the update!

@elliette elliette merged commit 129b42b into flutter:m3e_migration May 26, 2026
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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