FluentButtonStyle class

The visual configuration of a FluentButton.

Deliberately shaped like Material's ButtonStyle: every visual property is a WidgetStateProperty, so hover, pressed, selected and disabled values live on the property rather than being branched on at build time. A Flutter developer already knows how to read and override this.

Every field is nullable and means "inherit". Resolution order, lowest to highest precedence:

  1. the appearance/size defaults derived from the theme
  2. the nearest FluentButtonTheme
  3. the widget's own style

The consumer's own style therefore wins, matching upstream's rule that props.className is passed last to mergeClasses.

Annotations

Constructors

FluentButtonStyle({WidgetStateProperty<Color?>? backgroundColor, WidgetStateProperty<Color?>? foregroundColor, WidgetStateProperty<Color?>? borderColor, WidgetStateProperty<double?>? borderWidth, WidgetStateProperty<BorderRadius?>? borderRadius, WidgetStateProperty<TextStyle?>? textStyle, WidgetStateProperty<EdgeInsetsGeometry?>? padding, WidgetStateProperty<double?>? gap, WidgetStateProperty<double?>? iconSize, WidgetStateProperty<Size?>? minimumSize, WidgetStateProperty<MouseCursor?>? mouseCursor})
Creates a style. Omitted properties inherit.
const

Properties

backgroundColor WidgetStateProperty<Color?>?
Surface fill.
final
borderColor WidgetStateProperty<Color?>?
Border colour. Null and transparent are different: Fluent's transparentStroke becomes opaque in high contrast.
final
borderRadius WidgetStateProperty<BorderRadius?>?
Corner radius.
final
borderWidth WidgetStateProperty<double?>?
Border width. Zero means no border, which is not the same as a transparent one — a zero-width border cannot become visible in high contrast.
final
foregroundColor WidgetStateProperty<Color?>?
Label and icon colour.
final
gap WidgetStateProperty<double?>?
Space between icon and label.
final
hashCode int
The hash code for this object.
no setteroverride
iconSize WidgetStateProperty<double?>?
Icon edge length.
final
minimumSize WidgetStateProperty<Size?>?
Minimum tap target.
final
mouseCursor WidgetStateProperty<MouseCursor?>?
Cursor while hovering.
final
padding WidgetStateProperty<EdgeInsetsGeometry?>?
Padding inside the border.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
textStyle WidgetStateProperty<TextStyle?>?
Label text style. Its colour is overridden by foregroundColor.
final

Methods

copyWith({WidgetStateProperty<Color?>? backgroundColor, WidgetStateProperty<Color?>? foregroundColor, WidgetStateProperty<Color?>? borderColor, WidgetStateProperty<double?>? borderWidth, WidgetStateProperty<BorderRadius?>? borderRadius, WidgetStateProperty<TextStyle?>? textStyle, WidgetStateProperty<EdgeInsetsGeometry?>? padding, WidgetStateProperty<double?>? gap, WidgetStateProperty<double?>? iconSize, WidgetStateProperty<Size?>? minimumSize, WidgetStateProperty<MouseCursor?>? mouseCursor}) FluentButtonStyle
This style with the given properties replaced.
merge(FluentButtonStyle? other) FluentButtonStyle
This style with the non-null properties of other layered on top.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
override

Static Methods

from({Color? backgroundColor, Color? foregroundColor, Color? borderColor, double? borderWidth, BorderRadius? borderRadius, TextStyle? textStyle, EdgeInsetsGeometry? padding, double? gap, double? iconSize, Size? minimumSize, MouseCursor? mouseCursor}) FluentButtonStyle
Convenience for the common case of one value across every state.