ArnaDropdownButton<T> constructor

ArnaDropdownButton<T>({
  1. Key? key,
  2. required List<ArnaDropdownMenuItem<T>>? items,
  3. T? value,
  4. Widget? hint,
  5. Widget? disabledHint,
  6. required ValueChanged<T?>? onChanged,
  7. VoidCallback? onTap,
  8. FocusNode? focusNode,
  9. bool autofocus = false,
  10. Color? accentColor,
  11. MouseCursor cursor = MouseCursor.defer,
  12. bool? enableFeedback,
})

Creates a dropdown button.

The items must have distinct values. If value isn't null then it must be equal to one of the ArnaDropdownMenuItem values. If items or onChanged is null, the button will be disabled.

If value is null and the button is enabled, hint will be displayed if it is non-null.

If value is null and the button is disabled, disabledHint will be displayed if it is non-null. If disabledHint is null, then hint will be displayed if it is non-null.

The boolean isExpanded arguments must not be null.

The autofocus argument must not be null.

Implementation

ArnaDropdownButton({
  super.key,
  required this.items,
  this.value,
  this.hint,
  this.disabledHint,
  required this.onChanged,
  this.onTap,
  this.focusNode,
  this.autofocus = false,
  this.accentColor,
  this.cursor = MouseCursor.defer,
  this.enableFeedback,
}) : assert(
        items == null ||
            items.isEmpty ||
            value == null ||
            items.where((ArnaDropdownMenuItem<T> item) {
                  return item.value == value;
                }).length ==
                1,
        "There should be exactly one item with [ArnaDropdownButton]'s value: "
        '$value. \n'
        'Either zero or 2 or more [ArnaDropdownButton]s were detected '
        'with the same value',
      );