group static method
Implementation
static Widget group({
required List<String> options,
required List<String> selectedValues,
required ValueChanged<List<String>> onChanged,
bool isDisabled = false,
String? errorText,
}) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Wrap(
spacing: 12,
runSpacing: 8,
children: options.map((option) {
final isSelected = selectedValues.contains(option);
return UiCheckbox(
label: option,
value: isSelected,
isDisabled: isDisabled,
onChanged: (checked) {
final updated = List<String>.from(selectedValues);
checked ? updated.add(option) : updated.remove(option);
onChanged(updated);
},
);
}).toList(),
),
if (errorText != null)
Padding(
padding: const EdgeInsets.only(top: 4),
child: Text(errorText, style: const TextStyle(color: Colors.red)),
),
],
);
}