Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class MultiSelectContainer<T> extends StatefulWidget {
this.splashColor,
this.highlightColor,
this.controller, this.singleSelectedItem = false,
this.onLongPress,
}) : super(key: key);

/// [MultiSelectCard] List for the multi select container.
Expand Down Expand Up @@ -93,6 +94,9 @@ class MultiSelectContainer<T> extends StatefulWidget {
/// Call when item is selected.
final void Function(List<T> selectedItems, T selectedItem) onChange;

/// Call when item is long-pressed.
final void Function(T item)? onLongPress;

@override
_SimpleMultiSelectContainerState createState() =>
_SimpleMultiSelectContainerState<T>();
Expand Down Expand Up @@ -318,6 +322,14 @@ class _SimpleMultiSelectContainerState<T>
child: InkWell(
splashColor: item.splashColor ?? widget.splashColor,
highlightColor: item.highlightColor ?? widget.highlightColor,
onLongPress: (item.enabled == false)
? null
: () {
var fn = widget.onLongPress;
if (fn != null) {
fn(item.value);
}
},
onTap: item.enabled == false
? null
: () {
Expand Down