CarpenterIconButton constructor

const CarpenterIconButton({
  1. Key? key,
  2. required CarpenterIconSource icon,
  3. required String semanticLabel,
  4. VoidCallback? onPressed,
  5. VoidCallback? onInvoke,
  6. VoidCallback? onLongPress,
  7. VoidCallback? onSecondaryTap,
  8. ActionColorRole colorRole = ActionColorRole.neutral,
  9. ActionProminence prominence = ActionProminence.normal,
  10. ControlSize size = ControlSize.medium,
  11. CarpenterShape shape = CarpenterShape.rounded,
  12. ActionExecutionPhase executionPhase = ActionExecutionPhase.idle,
  13. FocusNode? focusNode,
  14. bool autofocus = false,
  15. ShortcutActivator? shortcut,
  16. bool? toggled,
})

Creates an icon action with a required semanticLabel. Null callbacks disable it; supplying both onPressed and onInvoke is an assertion error.

Implementation

const CarpenterIconButton({
  super.key,
  required this.icon,
  required this.semanticLabel,
  this.onPressed,
  this.onInvoke,
  this.onLongPress,
  this.onSecondaryTap,
  this.colorRole = ActionColorRole.neutral,
  this.prominence = ActionProminence.normal,
  this.size = ControlSize.medium,
  this.shape = CarpenterShape.rounded,
  this.executionPhase = ActionExecutionPhase.idle,
  this.focusNode,
  this.autofocus = false,
  this.shortcut,
  this.toggled,
}) : _visible = true,
     _semanticHint = null,
     assert(
       onPressed == null || onInvoke == null,
       'Use either onPressed or the compatibility onInvoke callback, not both.',
     );