TwoEightNine / flutter_hsv_circle_color_picker

HSV-based circle color picker for flutter.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Flutter HSV-based circle color picker

A HSV-based circle color picker for flutter based on itome's color picker.

Sample

Usage

    CircleColorPicker _createColorPicker() =>
        CircleColorPicker(
          initialColor: _currentColor,
          circleConfig: _createCircleConfig(),
          sliderConfig: _createSliderConfig(),
          onChanged: _onColorChanged,
        );
  
    ColorPickerCircleConfig _createCircleConfig() =>
        ColorPickerCircleConfig(
            size: Size(320, 320),
            strokeWidth: 6,
            thumbSize: 32,
            spaceHeight: 48
        );
  
    ColorPickerSliderConfig _createSliderConfig() =>
        ColorPickerSliderConfig(
            width: 180,
            strokeWidth: 6,
            thumbSize: 26
        );

API

ColorPickerCircleConfig

  /// The size of widget.
  /// Draggable area is thumb widget is included to the size,
  /// so circle is smaller than the size.
  ///
  /// Default value is 320 x 320.
  final Size size;

  /// The width of circle border.
  ///
  /// Default value is 6.
  final double strokeWidth;

  /// The size of thumb for circle picker.
  ///
  /// Default value is 32.
  final double thumbSize;

  /// The height of space between sliders.
  ///
  /// Default value is 48.
  final double spaceHeight;

ColorPickerSliderConfig

  /// The width of slider.
  ///
  /// Default value is 180.
  final double width;

  /// The width of border.
  ///
  /// Default value is 6.
  final double strokeWidth;

  /// The size of thumb for circle picker.
  ///
  /// Default value is 26.
  final double thumbSize;

CircleColorPicker

    /// Called during a drag when the user is selecting a color.
    ///
    /// This callback called with latest color that user selected.
    final ValueChanged<Color> onChanged;
  
    /// Config for hue circle.
    final ColorPickerCircleConfig circleConfig;
  
    /// Config for value and saturation sliders.
    final ColorPickerSliderConfig sliderConfig;
  
    /// Initial color for picker.
    /// [onChanged] callback won't be called with initial value.
    ///
    /// Default value is Red.
    final Color initialColor;

About

HSV-based circle color picker for flutter.

License:MIT License


Languages

Language:Dart 97.0%Language:Swift 2.1%Language:Kotlin 0.8%Language:Objective-C 0.2%