ThemeData class

Holds the color and typography values for a material design theme.

Use this class to configure a Theme widget.

To obtain the current theme, use Theme.of.

Inheritance
Annotations
  • @immutable

Constructors

ThemeData({Brightness brightness, MaterialColor primarySwatch, Color primaryColor, Brightness primaryColorBrightness, Color primaryColorLight, Color primaryColorDark, Color accentColor, Brightness accentColorBrightness, Color canvasColor, Color scaffoldBackgroundColor, Color bottomAppBarColor, Color cardColor, Color dividerColor, Color highlightColor, Color splashColor, InteractiveInkFeatureFactory splashFactory, Color selectedRowColor, Color unselectedWidgetColor, Color disabledColor, Color buttonColor, ButtonThemeData buttonTheme, Color secondaryHeaderColor, Color textSelectionColor, Color textSelectionHandleColor, Color backgroundColor, Color dialogBackgroundColor, Color indicatorColor, Color hintColor, Color errorColor, String fontFamily, TextTheme textTheme, TextTheme primaryTextTheme, TextTheme accentTextTheme, InputDecorationTheme inputDecorationTheme, IconThemeData iconTheme, IconThemeData primaryIconTheme, IconThemeData accentIconTheme, SliderThemeData sliderTheme, TargetPlatform platform })
Create a ThemeData given a set of preferred values. [...]
factory
ThemeData.dark()
A default dark theme with a teal accent color. [...]
factory
ThemeData.fallback()
The default color theme. Same as new ThemeData.light. [...]
factory
ThemeData.light()
A default light blue theme. [...]
factory
ThemeData.raw({@required Brightness brightness, @required Color primaryColor, @required Brightness primaryColorBrightness, @required Color primaryColorLight, @required Color primaryColorDark, @required Color accentColor, @required Brightness accentColorBrightness, @required Color canvasColor, @required Color scaffoldBackgroundColor, @required Color bottomAppBarColor, @required Color cardColor, @required Color dividerColor, @required Color highlightColor, @required Color splashColor, @required InteractiveInkFeatureFactory splashFactory, @required Color selectedRowColor, @required Color unselectedWidgetColor, @required Color disabledColor, @required Color buttonColor, @required ButtonThemeData buttonTheme, @required Color secondaryHeaderColor, @required Color textSelectionColor, @required Color textSelectionHandleColor, @required Color backgroundColor, @required Color dialogBackgroundColor, @required Color indicatorColor, @required Color hintColor, @required Color errorColor, @required TextTheme textTheme, @required TextTheme primaryTextTheme, @required TextTheme accentTextTheme, @required InputDecorationTheme inputDecorationTheme, @required IconThemeData iconTheme, @required IconThemeData primaryIconTheme, @required IconThemeData accentIconTheme, @required SliderThemeData sliderTheme, @required TargetPlatform platform })
Create a ThemeData given a set of exact values. All the values must be specified. [...]
const

Properties

