Skip to content

Conversation

@HansMuller
Copy link
Contributor

@HansMuller HansMuller commented Sep 28, 2016

If the theme inherited by a PopupMenuButton shadows the material app's theme then the menu itself will be wrapped with the shadow theme. In the common case, where only the app creates a theme widget, the menu inherits the app's theme as usual.

Likewise for dialogs, modal bottom sheets, and drop down menus.

Fixes #5572

this.initialValue,
this.elevation
this.elevation,
this.theme
Copy link
Contributor

Choose a reason for hiding this comment

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

when you add code like this, add trailing commas :-)

Theme({
Key key,
@required this.data,
this.isShadowTheme: true,
Copy link
Contributor

Choose a reason for hiding this comment

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

boolean arguments should when possible default to false (because foo: false looks like something that could be safely removed without effect). Maybe isPrimaryTheme with the reverse semantics? Or isMainTheme? isMaterialAppTheme?

Copy link
Contributor

Choose a reason for hiding this comment

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

isAppTheme?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I went with isMaterialAppTheme since that's part and parcel of the definition.

/// Specifies the color and typography values for descendant widgets.
final ThemeData data;

/// True if this theme shadows the one created by the [MaterialApp].
Copy link
Contributor

Choose a reason for hiding this comment

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

you should add some color here saying why you would set this (or rather, that you wouldn't), how it's used, etc.

/// If [shadowTheme] is true and the closest Theme ancestor was installed by
/// the [MaterialApp] - in other words if the closest Theme ancestor does not
/// shadow the app's theme - then return null.
static ThemeData of(BuildContext context, { bool shadowTheme: false }) {
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe shadowThemeOnly? Or secondaryThemeOnly if you call the other argument isPrimaryTheme?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I used shadowThemeOnly. Thankfully this parameter will rarely be used.

///
/// If [shadowTheme] is true and the closest Theme ancestor was installed by
/// the [MaterialApp] - in other words if the closest Theme ancestor does not
/// shadow the app's theme - then return null.
Copy link
Contributor

Choose a reason for hiding this comment

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

add another paragraph talking about why you would use this argument.

@Hixie
Copy link
Contributor

Hixie commented Sep 28, 2016

As discussed, I suspect the other ones need it too because they probably have Material widgets and so forth.

LGTM.

ThemeData theme = config.theme ?? new ThemeData.fallback();
Widget result = new AnimatedTheme(
data: theme,
isShadowTheme: false,
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe isShadowingTheme would be more explicit?

@HansMuller HansMuller merged commit 6a1ac73 into flutter:master Sep 29, 2016
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pesto in dark theme: menu text has wrong color

4 participants