MacosPulldownButton constructor

const MacosPulldownButton({
  1. Key? key,
  2. required List<MacosPulldownMenuEntry>? items,
  3. String? title,
  4. String? disabledTitle,
  5. IconData? icon,
  6. VoidCallback? onTap,
  7. TextStyle? style,
  8. double? itemHeight = _kMenuItemHeight,
  9. FocusNode? focusNode,
  10. bool autofocus = false,
  11. AlignmentGeometry alignment = AlignmentDirectional.centerStart,
  12. PulldownMenuAlignment menuAlignment = PulldownMenuAlignment.left,
})

Creates a macOS-style pull-down button.

If items is null, the button will be disabled, the down caret icon will be greyed out.

A title or an icon must be provided, to be displayed as the pull-down button's title, but not both at the same time.

If the button is disabled and icon is null, disabledTitle will be displayed if it is non-null. If disabledTitle is null, then title will be displayed if it is non-null.

The autofocus argument must not be null.

Implementation

const MacosPulldownButton({
  super.key,
  required this.items,
  this.title,
  this.disabledTitle,
  this.icon,
  this.onTap,
  this.style,
  this.itemHeight = _kMenuItemHeight,
  this.focusNode,
  this.autofocus = false,
  this.alignment = AlignmentDirectional.centerStart,
  this.menuAlignment = PulldownMenuAlignment.left,
})  : assert(itemHeight == null || itemHeight >= _kMenuItemHeight),
      assert(
          (title != null || icon != null) && !(title != null && icon != null),
          "There should be either a title or an icon argument provided, and not both at at the same time.");