Skip to content

[material_ui] Add Material 3 Expressive OutlinedButton - #13724

Merged
auto-submit[bot] merged 5 commits into
flutter:mainfrom
QuncCccccc:outlined_button_m3e
Nov 25, 2026
Merged

auto-submit[bot] merged 5 commits into
flutter:mainfrom
QuncCccccc:outlined_button_m3e

Conversation

@QuncCccccc

@QuncCccccc QuncCccccc commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

This PR is to add Material 3 Expressive support to OutlinedButton. As with ElevatedButton (#13084), apps opt in with OutlinedButtonThemeData(variant: StyleVariant.material3Expressive). Without it, OutlinedButton keeps the Material 3 style.

With Material 3 Expressive, outlined buttons support:

  • Sizes (ButtonStyle.sizeVariant): extra small through extra large. Each size has its own height, padding, icon size, label text style, outline width, and gap between the icon and the label.
  • Shapes (ButtonStyle.shapeVariant): round and square, including the pressed shape and the shape change when a toggle button is selected.
  • Toggle buttons: a button with a non-null isSelected is selectable. When isSelected is true, it uses the selected colors and selected semantics, and the outline is removed.

The defaults are generated from the Material Design tokens by ButtonTemplateM3E. The outline uses the outline variant color in every state. A disabled button's container is transparent unless the button is a selected toggle button, because md.comp.button.outlined.selected.disabled.container.color is the only disabled container color token for outlined buttons.

New APIs:

  • OutlinedButtonThemeData.variant and OutlinedButtonTheme.variantOf. A theme that doesn't specify variant inherits it from the enclosing themes, the same way as ElevatedButtonThemeData.variant.
  • isSelected for OutlinedButton and OutlinedButton.icon.
  • sizeVariant and shapeVariant parameters for OutlinedButton.styleFrom.

Material 3 Expressive OutlinedButton sizes, shapes, toggle buttons, and disabled buttons

Part of flutter/flutter#184937

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

@github-actions github-actions Bot added p: material_ui triage-design Should be looked at in design triage labels Nov 19, 2026
@QuncCccccc QuncCccccc added the CICD Run CI/CD label Nov 19, 2026
Each iteration changes the theme-level size, and before the theme animation finishes the button still uses the previous size, so the test only built xSmall buttons.
@QuncCccccc
QuncCccccc requested a review from elliette November 24, 2026 04:44
@QuncCccccc
QuncCccccc marked this pull request as ready for review November 24, 2026 04:44

@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 introduces Material 3 Expressive support and selectable states for OutlinedButton. It adds a new generated defaults class _OutlinedButtonDefaultsM3E, introduces the variant property to OutlinedButtonThemeData, and adds the OutlinedButtonTheme.variantOf helper. Additionally, it updates the default style generation tool and includes comprehensive unit tests. Feedback on the changes suggests replacing the deprecated MaterialStatesController with WidgetStatesController in the test suite.

testWidgets('OutlinedButton isSelected updates a provided statesController', (
WidgetTester tester,
) async {
final controller = MaterialStatesController();

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.

medium

Use WidgetStatesController instead of the deprecated MaterialStatesController. Flutter has deprecated MaterialStatesController in favor of WidgetStatesController to unify state management across widgets.

    final controller = WidgetStatesController();

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Make sense. Updated.

@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! One optional comment

///
/// If [ThemeData.useMaterial3] is set to true the following defaults will
/// be used:
/// With the Material 3 style, that is, when [ThemeData.useMaterial3] is true

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.

[optional] "With the Material 3 Expressive style, that is, when ..." reads a bit clunkily with the double comma.

I wonder if we could simplify this to something like:

"When [ThemeData.useMaterial3] is true and [OutlinedButtonThemeData.variant] is [StyleVariant.material3Expressive], the following defaults will be used."

What do you think? Sorry I didn't catch this on the ElevatedButton and FilledButton PRs! Also okay if we want to update the phrasing for all of them in a follow-up PR. I'm guessing whatever phrasing we land on will be re-used throughout the migration.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It makes sense! I'll create a small PR to rephrase them all:)! Thank you!

@QuncCccccc QuncCccccc added the autosubmit Merge PR when tree becomes green via auto submit App label Nov 25, 2026
@auto-submit
auto-submit Bot merged commit da586f5 into flutter:main Nov 25, 2026
13 checks passed
famio pushed a commit to famio/flutter that referenced this pull request Nov 26, 2026
…r#197471)

flutter/packages@105a874...da586f5

2026-11-25 [email protected] [material_ui]
Add Material 3 Expressive `OutlinedButton` (flutter/packages#13724)
2026-11-25 [email protected] [flutter_svg] Correct the default clip
diagnostic value (flutter/packages#13600)
2026-11-25 [email protected] Roll Flutter from
b75c5b3 to 06f1c24 (37 revisions) (flutter/packages#13788)

If this roll has caused a breakage, revert this CL and set the roller
to dry run mode using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC [email protected] 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 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