filteredProperties method

  1. @protected
  2. @optionalTypeArgs
ItemProperties<T> filteredProperties(
  1. Iterable<T> filtered,
  2. BuildContext context,
  3. int index
)

Creates ItemProperties for an item at the specified index using the provided filtered items and context.

The filtered parameter is an iterable of items that have been filtered based on the current configuration. The context parameter is the build context for the item.

Implementation

@protected
@optionalTypeArgs
ItemProperties<T> filteredProperties(
  Iterable<T> filtered,
  BuildContext context,
  int index,
) {
  final sortedItems = sort != null
      ? List<T>.unmodifiable(filtered.toList(growable: false)..sort(sort))
      : filtered;
  final item = sortedItems.elementAt(index);
  final isChosen = chosen?.contains(item) ?? false;
  final isDisabled = disabled?.contains(item) ?? false;

  return ItemProperties(
    context,
    item,
    index: index,
    isChosen: isChosen,
    isDisabled: isDisabled,
  );
}