Skip to content

Added AppBar.textButtonTheme - #85585

Merged
HansMuller merged 2 commits into
flutter:masterfrom
HansMuller:appbar_text_button_theme
Jun 30, 2021
Merged

HansMuller merged 2 commits into
flutter:masterfrom
HansMuller:appbar_text_button_theme

Conversation

@HansMuller

@HansMuller HansMuller commented Jun 29, 2021 •

Copy link
Copy Markdown
Contributor

By default, TextButtons included in the AppBar's title or actions widgets will use the AppBar's foregroundColor as their foreground color. Apps can override the default by specifying appBar.textButtonTheme or by overriding the theme's ThemeData.appBarTheme, or by styling the individual buttons.

This TextButton-specific tweak is useful because, by default, the foreground color for TextButtons is ColorScheme.primary, which is the also the default background color for AppBar. The rationale for including this property and its default is the same as for the default values of AppBar.iconTheme and AppBar.actionsIconTheme. The theme's for other widgets (or the app's overall color scheme) are not overridden by default because they're not commonly found in AppBars.

Fixes #84642

@flutter-dashboard flutter-dashboard Bot added p: material_ui material_ui package in flutter/packages framework flutter/packages/flutter repository. See also f: labels. labels Jun 29, 2021
@google-cla google-cla Bot added the cla: yes label Jun 29, 2021
@HansMuller
HansMuller requested a review from darrenaustin June 30, 2021 15:12

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

LGTM. Nice addition.

@HansMuller
HansMuller merged commit fdeb480 into flutter:master Jun 30, 2021
@HansMuller
HansMuller deleted the appbar_text_button_theme branch July 1, 2021 17:47
@HansMuller

Copy link
Copy Markdown
Contributor Author

This change caused some unintended diffs with AppBars with a white background - where the default TextButton colors already contrasted well with the AppBar's background color. Internal Google bug b/192498505

I am going to temporarily revert this change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

framework flutter/packages/flutter repository. See also f: labels. p: material_ui material_ui package in flutter/packages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TextButton not working inside AppBar actions[ ]

2 participants