Skip to content

[material_ui] Default gen_defaults color helper prefix - #12848

Open
QuncCccccc wants to merge 1 commit into
flutter:mainfrom
QuncCccccc:gen_defaults_color_prefix_defaults
Open

[material_ui] Default gen_defaults color helper prefix#12848
QuncCccccc wants to merge 1 commit into
flutter:mainfrom
QuncCccccc:gen_defaults_color_prefix_defaults

Conversation

@QuncCccccc

Copy link
Copy Markdown
Contributor

Work toward flutter/flutter#187899.

Follow-up to #12846.

While migrating the M3 templates, I noticed that existing templates use _colors as the prefix passed to color and colorWithOpacity. This PR makes _colors the default value for the prefix argument and removes the now-redundant explicit arguments from existing templates. Explicit custom prefixes remain supported, and regenerating the enabled templates produces no changes to the checked-in generated defaults.

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 Sep 12, 2026
@github-actions github-actions Bot added p: material_ui triage-design Should be looked at in design triage labels Sep 12, 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 refactors several template files under packages/material_ui/tool/gen_defaults/templates/ and their associated tests by making the prefix parameter of the color and colorWithOpacity helper methods optional with a default value of '_colors'. This allows removing the explicit '_colors' argument from numerous calls across the templates. The reviewer suggests replacing deprecated MaterialStatePropertyAll with WidgetStatePropertyAll in button_template.dart, utilizing the inherited border helper method instead of explicitly instantiating BorderSide, and simplifying redundant conditional branches in the iconColor resolver.

@QuncCccccc
QuncCccccc force-pushed the gen_defaults_color_prefix_defaults branch from 928a58e to 4d83ce0 Compare September 12, 2026 03:51
@QuncCccccc QuncCccccc added override: no versioning needed Override the check requiring version bumps for most changes override: no changelog needed Override the check requiring CHANGELOG updates for most changes labels Sep 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CICD Run CI/CD override: no changelog needed Override the check requiring CHANGELOG updates for most changes override: no versioning needed Override the check requiring version bumps for most changes p: material_ui triage-design Should be looked at in design triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants