M3ESplitButton<T> constructor

const M3ESplitButton<T>({
  1. Key? key,
  2. required List<M3ESplitButtonItem<T>>? items,
  3. ValueChanged<T>? onSelected,
  4. VoidCallback? onPressed,
  5. String? label,
  6. IconData? leadingIcon,
  7. M3EButtonSize size = M3EButtonSize.sm,
  8. M3EButtonShape shape = M3EButtonShape.round,
  9. M3EButtonStyle style = M3EButtonStyle.filled,
  10. M3ESplitButtonTrailingAlignment trailingAlignment = M3ESplitButtonTrailingAlignment.opticalCenter,
  11. String? leadingTooltip,
  12. String? trailingTooltip,
  13. bool enabled = true,
  14. List<PopupMenuEntry<T>> menuBuilder(
    1. BuildContext
    )?,
  15. M3ESplitButtonDecoration? decoration,
  16. MouseCursor? mouseCursor,
  17. WidgetStatesController? statesController,
  18. FocusNode? focusNode,
  19. bool autofocus = false,
  20. ValueChanged<bool>? onFocusChange,
  21. T? selectedValue,
  22. void onMultiSelected(
    1. Set<T>
    )?,
  23. VoidCallback? onLongPress,
  24. ValueChanged<bool>? onHover,
  25. bool enableFeedback = _kDefaultEnableFeedback,
  26. InteractiveInkFeatureFactory? splashFactory,
})

const.

Implementation

const M3ESplitButton({
  super.key,
  required this.items,
  this.onSelected,
  this.onPressed,
  this.label,
  this.leadingIcon,
  this.size = M3EButtonSize.sm,
  this.shape = M3EButtonShape.round,
  this.style = M3EButtonStyle.filled,
  this.trailingAlignment = M3ESplitButtonTrailingAlignment.opticalCenter,
  this.leadingTooltip,
  this.trailingTooltip,
  this.enabled = true,
  this.menuBuilder,
  this.decoration,
  this.mouseCursor,
  this.statesController,
  this.focusNode,
  this.autofocus = false,
  this.onFocusChange,
  this.selectedValue,
  this.onMultiSelected,
  this.onLongPress,
  this.onHover,
  this.enableFeedback = _kDefaultEnableFeedback,
  this.splashFactory,
}) : assert(
       items != null || menuBuilder != null,
       'Provide either `items` or `menuBuilder`.',
     ),
     assert(
       style != M3EButtonStyle.text,
       'M3ESplitButton does not support M3EButtonStyle.text.',
     ),
     assert(
       !enabled ||
           onPressed != null ||
           onSelected != null ||
           menuBuilder != null,
       'Provide either onPressed, onSelected, or a custom menuBuilder when the split button is enabled.',
     );