Skip to content

[material_ui] Add Material 3 Expressive TextButton - #13732

Draft
QuncCccccc wants to merge 6 commits into
flutter:mainfrom
QuncCccccc:text_button_m3e
Draft

QuncCccccc wants to merge 6 commits into
flutter:mainfrom
QuncCccccc:text_button_m3e

Conversation

@QuncCccccc

@QuncCccccc QuncCccccc commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

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

With Material 3 Expressive, text buttons support:

  • Sizes (ButtonStyle.sizeVariant): extra small through extra large. Each size has its own height, padding, icon size, label text style, and gap between the icon and the label.
  • Shapes (ButtonStyle.shapeVariant): round and square, including the pressed shape.
  • A disabled container color (on surface at 10% opacity), from md.comp.button.text.disabled.container.color.

Text buttons don't get isSelected. Material 3 Expressive has no toggle text buttons ("There is no toggle text button" in the Material 3 button specs), and the text button tokens have no selected or unselected values.

The defaults are generated from the Material Design tokens by ButtonTemplateM3E. Because text buttons can't be toggle buttons, the template no longer gives their defaults a toggleable parameter.

SegmentedButton builds its segments with TextButton, and the properties that its segment style doesn't set, such as padding, come from the TextButton defaults. Without a change, opting text buttons into Material 3 Expressive would change the padding of its segments. SegmentedButton doesn't have a Material 3 Expressive style, so its internal TextButtonTheme now sets variant: StyleVariant.material3, and its segments keep the Material 3 TextButton defaults.

New APIs:

  • TextButtonThemeData.variant and TextButtonTheme.variantOf. A theme that doesn't specify variant inherits it from the enclosing themes, the same way as ElevatedButtonThemeData.variant.
  • sizeVariant and shapeVariant parameters for TextButton.styleFrom.

Material 3 Expressive TextButton sizes, and disabled round and square 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

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.
Text buttons can't be toggle buttons, so the button template no longer gives their Material 3 Expressive defaults a toggleable parameter.
@QuncCccccc QuncCccccc added the CICD Run CI/CD label Nov 20, 2026
@github-actions github-actions Bot added p: material_ui triage-design Should be looked at in design triage labels Nov 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

1 participant