RTextButton class

A headless text button component.

This widget handles all button behavior (focus, keyboard, pointer input) but delegates visual rendering to a RButtonRenderer capability.

The renderer is obtained from HeadlessThemeProvider. If no renderer is available, a MissingCapabilityException is thrown with clear instructions on how to fix it.

Controlled/Uncontrolled

The button follows Flutter's standard patterns:

  • onPressed == null or disabled == true → button is disabled
  • Disabled state is reflected in semantics and prevents all interaction

Keyboard

  • Space: triggers onPressed on key up (standard button behavior)
  • Enter: triggers onPressed immediately (activation)

Activation Source (v1 policy)

The button has a single activation source: GestureDetector for pointer and Focus.onKeyEvent for keyboard.

Accessibility activation is component-owned as well: the widget exposes SemanticsAction.tap and maps it to onPressed.

Example

RTextButton(
  onPressed: () => print('Pressed!'),
  child: Text('Click me'),
)
Inheritance

Constructors

RTextButton({Key? key, required Widget child, VoidCallback? onPressed, bool disabled = false, RButtonVariant variant = RButtonVariant.outlined, RButtonSize size = RButtonSize.medium, RButtonStyle? style, String? semanticLabel, bool autofocus = false, FocusNode? focusNode, RButtonSlots? slots, RenderOverrides? overrides})
const

Properties

autofocus → bool
Whether the button should be focused initially.
final
child → Widget
The button's content (typically a Text widget).
final
disabled → bool
Whether the button is explicitly disabled.
final
focusNode → FocusNode?
Optional focus node for external focus management.
final
hashCode → int
The hash code for this object.
no setterinherited
isDisabled → bool
Whether the button is effectively disabled.
no setter
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
onPressed → VoidCallback?
Called when the button is activated.
final
overrides → RenderOverrides?
Per-instance override bag for preset customization.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
semanticLabel → String?
Semantic label for accessibility.
final
size → RButtonSize
Size variant of the button.
final
slots → RButtonSlots?
Optional visual slots for partial customization.
final
style → RButtonStyle?
Simple, Flutter-like styling sugar.
final
variant → RButtonVariant
Visual variant of the button.
final

Methods

createElement() → StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() → State<RTextButton>
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