Skip to content

[material_ui] Migrate AppBar M3 template to use new gen_defaults script - #12707

Merged
auto-submit[bot] merged 1 commit into
flutter:mainfrom
elliette:port-pr-12122
Sep 1, 2026
Merged

[material_ui] Migrate AppBar M3 template to use new gen_defaults script#12707
auto-submit[bot] merged 1 commit into
flutter:mainfrom
elliette:port-pr-12122

Conversation

@elliette

Copy link
Copy Markdown
Member

Work towards flutter/flutter#191088

Ports over #12122 which landed on the m3e_migration feature 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

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

…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.

@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 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.

@github-actions github-actions Bot added p: material_ui triage-design Should be looked at in design triage labels Aug 31, 2026

@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.

I just noticed I forgot to remove 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? Never mind... sorry for any confusion😅

But LGTM! Thanks a lot for the help!

@elliette

Copy link
Copy Markdown
Member Author

I just noticed I forgot to remove 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 😄

@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 Aug 31, 2026
@QuncCccccc

Copy link
Copy Markdown
Contributor
Screenshot 2026-08-31 at 3 18 35 PM

Added "no changelog needed" and "no versioning needed" labels to fix Linux repo_checks.

@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 and removed 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 Aug 31, 2026
@elliette elliette added the autosubmit Merge PR when tree becomes green via auto submit App label Sep 1, 2026
@auto-submit
auto-submit Bot merged commit 7a7912f into flutter:main Sep 1, 2026
12 checks passed
pull Bot pushed a commit to g-star1024/flutter that referenced this pull request Sep 1, 2026
…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
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 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.

app_bar_template.dart

2 participants