defaultSelectionIndicatorBuilder static method

Widget Function(bool multiple, bool isSelected, bool isDisabled) defaultSelectionIndicatorBuilder(
  1. ColorScheme colors
)

Implementation

static Widget Function(bool multiple, bool isSelected, bool isDisabled) defaultSelectionIndicatorBuilder(ColorScheme colors) {
  return (multiple, isSelected, isDisabled) {
    final color = isDisabled
        ? colors.onSurface.o(0.38)
        : isSelected
            ? colors.primary
            : colors.onSurfaceVariant;

    if (multiple) {
      return Padding(
        padding: const EdgeInsets.only(right: 8.0),
        child: Icon(isSelected ? Icons.check_box : Icons.check_box_outline_blank, size: 18, color: color),
      );
    }

    if (isSelected) {
      return Padding(
        padding: const EdgeInsets.only(right: 8.0),
        child: Icon(Icons.check, size: 18, color: color),
      );
    }

    return const SizedBox.shrink();
  };
}