mchome / flutter_colorpicker

HSV(HSB)/HSL/RGB/Material color picker inspired by all the good design for your amazing flutter apps.
https://pub.dev/packages/flutter_colorpicker
MIT License
350 stars 203 forks source link

Q: How to hide color preview, Make slider container's height adjustable #95

Open 3g015st opened 1 year ago

3g015st commented 1 year ago

tnongers

The title and photo speak for themselves. Thanks to whoever answers this 😄

xarDeves commented 1 month ago

The actual class is in palette.dart named ColorIndicator. There is also a flag in colorpicker.dart named this.showIndicator and it is set to true.

Setting the above flag to false however does not do anything. Commenting out the whole GestureDetector block from the picker "version" you are currently using does the trick however... for example, the comented lines should be (located in colorpicker.dart):

GestureDetector(
  onTap: () => setState(() {
    if (widget.onHistoryChanged != null && !colorHistory.contains(currentHsvColor.toColor())) {
      colorHistory.add(currentHsvColor.toColor());
      widget.onHistoryChanged!(colorHistory);
    }
  }),
  child: ColorIndicator(currentHsvColor),
),

This is quite annoying, if the flag could be fixed to do what it is supposed to it would be much appreciated.

PS. if you are to fiddle with the code, make sure to copy the files that flutter downloaded to your source directory and import these to use in your code instead...