FButton constructor

FButton({
  1. required VoidCallback? onPress,
  2. required Widget child,
  3. FBaseButtonStyle style(
    1. FButtonStyle
    ) = _primary,
  4. VoidCallback? onLongPress,
  5. VoidCallback? onSecondaryPress,
  6. VoidCallback? onSecondaryLongPress,
  7. bool autofocus = false,
  8. FocusNode? focusNode,
  9. ValueChanged<bool>? onFocusChange,
  10. ValueChanged<bool>? onHoverChange,
  11. ValueChanged<Set<WidgetState>>? onStateChange,
  12. bool selected = false,
  13. Map<ShortcutActivator, Intent>? shortcuts,
  14. Map<Type, Action<Intent>>? actions,
  15. MainAxisSize mainAxisSize = MainAxisSize.max,
  16. MainAxisAlignment mainAxisAlignment = MainAxisAlignment.center,
  17. CrossAxisAlignment crossAxisAlignment = CrossAxisAlignment.center,
  18. TextBaseline? textBaseline,
  19. Widget? prefix,
  20. Widget? suffix,
  21. Key? key,
})

Creates a FButton that contains a prefix, child, and suffix.

mainAxisSize determines how the button's width is sized.

mainAxisAlignment and crossAxisAlignment determine how the button's content is aligned horizontally and vertically, respectively.

textBaseline is used to align the prefix, child and suffix if crossAxisAlignment is CrossAxisAlignment.baseline.

prefix and suffix are wrapped in IconThemeData.

The button layout is as follows, assuming the locale is LTR:

|---------------------------------------|
|  [prefix]  [child]  [suffix]  |
|---------------------------------------|

The layout is reversed for RTL locales.

Implementation

FButton({
  required this.onPress,
  required Widget child,
  this.style = _primary,
  this.onLongPress,
  this.onSecondaryPress,
  this.onSecondaryLongPress,
  this.autofocus = false,
  this.focusNode,
  this.onFocusChange,
  this.onHoverChange,
  this.onStateChange,
  this.selected = false,
  this.shortcuts,
  this.actions,
  MainAxisSize mainAxisSize = MainAxisSize.max,
  MainAxisAlignment mainAxisAlignment = MainAxisAlignment.center,
  CrossAxisAlignment crossAxisAlignment = CrossAxisAlignment.center,
  TextBaseline? textBaseline,
  Widget? prefix,
  Widget? suffix,
  super.key,
}) : child = Content(
       mainAxisSize: mainAxisSize,
       mainAxisAlignment: mainAxisAlignment,
       crossAxisAlignment: crossAxisAlignment,
       textBaseline: textBaseline,
       prefix: prefix,
       suffix: suffix,
       child: child,
     );