Skip to content

Conversation

@HansMuller
Copy link
Contributor

@HansMuller HansMuller commented Jun 29, 2021

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 f: material design flutter/packages/flutter/material repository. 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
Copy link
Contributor

@darrenaustin darrenaustin left a comment

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

f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TextButton not working inside AppBar actions[ ]

2 participants