FTappable class

An area that responds to touch.

It is typically used to create other high-level widgets, i.e., FButton. Unless you are creating a custom widget, you should use those high-level widgets instead.

Why do tappables inside OverlayPortals sometimes not respond to taps?

Wrap the overlay content in FTappableGroup.isolate.

This is probably caused by the OverlayPortal being wrapped in an FTappableGroup. Since an OverlayPortal reparents inherited widgets, the FTappables are registered with the ancestor FTappableGroup which does not hit test across rendering layers.

FPortal-based widgets handle this automatically.

Inheritance

Constructors

FTappable({FTappableStyleDelta style, FFocusedOutlineStyleDelta? focusedOutlineStyle, String? semanticsLabel, bool excludeSemantics, bool autofocus, FocusNode? focusNode, ValueChanged<bool>? onFocusChange, ValueChanged<bool>? onHoverChange, FTappableVariantChangeCallback? onVariantChange, bool selected, HitTestBehavior behavior, GestureTapDownCallback? onPressDown, GestureTapCancelCallback? onPressCancel, GestureTapMoveCallback? onPressMove, GestureTapUpCallback? onPressUp, VoidCallback? onPress, GestureLongPressDownCallback? onLongPressDown, GestureLongPressCancelCallback? onLongPressCancel, GestureLongPressStartCallback? onLongPressStart, GestureLongPressMoveUpdateCallback? onLongPressMove, GestureLongPressEndCallback? onLongPressEnd, VoidCallback? onLongPress, GestureTapDownCallback? onDoubleTapDown, GestureTapCancelCallback? onDoubleTapCancel, VoidCallback? onDoubleTap, GestureTapDownCallback? onSecondaryPressDown, GestureTapCancelCallback? onSecondaryPressCancel, GestureTapUpCallback? onSecondaryPressUp, VoidCallback? onSecondaryPress, GestureLongPressDownCallback? onSecondaryLongPressDown, GestureLongPressCancelCallback? onSecondaryLongPressCancel, GestureLongPressStartCallback? onSecondaryLongPressStart, GestureLongPressMoveUpdateCallback? onSecondaryLongPressMove, GestureLongPressEndCallback? onSecondaryLongPressEnd, VoidCallback? onSecondaryLongPress, Map<ShortcutActivator, Intent>? shortcuts, Map<Type, Action<Intent>>? actions, ValueWidgetBuilder<Set<FTappableVariant>> builder, Widget? child, Key? key})
Creates an FTappable.
const
factory
FTappable.static({FTappableStyleDelta style = const .context(), FFocusedOutlineStyleDelta? focusedOutlineStyle, String? semanticsLabel, bool excludeSemantics = false, bool autofocus = false, FocusNode? focusNode, ValueChanged<bool>? onFocusChange, ValueChanged<bool>? onHoverChange, FTappableVariantChangeCallback? onVariantChange, bool selected = false, HitTestBehavior behavior = .translucent, GestureTapDownCallback? onPressDown, GestureTapCancelCallback? onPressCancel, GestureTapMoveCallback? onPressMove, GestureTapUpCallback? onPressUp, VoidCallback? onPress, GestureLongPressDownCallback? onLongPressDown, GestureLongPressCancelCallback? onLongPressCancel, GestureLongPressStartCallback? onLongPressStart, GestureLongPressMoveUpdateCallback? onLongPressMove, GestureLongPressEndCallback? onLongPressEnd, VoidCallback? onLongPress, GestureTapDownCallback? onDoubleTapDown, GestureTapCancelCallback? onDoubleTapCancel, VoidCallback? onDoubleTap, GestureTapDownCallback? onSecondaryPressDown, GestureTapCancelCallback? onSecondaryPressCancel, GestureTapUpCallback? onSecondaryPressUp, VoidCallback? onSecondaryPress, GestureLongPressDownCallback? onSecondaryLongPressDown, GestureLongPressCancelCallback? onSecondaryLongPressCancel, GestureLongPressStartCallback? onSecondaryLongPressStart, GestureLongPressMoveUpdateCallback? onSecondaryLongPressMove, GestureLongPressEndCallback? onSecondaryLongPressEnd, VoidCallback? onSecondaryLongPress, Map<Type, Action<Intent>>? actions, ValueWidgetBuilder<Set<FTappableVariant>> builder = defaultBuilder, Widget? child, Map<ShortcutActivator, Intent>? shortcuts, Key? key})
Creates a FTappable without animation.
const

Properties

