pub struct ButtonStyle {Show 18 fields
pub text_style: Option<WidgetStateProperty<TextStyle>>,
pub background_color: Option<WidgetStateProperty<Color>>,
pub foreground_color: Option<WidgetStateProperty<Color>>,
pub overlay_color: Option<WidgetStateProperty<Color>>,
pub shadow_color: Option<WidgetStateProperty<Color>>,
pub elevation: Option<WidgetStateProperty<f32>>,
pub padding: Option<WidgetStateProperty<Insets>>,
pub minimum_size: Option<WidgetStateProperty<Size>>,
pub fixed_size: Option<WidgetStateProperty<Size>>,
pub maximum_size: Option<WidgetStateProperty<Size>>,
pub icon_color: Option<WidgetStateProperty<Color>>,
pub icon_size: Option<WidgetStateProperty<f32>>,
pub side: Option<WidgetStateProperty<BorderSide>>,
pub shape: Option<WidgetStateProperty<ShapeBorder>>,
pub visual_density: Option<VisualDensity>,
pub tap_target: Option<TapTarget>,
pub alignment: Option<Alignment>,
pub icon_alignment: Option<IconAlignment>,
}Expand description
How a button looks in each state — the reference’s ButtonStyle
(material/button_style.dart).
Every field is optional: what is unset falls through to the theme’s style for that
kind of button (ButtonTheme), then to the reference’s defaults.
A WidgetStateProperty that has no answer for a state falls through the same way,
so a style that only says what a button looks like while enabled keeps the default
disabled look.
Fields§
§text_style: Option<WidgetStateProperty<TextStyle>>The label’s type; its colour is the foreground’s.
background_color: Option<WidgetStateProperty<Color>>The surface.
foreground_color: Option<WidgetStateProperty<Color>>The label’s colour, and the icon’s unless icon_color says otherwise.
overlay_color: Option<WidgetStateProperty<Color>>The highlight under a pointer or the keyboard’s focus, and the ripple of a press.
shadow_color: Option<WidgetStateProperty<Color>>The shadow’s colour.
elevation: Option<WidgetStateProperty<f32>>How far it sits off the surface.
padding: Option<WidgetStateProperty<Insets>>The room between the edge and the content.
minimum_size: Option<WidgetStateProperty<Size>>The smallest it is, before the visual density.
fixed_size: Option<WidgetStateProperty<Size>>The size it is, within the minimum and maximum. An infinite side is left free.
maximum_size: Option<WidgetStateProperty<Size>>The largest it is.
icon_color: Option<WidgetStateProperty<Color>>The icon’s colour.
icon_size: Option<WidgetStateProperty<f32>>The icon’s side.
side: Option<WidgetStateProperty<BorderSide>>The outline.
shape: Option<WidgetStateProperty<ShapeBorder>>The shape.
visual_density: Option<VisualDensity>How compact it is. Unset, the theme’s.
tap_target: Option<TapTarget>How much room it reserves for a finger. Unset, the theme’s.
alignment: Option<Alignment>Where the content sits inside it.
icon_alignment: Option<IconAlignment>Which side of the label an icon goes.
Implementations§
Source§impl ButtonStyle
impl ButtonStyle
Sourcepub fn background_color(self, property: WidgetStateProperty<Color>) -> Self
pub fn background_color(self, property: WidgetStateProperty<Color>) -> Self
The same, its surface property.
Sourcepub fn foreground_color(self, property: WidgetStateProperty<Color>) -> Self
pub fn foreground_color(self, property: WidgetStateProperty<Color>) -> Self
The same, its label property.
Sourcepub fn overlay_color(self, property: WidgetStateProperty<Color>) -> Self
pub fn overlay_color(self, property: WidgetStateProperty<Color>) -> Self
The same, its highlight and ripple property.
Sourcepub fn elevation(self, property: WidgetStateProperty<f32>) -> Self
pub fn elevation(self, property: WidgetStateProperty<f32>) -> Self
The same, its elevation property.
Sourcepub fn padding(self, property: WidgetStateProperty<Insets>) -> Self
pub fn padding(self, property: WidgetStateProperty<Insets>) -> Self
The same, its padding property.
Sourcepub fn minimum_size(self, size: Size) -> Self
pub fn minimum_size(self, size: Size) -> Self
The same, at least size.
Sourcepub fn fixed_size(self, size: Size) -> Self
pub fn fixed_size(self, size: Size) -> Self
The same, size exactly where it is finite.
Sourcepub fn maximum_size(self, size: Size) -> Self
pub fn maximum_size(self, size: Size) -> Self
The same, at most size.
Sourcepub fn side(self, property: WidgetStateProperty<BorderSide>) -> Self
pub fn side(self, property: WidgetStateProperty<BorderSide>) -> Self
The same, its outline property.
Sourcepub fn shape(self, shape: ShapeBorder) -> Self
pub fn shape(self, shape: ShapeBorder) -> Self
The same, shaped shape in every state.
Sourcepub fn icon_color(self, property: WidgetStateProperty<Color>) -> Self
pub fn icon_color(self, property: WidgetStateProperty<Color>) -> Self
The same, its icon property.
Sourcepub fn text_style(self, style: TextStyle) -> Self
pub fn text_style(self, style: TextStyle) -> Self
The same, its label in style.
Sourcepub fn visual_density(self, density: VisualDensity) -> Self
pub fn visual_density(self, density: VisualDensity) -> Self
The same, at density.
Sourcepub fn tap_target(self, target: TapTarget) -> Self
pub fn tap_target(self, target: TapTarget) -> Self
The same, reserving target for a finger.
Sourcepub fn icon_alignment(self, alignment: IconAlignment) -> Self
pub fn icon_alignment(self, alignment: IconAlignment) -> Self
The same, its icon on the alignment side.