FButton.icon constructor

FButton.icon({
  1. required VoidCallback? onPress,
  2. FButtonVariant variant = .outline,
  3. FButtonSizeVariant size = .md,
  4. FButtonStyleDelta style = const .context(),
  5. VoidCallback? onLongPress,
  6. VoidCallback? onDoubleTap,
  7. VoidCallback? onSecondaryPress,
  8. VoidCallback? onSecondaryLongPress,
  9. bool autofocus = false,
  10. FocusNode? focusNode,
  11. ValueChanged<bool>? onFocusChange,
  12. ValueChanged<bool>? onHoverChange,
  13. FTappableVariantChangeCallback? onVariantChange,
  14. bool selected = false,
  15. Map<ShortcutActivator, Intent>? shortcuts,
  16. Map<Type, Action<Intent>>? actions,
  17. FButtonIconContentBuilder builder = defaultIconContentBuilder,
  18. Widget? child,
  19. Key? key,
})

Creates a FButton that contains only an icon.

child is wrapped in IconThemeData.

builder exposes the resolved FButtonStyle and icon style. When child is provided, it is passed to the builder as its child argument. The builder defaults to defaultIconContentBuilder which returns child unchanged. At least one of child or a custom builder must be provided.

Implementation

FButton.icon({
  required this.onPress,
  this.variant = .outline,
  this.size = .md,
  this.style = const .context(),
  this.onLongPress,
  this.onDoubleTap,
  this.onSecondaryPress,
  this.onSecondaryLongPress,
  this.autofocus = false,
  this.focusNode,
  this.onFocusChange,
  this.onHoverChange,
  this.onVariantChange,
  this.selected = false,
  this.shortcuts,
  this.actions,
  FButtonIconContentBuilder builder = defaultIconContentBuilder,
  Widget? child,
  super.key,
}) : assert(builder != defaultIconContentBuilder || child != null, 'Either builder or a child must be provided.'),
     child = IconContent(builder: builder, child: child);