actions Map<Type, Action<Intent>>?
The actions. Defaults to calling onPress when ActivateIntent is invoked and onPress is not null.
final
autofocus bool
True if this widget will be selected as the initial focus when no other node in its scope is currently focused.
final
behavior HitTestBehavior
The tappable's hit test behavior. Defaults to HitTestBehavior.translucent.
final
builder ValueWidgetBuilder<Set<FTappableVariant>>
The builder used to create a child with the current variants.
final
child Widget?
An optional child.
final
excludeSemantics bool
Whether to replace all child semantics with this node. Defaults to false.
final
focusedOutlineStyle FFocusedOutlineStyleDelta?
The style used when the tappable is focused. This tappable will not be outlined if null.
final
focusNode FocusNode?
An optional focus node to use as the focus node for this widget.
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
onDoubleTap VoidCallback?
A callback for when the widget is double tapped.
final
onDoubleTapCancel GestureTapCancelCallback?
A callback for when the pointer that previously triggered onDoubleTapDown will not end up causing a double tap.
final
onDoubleTapDown GestureTapDownCallback?
A callback for when a pointer that might cause a double tap has contacted the widget.
final
onFocusChange ValueChanged<bool>?
Handler called when the focus changes.
final
onHoverChange ValueChanged<bool>?
Handler called when the hover changes.
final
onLongPress VoidCallback?
A callback for when the widget is long pressed.
final
onLongPressCancel GestureLongPressCancelCallback?
A callback for when the pointer that previously triggered onLongPressDown will not end up causing a long press.
final
onLongPressDown GestureLongPressDownCallback?
A callback for when a primary pointer that might cause a long press has contacted the widget.
final
onLongPressEnd GestureLongPressEndCallback?
A callback for when a long press recognised by a primary pointer is ending.
final
onLongPressMove GestureLongPressMoveUpdateCallback?
A callback for when a primary pointer is moving after being recognised as a long press.
final
onLongPressStart GestureLongPressStartCallback?
A callback for when a long press has been recognised by a primary pointer.
final
onPress VoidCallback?
A callback for when the widget is pressed.
final
onPressCancel GestureTapCancelCallback?
A callback for when a primary pointer that previously triggered onPressDown will not end up causing a tap.
final
onPressDown GestureTapDownCallback?
A callback for when a primary pointer initially contacts the widget.
final
onPressMove GestureTapMoveCallback?
A callback for when a primary pointer that triggered a tap has moved.
final
onPressUp GestureTapUpCallback?
A callback for when a primary pointer that previously triggered onPressDown stops contacting the widget at the same location it initially contacted.
final
onSecondaryLongPress VoidCallback?
A callback for when the widget is pressed with a secondary button (usually right-click on desktop).
final
onSecondaryLongPressCancel GestureLongPressCancelCallback?
A callback for when the pointer that previously triggered onSecondaryLongPressDown will not end up causing a long press.
final
onSecondaryLongPressDown GestureLongPressDownCallback?
A callback for when a secondary pointer that might cause a long press has contacted the widget.
final
onSecondaryLongPressEnd GestureLongPressEndCallback?
A callback for when a long press recognised by a secondary pointer is ending.
final
onSecondaryLongPressMove GestureLongPressMoveUpdateCallback?
A callback for when a secondary pointer is moving after being recognised as a long press.
final
onSecondaryLongPressStart GestureLongPressStartCallback?
A callback for when a long press has been recognised by a secondary pointer.
final
onSecondaryPress VoidCallback?
A callback for when the widget is pressed with a secondary button (usually right-click on desktop).
final
onSecondaryPressCancel GestureTapCancelCallback?
A callback for when a secondary pointer that previously triggered onSecondaryPressDown will not end up causing a tap.
final
onSecondaryPressDown GestureTapDownCallback?
A callback for when a secondary pointer initially contacts the widget.
final
onSecondaryPressUp GestureTapUpCallback?
A callback for when a secondary pointer that previously triggered onSecondaryPressDown stops contacting the widget.
final
onVariantChange FTappableVariantChangeCallback?
Handler called when there are any changes to a tappable's FTappableVariants.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
selected bool
True if this tappable is currently selected. Defaults to false.
final
semanticsLabel String?
The semantic label used by accessibility frameworks.
final
shortcuts Map<ShortcutActivator, Intent>
The shortcuts. Defaults to calling ActivateIntent if onPress is not null.
final
style FTappableStyleDelta
The style.
final

Methods

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

Static Methods

defaultBuilder(BuildContext _, Set<FTappableVariant> _, Widget? child) Widget
The default builder that returns the child as-is.