CycleButton<T> class

A button that cycles through a list of values on each click.

Use style presets for cleaner code:

CycleButton(
  options: [CycleOption(value: 1, label: 'One'), ...],
  value: 1,
  style: ButtonStyle.outline,
)
Inheritance

Constructors

CycleButton({required List<CycleOption<T>> options, required T value, void onChanged(T value)?, ButtonStyle? style, ButtonSize size = ButtonSize.medium, bool disabled = false, Key? key})
const

Properties

disabled → bool
Whether the button is disabled
final
hashCode → int
The hash code for this object.
no setterinherited
key → Key?
Controls how one component replaces another component in the tree.
finalinherited
onChanged → void Function(T value)?
Callback when value changes
final
options → List<CycleOption<T>>
The available options
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
size → ButtonSize
Button size
final
style → ButtonStyle?
Button style preset (preferred)
final
value → T
The current value
final

Methods

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