From 3add1aa5dca2b038707b92c814eca21dea5a43cb Mon Sep 17 00:00:00 2001 From: Joachim Nohl <43643339+nohli@users.noreply.github.com> Date: Mon, 28 Aug 2023 13:58:18 +0200 Subject: [PATCH] Add paletteHeight to pickers (#35) --- lib/src/color_picker.dart | 6 ++++++ lib/src/pickers/palette_hue_picker.dart | 2 +- lib/src/pickers/palette_saturation_picker.dart | 4 +++- lib/src/pickers/palette_value_picker.dart | 4 +++- 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/lib/src/color_picker.dart b/lib/src/color_picker.dart index 5651d89..aee55bc 100644 --- a/lib/src/color_picker.dart +++ b/lib/src/color_picker.dart @@ -40,6 +40,7 @@ class ColorPicker extends StatefulWidget { this.color = Colors.blue, this.initialPicker = Picker.paletteHue, this.pickerOrientation = PickerOrientation.inherit, + this.paletteHeight = 280, Key? key, }) : super(key: key); @@ -55,6 +56,8 @@ class ColorPicker extends StatefulWidget { final PickerOrientation pickerOrientation; + final double paletteHeight; + @override State createState() => _ColorPickerState(); } @@ -163,6 +166,7 @@ class _ColorPickerState extends State { picker: Picker.paletteHue, builder: (BuildContext context) => PaletteHuePicker( color: _hSVColor, + paletteHeight: widget.paletteHeight, onChanged: (HSVColor value) => super.setState( () => _hSVColorOnChanged(value), ), @@ -175,6 +179,7 @@ class _ColorPickerState extends State { picker: Picker.paletteSaturation, builder: (BuildContext context) => PaletteSaturationPicker( color: _hSVColor, + paletteHeight: widget.paletteHeight, onChanged: (HSVColor value) => super.setState( () => _hSVColorOnChanged(value), ), @@ -187,6 +192,7 @@ class _ColorPickerState extends State { picker: Picker.paletteValue, builder: (BuildContext context) => PaletteValuePicker( color: _hSVColor, + paletteHeight: widget.paletteHeight, onChanged: (HSVColor value) => super.setState( () => _hSVColorOnChanged(value), ), diff --git a/lib/src/pickers/palette_hue_picker.dart b/lib/src/pickers/palette_hue_picker.dart index 527a9fc..28645d6 100644 --- a/lib/src/pickers/palette_hue_picker.dart +++ b/lib/src/pickers/palette_hue_picker.dart @@ -8,7 +8,7 @@ class PaletteHuePicker extends StatefulWidget { const PaletteHuePicker({ required this.color, required this.onChanged, - this.paletteHeight = 280.0, + this.paletteHeight = 280, this.palettePadding = const EdgeInsets.symmetric( horizontal: 12, vertical: 20, diff --git a/lib/src/pickers/palette_saturation_picker.dart b/lib/src/pickers/palette_saturation_picker.dart index 5084288..7d208c1 100644 --- a/lib/src/pickers/palette_saturation_picker.dart +++ b/lib/src/pickers/palette_saturation_picker.dart @@ -7,11 +7,13 @@ class PaletteSaturationPicker extends StatefulWidget { const PaletteSaturationPicker({ required this.color, required this.onChanged, + this.paletteHeight = 280, Key? key, }) : super(key: key); final HSVColor color; final ValueChanged onChanged; + final double paletteHeight; @override State createState() => @@ -58,7 +60,7 @@ class _PaletteSaturationPickerState extends State { children: [ // Palette SizedBox( - height: 280.0, + height: widget.paletteHeight, child: Padding( padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 20), child: PalettePicker( diff --git a/lib/src/pickers/palette_value_picker.dart b/lib/src/pickers/palette_value_picker.dart index 1155775..f369a61 100644 --- a/lib/src/pickers/palette_value_picker.dart +++ b/lib/src/pickers/palette_value_picker.dart @@ -7,11 +7,13 @@ class PaletteValuePicker extends StatefulWidget { const PaletteValuePicker({ required this.color, required this.onChanged, + this.paletteHeight = 280, Key? key, }) : super(key: key); final HSVColor color; final ValueChanged onChanged; + final double paletteHeight; @override State createState() => _PaletteValuePickerState(); @@ -56,7 +58,7 @@ class _PaletteValuePickerState extends State { children: [ // Palette SizedBox( - height: 280.0, + height: widget.paletteHeight, child: Padding( padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 20), child: PalettePicker(