FButton constructor
FButton({
- required VoidCallback? onPress,
- required Widget child,
- FBaseButtonStyle style() = _primary,
- VoidCallback? onLongPress,
- VoidCallback? onSecondaryPress,
- VoidCallback? onSecondaryLongPress,
- bool autofocus = false,
- FocusNode? focusNode,
- ValueChanged<
bool> ? onFocusChange, - ValueChanged<
bool> ? onHoverChange, - ValueChanged<
Set< ? onStateChange,WidgetState> > - bool selected = false,
- Map<
ShortcutActivator, Intent> ? shortcuts, - Map<
Type, Action< ? actions,Intent> > - MainAxisSize mainAxisSize = MainAxisSize.max,
- MainAxisAlignment mainAxisAlignment = MainAxisAlignment.center,
- CrossAxisAlignment crossAxisAlignment = CrossAxisAlignment.center,
- TextBaseline? textBaseline,
- Widget? prefix,
- Widget? suffix,
- 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,
);