M3EButton.icon constructor

M3EButton.icon({
  1. Key? key,
  2. required VoidCallback? onPressed,
  3. required Widget icon,
  4. required Widget label,
  5. M3EButtonStyle style = M3EButtonStyle.filled,
  6. M3EButtonSize size = M3EButtonSize.sm,
  7. M3EButtonShape shape = M3EButtonShape.round,
  8. bool enabled = true,
  9. WidgetStatesController? statesController,
  10. M3EButtonDecoration? decoration,
  11. FocusNode? focusNode,
  12. bool autofocus = false,
  13. ValueChanged<bool>? onFocusChange,
  14. String? semanticLabel,
  15. String? tooltip,
  16. MouseCursor mouseCursor = SystemMouseCursors.click,
  17. VoidCallback? onLongPress,
  18. ValueChanged<bool>? onHover,
  19. bool enableFeedback = _kDefaultEnableFeedback,
  20. InteractiveInkFeatureFactory? splashFactory,
})

Factory for a button with an icon and label.

Implementation

factory M3EButton.icon({
  Key? key,
  required VoidCallback? onPressed,
  required Widget icon,
  required Widget label,
  M3EButtonStyle style = M3EButtonStyle.filled,
  M3EButtonSize size = M3EButtonSize.sm,
  M3EButtonShape shape = M3EButtonShape.round,
  bool enabled = true,
  WidgetStatesController? statesController,
  M3EButtonDecoration? decoration,
  FocusNode? focusNode,
  bool autofocus = false,
  ValueChanged<bool>? onFocusChange,
  String? semanticLabel,
  String? tooltip,
  MouseCursor mouseCursor = SystemMouseCursors.click,
  VoidCallback? onLongPress,
  ValueChanged<bool>? onHover,
  bool enableFeedback = _kDefaultEnableFeedback,
  InteractiveInkFeatureFactory? splashFactory,
}) {
  return M3EButton(
    key: key,
    onPressed: onPressed,
    style: style,
    size: size,
    shape: shape,
    enabled: enabled,
    statesController: statesController,
    decoration: decoration,
    focusNode: focusNode,
    autofocus: autofocus,
    onFocusChange: onFocusChange,
    semanticLabel: semanticLabel,
    tooltip: tooltip,
    mouseCursor: mouseCursor,
    onLongPress: onLongPress,
    onHover: onHover,
    enableFeedback: enableFeedback,
    splashFactory: splashFactory,
    child: _M3EButtonIconLayout(
      icon: icon,
      label: label,
      size: size,
      iconAlignment: decoration?.iconAlignment ?? IconAlignment.start,
    ),
  );
}