Skip to content

[material_ui] Add helper methods in gen_defaults template #12121

Merged
QuncCccccc merged 2 commits into
flutter:m3e_migrationfrom
QuncCccccc:gen_defaults_template_helpers
Jul 8, 2026
Merged

[material_ui] Add helper methods in gen_defaults template #12121
QuncCccccc merged 2 commits into
flutter:m3e_migrationfrom
QuncCccccc:gen_defaults_template_helpers

Conversation

@QuncCccccc

Copy link
Copy Markdown
Contributor

Related to flutter/flutter#184950

This PR is to add some helper methods to handle color, and shape tokens. Also I updated the generated default class name from _M3xxx to _xxxM3 to keep the name consistent with the original M2 and M3 defaults.

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 under[^1].
  • 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 under[^1].
  • All existing and new tests are passing.

@github-actions github-actions Bot added triage-framework Should be looked at in framework triage p: material_ui labels Jul 6, 2026
@QuncCccccc QuncCccccc requested a review from elliette July 6, 2026 21:55
@QuncCccccc QuncCccccc added the CICD Run CI/CD label Jul 6, 2026
@QuncCccccc QuncCccccc marked this pull request as ready for review July 6, 2026 21:56

@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 updates the Material 3 component defaults generator by renaming the generated class suffixes and adding helper methods to generate Dart expressions for token numbers, colors, and shapes. It also updates the corresponding tests and test fixtures to cover these new capabilities. Review feedback suggests optimizing the colorWithOpacity helper to avoid redundant calls when opacity is 1.0, and correcting a minor formatting issue by adding a space after the comma in the generated BorderRadius.vertical expression and its corresponding test.

Comment thread packages/material_ui/tool/gen_defaults/templates/template.dart
Comment thread packages/material_ui/tool/gen_defaults/templates/template.dart Outdated
Comment thread packages/material_ui/tool/gen_defaults/test/gen_defaults_test.dart Outdated
@QuncCccccc QuncCccccc force-pushed the gen_defaults_template_helpers branch from 2978a75 to e037015 Compare July 6, 2026 23:46
@github-actions github-actions Bot removed the CICD Run CI/CD label Jul 6, 2026
@QuncCccccc QuncCccccc changed the title Add helper methods in gen_defaults template [material_ui] Add helper methods in gen_defaults template Jul 6, 2026

@elliette elliette left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM!

Comment thread packages/material_ui/tool/gen_defaults/templates/template.dart Outdated
@QuncCccccc QuncCccccc added the autosubmit Merge PR when tree becomes green via auto submit App label Jul 8, 2026
@QuncCccccc QuncCccccc merged commit 30077ee into flutter:m3e_migration Jul 8, 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

autosubmit Merge PR when tree becomes green via auto submit App 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