-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
Closed
Copy link
Labels
customer: mulligan (g3)frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.
Description
Use case:
- Create a shared constant app-wide theme, like so:
final appTheme = new ThemeData(
// Define whatever styles you want, but leave the
// text themes unspecified (and thus default).
// In so doing, they'll get the default typography
// values (e.g. blackMountainView), which as of
// #12249, specify inherit:true
);
- Create a
Textwidget somewhere in your app, with styles like so:
new Text(
'sample text',
style: appTheme.primaryTextTheme.button,
),
- The styling of the text widget will be
appTheme.primaryTextTheme.button, merged with whateverDefaultTextStylehappens to live immediately above the widget in the tree. This is unexpected, since the user doesn't expect the defaultprimaryTextTheme.buttonstyle to leave some properties ambiguously defined.
Potential solutions:
- Do nothing, and call this working as intended. If the user doesn't want to inherit properties this way, they can do the following:
new DefaultTextStyle(
style: appTheme.primaryTextTheme.button,
child: new Text(
'sample text',
),
),
- Add the ability to clone a
TextStylebut change theinheritproperty, yielding user code like this:
new Text(
'sample text',
style: appTheme.primaryTextTheme.button.copyWith(new TextStyle(inherit: false)),
),
- ???
Metadata
Metadata
Assignees
Labels
customer: mulligan (g3)frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.