StreamButton class

A versatile button with support for multiple styles, types, and sizes.

StreamButton renders an arbitrary Widget as its child, optionally flanked by leading and/or trailing icons via iconLeft and iconRight. For a circular icon-only button, use the StreamButton.icon constructor.

The button adapts its appearance based on the combination of StreamButtonStyle, StreamButtonType, and interaction state (hover, pressed, disabled, selected). All visual states can be customized via StreamButtonTheme.

{@tool snippet}

Display a primary solid button:

StreamButton(
  onPressed: () => print('submitted'),
  child: const Text('Submit'),
)

{@end-tool}

{@tool snippet}

Display a button with a leading icon:

StreamButton(
  iconLeft: const Icon(Icons.add),
  onPressed: () => print('added'),
  child: const Text('Add'),
)

{@end-tool}

{@tool snippet}

Display a selectable ghost button:

StreamButton(
  style: StreamButtonStyle.secondary,
  type: StreamButtonType.ghost,
  isSelected: isActive,
  onPressed: () => toggleFilter(),
  child: const Text('Filter'),
)

{@end-tool}

See also:

Inheritance

Constructors

StreamButton({Key? key, required Widget child, VoidCallback? onPressed, VoidCallback? onLongPress, StreamButtonStyle style = .primary, StreamButtonType type = .solid, StreamButtonSize size = .medium, Widget? iconLeft, Widget? iconRight, bool? isFloating, bool? isSelected, bool autofocus = false, StreamButtonThemeStyle? themeStyle})
Creates a button that displays child, optionally flanked by leading and/or trailing icons (iconLeft and iconRight).
StreamButton.icon({Key? key, required Widget icon, VoidCallback? onPressed, VoidCallback? onLongPress, StreamButtonStyle style = .primary, StreamButtonType type = .solid, StreamButtonSize size = .medium, bool? isFloating, bool? isSelected, bool autofocus = false, String? tooltip, StreamButtonThemeStyle? themeStyle})
Creates a circular icon-only button that displays icon.

Properties

hashCode → int
The hash code for this object.
no setterinherited
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
props → StreamButtonProps
The props controlling the appearance and behavior of this button.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

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.
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