Clickable constructor

const Clickable({
  1. Key? key,
  2. required Widget child,
  3. WidgetStatesController? statesController,
  4. bool enabled = true,
  5. WidgetStateProperty<Decoration?>? decoration,
  6. WidgetStateProperty<MouseCursor?>? mouseCursor,
  7. WidgetStateProperty<EdgeInsetsGeometry?>? padding,
  8. WidgetStateProperty<TextStyle?>? textStyle,
  9. WidgetStateProperty<IconThemeData?>? iconTheme,
  10. VoidCallback? onPressed,
  11. FocusNode? focusNode,
  12. HitTestBehavior behavior = HitTestBehavior.translucent,
  13. ValueChanged<bool>? onHover,
  14. ValueChanged<bool>? onFocus,
  15. bool disableTransition = false,
  16. bool disableHoverEffect = false,
  17. WidgetStateProperty<EdgeInsetsGeometry?>? margin,
  18. VoidCallback? onDoubleTap,
  19. Map<LogicalKeySet, Intent>? shortcuts,
  20. Map<Type, Action<Intent>>? actions,
  21. bool focusOutline = true,
  22. bool enableFeedback = true,
  23. WidgetStateProperty<Matrix4?>? transform,
  24. VoidCallback? onLongPress,
  25. GestureTapDownCallback? onTapDown,
  26. GestureTapUpCallback? onTapUp,
  27. GestureTapCancelCallback? onTapCancel,
  28. GestureTapDownCallback? onSecondaryTapDown,
  29. GestureTapUpCallback? onSecondaryTapUp,
  30. GestureTapCancelCallback? onSecondaryTapCancel,
  31. GestureTapDownCallback? onTertiaryTapDown,
  32. GestureTapUpCallback? onTertiaryTapUp,
  33. GestureTapCancelCallback? onTertiaryTapCancel,
  34. GestureLongPressStartCallback? onLongPressStart,
  35. GestureLongPressUpCallback? onLongPressUp,
  36. GestureLongPressMoveUpdateCallback? onLongPressMoveUpdate,
  37. GestureLongPressEndCallback? onLongPressEnd,
  38. GestureLongPressUpCallback? onSecondaryLongPress,
  39. GestureLongPressUpCallback? onTertiaryLongPress,
  40. AlignmentGeometry? marginAlignment,
  41. bool disableFocusOutline = false,
})

Creates a Clickable widget.

A clickable area with state-dependent styling and comprehensive gesture support.

Parameters:

  • child (required): The widget to display and make clickable
  • enabled: Whether the widget is enabled. Defaults to true
  • onPressed: Primary tap callback. If null, widget is disabled
  • decoration, mouseCursor, padding, textStyle, iconTheme, margin, transform: State-dependent property functions for styling
  • focusNode: Optional focus node for keyboard focus management
  • behavior: Hit test behavior. Defaults to HitTestBehavior.translucent
  • onHover, onFocus: State change callbacks
  • disableTransition: If true, disables animation transitions. Defaults to false
  • disableHoverEffect: If true, disables hover visual effects. Defaults to false
  • onDoubleTap: Double tap callback
  • shortcuts, actions: Keyboard shortcuts and actions
  • focusOutline: Whether to show focus outline. Defaults to true
  • enableFeedback: Whether to enable haptic/audio feedback. Defaults to true
  • onTapDown, onTapUp, onTapCancel: Primary tap gesture callbacks
  • onSecondaryTapDown, onSecondaryTapUp, onSecondaryTapCancel: Secondary tap callbacks
  • onTertiaryTapDown, onTertiaryTapUp, onTertiaryTapCancel: Tertiary tap callbacks
  • onLongPress, onLongPressStart, onLongPressUp, onLongPressMoveUpdate, onLongPressEnd: Long press gesture callbacks
  • onSecondaryLongPress, onTertiaryLongPress: Secondary and tertiary long press callbacks
  • statesController: Optional controller for programmatic state management
  • marginAlignment: Alignment for applying margin
  • disableFocusOutline: Whether to disable the focus outline. Defaults to false

Implementation

const Clickable({
  super.key,
  required this.child,
  this.statesController,
  this.enabled = true,
  this.decoration,
  this.mouseCursor,
  this.padding,
  this.textStyle,
  this.iconTheme,
  this.onPressed,
  this.focusNode,
  this.behavior = HitTestBehavior.translucent,
  this.onHover,
  this.onFocus,
  this.disableTransition = false,
  this.disableHoverEffect = false,
  this.margin,
  this.onDoubleTap,
  this.shortcuts,
  this.actions,
  this.focusOutline = true,
  this.enableFeedback = true,
  this.transform,
  this.onLongPress,
  this.onTapDown,
  this.onTapUp,
  this.onTapCancel,
  this.onSecondaryTapDown,
  this.onSecondaryTapUp,
  this.onSecondaryTapCancel,
  this.onTertiaryTapDown,
  this.onTertiaryTapUp,
  this.onTertiaryTapCancel,
  this.onLongPressStart,
  this.onLongPressUp,
  this.onLongPressMoveUpdate,
  this.onLongPressEnd,
  this.onSecondaryLongPress,
  this.onTertiaryLongPress,
  this.marginAlignment,
  this.disableFocusOutline = false,
});