Fluent2Button class

Fluent 2's Button: label in the size's type, an optional icon before it (after it with iconPosition Fluent2IconPosition.after), on the appearance's face at the shape's corner, stepping through its rest, hover and pressed colours. expand stretches it across its parent (a sheet's one act). Read as a button named label; null onPressed draws it disabled. Use one Fluent2ButtonAppearance.primary per view.

style restyles it slot by slot (fill, foreground, edge, overlay, side, shape, padding, minimumSize, textStyle, iconSize) over its appearance's component theme (Fluent2ThemeData.primaryButtonTheme and its siblings), then Fluent's own, moved by the theme's density.

Fluent2Button('Save', appearance: Fluent2ButtonAppearance.primary, icon: Fluent2Icons.save, onPressed: save)
Inheritance

Constructors

Fluent2Button(String label, {required VoidCallback? onPressed, Fluent2ButtonAppearance appearance = Fluent2ButtonAppearance.secondary, Fluent2ButtonSize size = Fluent2ButtonSize.medium, Fluent2ButtonShape? shape, IconData? icon, Fluent2IconPosition iconPosition = Fluent2IconPosition.before, bool expand = false, String? semanticLabel, Fluent2Style? style, FocusNode? focusNode, bool autofocus = false, Key? key})
A button labelled label that calls onPressed.
const

Properties

appearance → Fluent2ButtonAppearance
Fluent's appearance: which of its faces it wears.
final
autofocus → bool
Whether the control takes focus when it first builds.
final
expand → bool
Stretch across the parent's width.
final
focusNode → FocusNode?
The control's focus node; null makes and disposes its own.
final
hashCode → int
The hash code for this object.
no setterinherited
icon → IconData?
A glyph beside the words, on the side iconPosition says.
final
iconPosition → Fluent2IconPosition
Which side of the words icon stands on.
final
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
label → String
The words on its face.
final
onPressed → VoidCallback?
Called when it is pressed; null puts it out of use.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
semanticLabel → String?
What a screen reader says; null says label.
final
shape → Fluent2ButtonShape?
Fluent's corners; null leaves them to style, the theme and its shape scale, then Fluent2ButtonShape.rounded.
final
size → Fluent2ButtonSize
Fluent's size: how large it is drawn.
final
style → Fluent2Style?
This button's own look, slot by slot, over its theme's.
final

Methods

build(BuildContext context) → Widget
Describes the part of the user interface represented by this widget.
override
createElement() → StatelessElement
Creates a StatelessElement to manage this widget's location in the tree.
inherited
debugDescribeChildren() → List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent 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 DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) → String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String
Returns a one-line detailed description of the object.
inherited
toStringShort() → String
A short, textual description of this widget.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited