Skip to content

Conversation

@HansMuller
Copy link
Contributor

@HansMuller HansMuller commented Oct 28, 2020

Added AppBar.foreground and AppBarTheme.foreground color and changed the way that AppBar computes its default colors and styles. Now:

  • The default backgroundColor, i.e. the fill color for the app bar's Material, is ColorScheme.primary for light themes and ColorScheme.surface for dark themes.
  • The default foregroundColor, i.e. the color for text and icons, is ColorScheme.onPrimary for light themes and ColorScheme.onSurface for dark themes.
  • The default text style for the app bar's title is TextTheme.headline6 in the foreground color.
  • The default text style for the app bar's actions and leading widget is TextTheme.bodyText2 in the foreground color.

Both AppBarTheme and AppBar now document how the theme's brightness relates to the SystemUiOverlayStyle per #67497.

Fixes #67921.

@flutter-dashboard flutter-dashboard bot added f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels. labels Oct 28, 2020
@google-cla google-cla bot added the cla: yes label Oct 28, 2020
@HansMuller HansMuller force-pushed the appbar_color_scheme_integration branch 2 times, most recently from 290bb1b to bfeaa4c Compare November 4, 2020 23:01
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. Just a question about using the brightness property in the color calculations.

Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't these color calculations use the brightness property of the appBar itself if it has one?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's a good question. The existing AppBar/AppBarTheme brightness property is (and was) only used to set the SystemUiOverlayStyle. This is not correctly documented, I'll fix that.

In this case the brightness of theme's color scheme is used because we're choosing default colors that contrast with the theme's colors, which is also as things were.

Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to have a foreground color set here, or does it not matter here because we set the color in the icon and text themes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes.

@HansMuller HansMuller force-pushed the appbar_color_scheme_integration branch from e44b057 to 9d00682 Compare November 7, 2020 02:09
@HansMuller
Copy link
Contributor Author

This PR depends on a companion internal "SCUBA" test update: cl/341439577

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.

[Material] AppBar background color should check for ColorScheme.primary

2 participants