Skip to content

Commit

Permalink
Add paletteHeight to pickers (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
nohli authored Aug 28, 2023
1 parent b7233a5 commit 3add1aa
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
6 changes: 6 additions & 0 deletions lib/src/color_picker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -55,6 +56,8 @@ class ColorPicker extends StatefulWidget {

final PickerOrientation pickerOrientation;

final double paletteHeight;

@override
State<ColorPicker> createState() => _ColorPickerState();
}
Expand Down Expand Up @@ -163,6 +166,7 @@ class _ColorPickerState extends State<ColorPicker> {
picker: Picker.paletteHue,
builder: (BuildContext context) => PaletteHuePicker(
color: _hSVColor,
paletteHeight: widget.paletteHeight,
onChanged: (HSVColor value) => super.setState(
() => _hSVColorOnChanged(value),
),
Expand All @@ -175,6 +179,7 @@ class _ColorPickerState extends State<ColorPicker> {
picker: Picker.paletteSaturation,
builder: (BuildContext context) => PaletteSaturationPicker(
color: _hSVColor,
paletteHeight: widget.paletteHeight,
onChanged: (HSVColor value) => super.setState(
() => _hSVColorOnChanged(value),
),
Expand All @@ -187,6 +192,7 @@ class _ColorPickerState extends State<ColorPicker> {
picker: Picker.paletteValue,
builder: (BuildContext context) => PaletteValuePicker(
color: _hSVColor,
paletteHeight: widget.paletteHeight,
onChanged: (HSVColor value) => super.setState(
() => _hSVColorOnChanged(value),
),
Expand Down
2 changes: 1 addition & 1 deletion lib/src/pickers/palette_hue_picker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 3 additions & 1 deletion lib/src/pickers/palette_saturation_picker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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<HSVColor> onChanged;
final double paletteHeight;

@override
State<PaletteSaturationPicker> createState() =>
Expand Down Expand Up @@ -58,7 +60,7 @@ class _PaletteSaturationPickerState extends State<PaletteSaturationPicker> {
children: <Widget>[
// Palette
SizedBox(
height: 280.0,
height: widget.paletteHeight,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 20),
child: PalettePicker(
Expand Down
4 changes: 3 additions & 1 deletion lib/src/pickers/palette_value_picker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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<HSVColor> onChanged;
final double paletteHeight;

@override
State<PaletteValuePicker> createState() => _PaletteValuePickerState();
Expand Down Expand Up @@ -56,7 +58,7 @@ class _PaletteValuePickerState extends State<PaletteValuePicker> {
children: <Widget>[
// Palette
SizedBox(
height: 280.0,
height: widget.paletteHeight,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 20),
child: PalettePicker(
Expand Down

0 comments on commit 3add1aa

Please sign in to comment.