ContextMenuButton<T>.icon constructor

ContextMenuButton<T>.icon(
  1. IconData icon, {
  2. Key? key,
  3. String? tooltip,
  4. double? size,
  5. EdgeInsets? padding,
  6. FocusNode? focusNode,
  7. bool canRequestFocus = true,
  8. bool autofocus = false,
  9. bool willChangeState = false,
  10. VoidCallback? onLongPress,
  11. ButtonThemeData? theme,
  12. T? value,
  13. ContextMenuCanceled? onCanceled,
  14. required ContextMenuItemSelected<T>? onSelected,
  15. required ContextMenuItemBuilder<T> itemBuilder,
})

Creates a button with a icon.

Implementation

factory ContextMenuButton.icon(
  IconData icon, {
  Key? key,
  String? tooltip,
  double? size,
  EdgeInsets? padding,
  FocusNode? focusNode,
  bool canRequestFocus = true,
  bool autofocus = false,
  bool willChangeState = false,
  VoidCallback? onLongPress,
  ButtonThemeData? theme,
  T? value,
  ContextMenuCanceled? onCanceled,
  required ContextMenuItemSelected<T>? onSelected,
  required ContextMenuItemBuilder<T> itemBuilder,
}) {
  return ContextMenuButton(
    key: key,
    padding: padding,
    bodyPadding: padding != null ? EdgeInsets.zero : null,
    tooltip: tooltip,
    onLongPress: onLongPress,
    focusNode: focusNode,
    canRequestFocus: canRequestFocus,
    autofocus: autofocus,
    willChangeState: willChangeState,
    enableAnimation: true,
    filled: false,
    theme: theme,
    value: value,
    itemBuilder: itemBuilder,
    onCanceled: onCanceled,
    onSelected: onSelected,
    body: Icon(icon, size: size),
  );
}