Repository navigation
[material_ui] Add Material 3 Expressive OutlinedButton - #13724
Conversation
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.
…ressive defaults docs
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
Make sense. Updated.
| /// | ||
| /// 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 |
There was a problem hiding this comment.
[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.
There was a problem hiding this comment.
It makes sense! I'll create a small PR to rephrase them all:)! Thank you!
…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
This PR is to add Material 3 Expressive support to
OutlinedButton. As withElevatedButton(#13084), apps opt in withOutlinedButtonThemeData(variant: StyleVariant.material3Expressive). Without it,OutlinedButtonkeeps the Material 3 style.With Material 3 Expressive, outlined buttons support:
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.ButtonStyle.shapeVariant): round and square, including the pressed shape and the shape change when a toggle button is selected.isSelectedis selectable. WhenisSelectedis 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, becausemd.comp.button.outlined.selected.disabled.container.coloris the only disabled container color token for outlined buttons.New APIs:
OutlinedButtonThemeData.variantandOutlinedButtonTheme.variantOf. A theme that doesn't specifyvariantinherits it from the enclosing themes, the same way asElevatedButtonThemeData.variant.isSelectedforOutlinedButtonandOutlinedButton.icon.sizeVariantandshapeVariantparameters forOutlinedButton.styleFrom.Part of flutter/flutter#184937
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