Skip to main content

MaterialStateTextStyle

Type Alias MaterialStateTextStyle 

Source
pub type MaterialStateTextStyle = WidgetStateTextStyle;
👎Deprecated:

Use WidgetStateTextStyle instead. Moved to the Widgets layer to make code available outside of Material. This feature was deprecated after v3.19.0-0.3.pre.

Expand description

Defines a TextStyle that is also a MaterialStateProperty.

This class exists to enable widgets with TextStyle valued properties to also accept MaterialStateProperty<TextStyle> values. A material state text style property represents a text style which depends on a widget’s “interactive state”. This state is represented as a set of MaterialStates, like WidgetState::Pressed, WidgetState::Focused and WidgetState::Hovered.

MaterialStateTextStyle should only be used with widgets that document their support, like InputDecoration.labelStyle.

To use a MaterialStateTextStyle, use WidgetStateTextStyle::resolve_with and pass in a callback that will be used to resolve the color in the given states.

If a MaterialStateTextStyle is used for a property or a parameter that doesn’t support resolving MaterialStateProperty<TextStyle>s, then its default color value will be used for all states.

See also:

  • WidgetStateTextStyle, the non-Material version that can be used interchangeably with MaterialStateTextStyle.

Aliased Type§

pub struct MaterialStateTextStyle { /* private fields */ }