multi_select_flutter icon indicating copy to clipboard operation
multi_select_flutter copied to clipboard

Add maxSelectedItems and reverseActions support for MultiSelectDialogField

Open ingmferrer opened this issue 3 years ago • 0 comments

Overview:

Users may want to limit the selected items for some fields without using other package.

By default maxSelectedItems is null which means there is not selection limit.

This only add support for MultiSelectDialogField because is the field I use for my personal project.

Also some users may want to change the OK and CANCEL button order for the multi select dialog, so I introduced reverseActions which is false by default.

Example:

MultiSelectDialogField<T>(
    title: Text(title),
    buttonText: Text(
      buttonText,
      style: TextStyle(
        color: Colors.black54,
      ),
    ),
    initialValue: initialValue,
    items: items,
    listType: MultiSelectListType.CHIP,
    onConfirm: onConfirm,
    selectedItemsTextStyle: const TextStyle(
      color: kWhiteColor,
    ),
    selectedColor: kHempColor,
    buttonIcon: const Icon(
      Icons.edit,
      color: Colors.black54,
    ),
    maxSelectedItems: 1,
    reverseActions: true,
  )

How to test before is merge

Add to your pubspec.yaml

dependencies:
  flutter:
    sdk: flutter

  multi_select_flutter:
      git:
        url: https://github.com/ingmferrer/multi_select_flutter.git
        ref: master

ingmferrer avatar Feb 02 '23 20:02 ingmferrer