Skip to content

Commit e0af7e9

Browse files
feat: add availableColors property to color picker
1 parent b6f09c0 commit e0af7e9

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lib/src/fields/form_builder_color_picker.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ class FormBuilderColorPickerField extends FormBuilderField<Color> {
6565
final EdgeInsets scrollPadding;
6666
final bool enableInteractiveSelection;
6767
final InputCounterWidgetBuilder? buildCounter;
68+
final List<Color> availableColors;
6869

6970
final Widget Function(Color?)? colorPreviewBuilder;
7071

@@ -112,6 +113,7 @@ class FormBuilderColorPickerField extends FormBuilderField<Color> {
112113
this.buildCounter,
113114
this.controller,
114115
this.colorPreviewBuilder,
116+
this.availableColors = const [],
115117
}) : super(
116118
key: key,
117119
initialValue: initialValue,
@@ -261,6 +263,7 @@ class FormBuilderColorPickerFieldState
261263
return BlockPicker(
262264
pickerColor: value ?? Colors.transparent,
263265
onColorChanged: _colorChanged,
266+
availableColors: widget.availableColors,
264267
);
265268
default:
266269
throw 'Unknown ColorPickerType';

0 commit comments

Comments
 (0)