INNER CODE UNIT · Dart
_MultipleChoiceBlockPickerState
mchome/flutter_colorpicker · lib/src/block_picker.dart:158
class _MultipleChoiceBlockPickerState extends State<MultipleChoiceBlockPicker> {
List<Color>? _currentColors;
@override
void initState() {
_currentColors = widget.pickerColors;
super.initState();
}
void toggleColor(Color color) {
setState(() {
if (_currentColors != null) {
_currentColors!.contains(color) ? _currentColors!.remove(color) : _currentColors!.add(color);
}
});
widget.onColorsChanged(_currentColors ?? []);
}