BeuiActionSwapButton class

A button that cycles through items, swapping its label and icon with a BeuiActionSwapVariant transition on each tap — the Flutter port of the source's ActionSwapButton.

Controlled + uncontrolled, mirroring the source: pass value + onChanged to control it, or omit value for internal state seeded from defaultValue. With cycle on (default) each tap advances to the next item and wraps. It is a standalone pressable (the source's ActionSwapButton is its own motion.button, not the base button): press feedback scales to 0.97 on the beuiSpringPress token (source whileTap={{ scale: 0.97 }}) with no hover lift, and its geometry mirrors the source SIZE_CLASS (icon = 40px).

Inheritance

Constructors

BeuiActionSwapButton({required List<BeuiActionSwapItem> items, String? value, String? defaultValue, void onChanged(String id, BeuiActionSwapItem item)?, BeuiButtonVariant variant = BeuiButtonVariant.secondary, BeuiButtonSize size = BeuiButtonSize.md, BeuiActionSwapVariant animation = BeuiActionSwapVariant.blur, bool iconOnly = false, bool cycle = true, VoidCallback? onPressed, Key? key})
Creates an action-swap button.
const

Properties

animation → BeuiActionSwapVariant
The swap transition.
final
cycle → bool
Advance to the next item on tap and wrap around. Off makes the button a pure display surface (drive it via value instead).
final
defaultValue → String?
Initial active id when uncontrolled. Defaults to the first item.
final
hashCode → int
The hash code for this object.
no setterinherited
iconOnly → bool
Show only the icon (no label). Defaults to true for BeuiButtonSize.icon.
final
items → List<BeuiActionSwapItem>
The items to cycle through. Must be non-empty.
final
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
onChanged → void Function(String id, BeuiActionSwapItem item)?
Called with the next id (and item) when the button advances.
final
onPressed → VoidCallback?
Extra tap callback, fired in addition to the cycle advance.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
size → BeuiButtonSize
Size (BeuiButtonSize). Drives the source SIZE_CLASS geometry.
final
value → String?
Active item id (controlled). When null the button is uncontrolled.
final
variant → BeuiButtonVariant
Visual style (BeuiButtonVariant).
final

Methods

createElement() → StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() → State<BeuiActionSwapButton>
Creates the mutable state for this widget at a given location in the tree.
override
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.
inherited
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