[material_ui] Migrate AppBar M3 template to use new gen_defaults script - #12707
Conversation
…pt (flutter#12122) ~Will land flutter#12209 first.~ Fixes flutter/flutter#188397 Initially gen_defaults script and its templates were used to handle JSON tokens. After we fix the token pipeline and make it possible to get M3E tokens, we use Dart constants and re-created the gen_defaults in material_ui. After decoupling, the old gen_defaults will be deprecated soon. This PR is to: * create a template for M3 `AppBar` so we can use new script to generate M3 defaults. * move the generated code to `generated/` folder so all M3 and M3E generated code will be in the same location. - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [AI contribution guidelines] and understand my responsibilities, or I am not using AI tools. - [x] I read the [Tree Hygiene] page, which explains my responsibilities. - [x] I read and followed the [relevant style guides] and ran [the auto-formatter]. - [x] I signed the [CLA]. - [x] The title of the PR starts with the name of the package surrounded by square brackets, e.g. `[shared_preferences]` - [x] 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]. - [x] I updated/added any relevant documentation (doc comments with `///`). - [x] 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.
There was a problem hiding this comment.
Code Review
This pull request transitions the generation of Material 3 AppBar defaults to a template-based generator. It removes the manually maintained _AppBarDefaultsM3 and its scroll-under configurations from app_bar.dart, moving them to a generated file app_bar_defaults_m3.g.dart. It introduces AppBarTemplateM3 in the gen_defaults tool to generate these defaults from design tokens, updates the generator script to invoke this template, and adds corresponding unit tests. There are no review comments, so I have no feedback to provide.
There was a problem hiding this comment.
I just noticed I forgot to remove Never mind... sorry for any confusion😅packages/material_ui/tool/gen_defaults/temporarily_excluded/generated/app_bar_defaults.g.dart when I migrated app bar template. Could you help deleting it in this PR?
But LGTM! Thanks a lot for the help!
It got renamed, so we're all good here 😄 |
Added "no changelog needed" and "no versioning needed" labels to fix Linux repo_checks. |
…r#192119) flutter/packages@d642322...7a7912f 2026-09-01 21270878+elliette@users.noreply.github.com [material_ui] Migrate AppBar M3 template to use new gen_defaults script (flutter/packages#12707) 2026-09-01 32538273+ValentinVignal@users.noreply.github.com [vector_graphics] Fix deprecation lints (flutter/packages#12702) 2026-08-31 21270878+elliette@users.noreply.github.com [material_ui] Standardize M3 and M3E token template base class names (flutter/packages#12675) 2026-08-31 32538273+ValentinVignal@users.noreply.github.com [vector_graphics_compiler] Fix deprecation issues in tests (flutter/packages#12700) 2026-08-31 stuartmorgan@google.com [google_maps_flutter] Convert marker controllers to Swift (flutter/packages#12662) 2026-08-31 jmccandless@google.com [material_ui, cupertino_ui, go_router] Command to test dart fixes (flutter/packages#12390) 2026-08-31 engine-flutter-autoroll@skia.org Roll Flutter from c978386 to c8c5e3b (4 revisions) (flutter/packages#12706) 2026-08-31 269567208+reidbaker-agent@users.noreply.github.com [tool] Exempt AGENTS.md from version and changelog checks (flutter/packages#12681) 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-flutter-autoroll Please CC flutter-ecosystem@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md

Work towards flutter/flutter#191088
Ports over #12122 which landed on the
m3e_migrationfeature branch.Original PR description
Fixes flutter/flutter#188397
Initially gen_defaults script and its templates were used to handle JSON tokens. After we fix the token pipeline and make it possible to get M3E tokens, we use Dart constants and re-created the gen_defaults in material_ui. After decoupling, the old gen_defaults will be deprecated soon.
This PR is to:
create a template for M3 AppBar so we can use new script to generate M3 defaults.
move the generated code to generated/ folder so all M3 and M3E generated code will be in the same location.
Pre-Review Checklist
[shared_preferences]///).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-assistbot 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
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