custom-dropdown icon indicating copy to clipboard operation
custom-dropdown copied to clipboard

All controllers missing select value method

Open Paroca72 opened this issue 9 months ago • 0 comments

Hello,

All controllers missing SelectValue method.

part of '../custom_dropdown.dart';

class SingleSelectController<T> extends ValueNotifier<T?> {
  SingleSelectController(super._value);

  void clear() {
    value = null;
  }

  bool get hasValue => value != null;
}

class MultiSelectController<T> extends ValueNotifier<List<T>> {
  MultiSelectController(super.value);

  void add(T valueToAdd) {
    value = [...value, valueToAdd];
  }

  void remove(T valueToRemove) {
    value = value.where((value) => value != valueToRemove).toList();
  }

  void clear() {
    value = [];
  }

  bool get hasValues => value.isNotEmpty;
}

Thanks for your support

Paroca72 avatar Jan 15 '25 08:01 Paroca72