accentColor Color
The foreground color for widgets (knobs, text, overscroll edge effect, etc).
final
accentColorBrightness Brightness
The brightness of the accentColor. Used to determine the color of text and icons placed on top of the accent color (e.g. the icons on a floating action button).
final
accentIconTheme IconThemeData
An icon theme that contrasts with the accent color.
final
accentTextTheme TextTheme
A text theme that contrasts with the accent color.
final
backgroundColor Color
A color that contrasts with the primaryColor, e.g. used as the remaining part of a progress bar.
final
bottomAppBarColor Color
The default color of the BottomAppBar. [...]
final
brightness Brightness
The brightness of the overall theme of the application. Used by widgets like buttons to determine what color to pick when not using the primary or accent color. [...]
final
buttonColor Color
The default fill color of the Material used in RaisedButtons.
final
buttonTheme ButtonThemeData
Defines the default configuration of button widgets, like RaisedButton and FlatButton.
final
canvasColor Color
The default color of MaterialType.canvas Material.
final
cardColor Color
The color of Material when it is used as a Card.
final
dialogBackgroundColor Color
The background color of Dialog elements.
final
disabledColor Color
The color used for widgets that are inoperative, regardless of their state. For example, a disabled checkbox (which may be checked or unchecked).
final
dividerColor Color
The color of Dividers and PopupMenuDividers, also used between ListTiles, between rows in DataTables, and so forth. [...]
final
errorColor Color
The color to use for input validation errors, e.g. in TextField fields.
final
hashCode int
The hash code for this object. [...]
read-only
highlightColor Color
The highlight color used during ink splash animations or to indicate an item in a menu is selected.
final
hintColor Color
The color to use for hint text or placeholder text, e.g. in TextField fields.
final
iconTheme IconThemeData
An icon theme that contrasts with the card and canvas colors.
final
indicatorColor Color
The color of the selected tab indicator in a tab bar.
final
inputDecorationTheme InputDecorationTheme
The default InputDecoration values for InputDecorator, TextField, and TextFormField are based on this theme. [...]
final
platform TargetPlatform
The platform the material widgets should adapt to target. [...]
final
primaryColor Color
The background color for major parts of the app (toolbars, tab bars, etc)
final
primaryColorBrightness Brightness
The brightness of the primaryColor. Used to determine the color of text and icons placed on top of the primary color (e.g. toolbar text).
final
primaryColorDark Color
A darker version of the primaryColor.
final
primaryColorLight Color
A lighter version of the primaryColor.
final
primaryIconTheme IconThemeData
An icon theme that contrasts with the primary color.
final
primaryTextTheme TextTheme
A text theme that contrasts with the primary color.
final
scaffoldBackgroundColor Color
The default color of the Material that underlies the Scaffold. The background color for a typical material app or a page within the app.
final
secondaryHeaderColor Color
The color of the header of a PaginatedDataTable when there are selected rows.
final
selectedRowColor Color
The color used to highlight selected rows.
final
sliderTheme SliderThemeData
The colors and shapes used to render Slider. [...]
final
splashColor Color
The color of ink splashes. See InkWell.
final
splashFactory InteractiveInkFeatureFactory
Defines the appearance of ink splashes produces by InkWell and InkResponse. [...]
final
textSelectionColor Color
The color of text selections in text fields, such as TextField.
final
textSelectionHandleColor Color
The color of the handles used to adjust what part of the text is currently selected.
final
textTheme TextTheme
Text with a color that contrasts with the card and canvas colors.
final
unselectedWidgetColor Color
The color used for widgets in their inactive (but enabled) state. For example, an unchecked checkbox. Usually contrasted with the accentColor. See also disabledColor.
final
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

copyWith({Brightness brightness, Color primaryColor, Brightness primaryColorBrightness, Color primaryColorLight, Color primaryColorDark, Color accentColor, Brightness accentColorBrightness, Color canvasColor, Color scaffoldBackgroundColor, Color bottomAppBarColor, Color cardColor, Color dividerColor, Color highlightColor, Color splashColor, InteractiveInkFeatureFactory splashFactory, Color selectedRowColor, Color unselectedWidgetColor, Color disabledColor, Color buttonColor, ButtonThemeData buttonTheme, Color secondaryHeaderColor, Color textSelectionColor, Color textSelectionHandleColor, Color backgroundColor, Color dialogBackgroundColor, Color indicatorColor, Color hintColor, Color errorColor, TextTheme textTheme, TextTheme primaryTextTheme, TextTheme accentTextTheme, InputDecorationTheme inputDecorationTheme, IconThemeData iconTheme, IconThemeData primaryIconTheme, IconThemeData accentIconTheme, SliderThemeData sliderTheme, TargetPlatform platform }) ThemeData
Creates a copy of this theme but with the given fields replaced with the new values.
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node. [...]
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
toDiagnosticsNode({String name, DiagnosticsTreeStyle style }) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by toStringDeep. [...]
inherited
toString({DiagnosticLevel minLevel: DiagnosticLevel.debug }) String
Returns a string representation of this object.
inherited
toStringShort() String
A brief description of this object, usually just the runtimeType and the hashCode. [...]
inherited

Operators

operator ==(Object other) bool
The equality operator. [...]

Static Methods

estimateBrightnessForColor(Color color) Brightness
Determines whether the given Color is Brightness.light or Brightness.dark. [...]
lerp(ThemeData a, ThemeData b, double t) ThemeData
Linearly interpolate between two themes. [...]
localize(ThemeData baseTheme, TextTheme localTextGeometry) ThemeData
Returns a new theme built by merging the text geometry provided by the localTextGeometry theme with the baseTheme. [...]