Skip to content

A HSV color picker inspired by chrome devtools and a material color picker for your flutter app.

License

Notifications You must be signed in to change notification settings

tjerman/flutter_colorpicker

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

flutter_colorpicker

pub package donate

A HSV color picker inspired by chrome devtools and a material color picker for your flutter app.

Getting Started

Installation

Add this to your pubspec.yaml (or create it):

dependencies:
  flutter_colorpicker: any

Then run the flutter tooling:

flutter packages get

Or upgrade the packages with:

flutter packages upgrade

Example

Use it in [showDialog] widget:

// create some values
Color pickerColor = Color(0xff443a49);
Color currentColor = Color(0xff443a49);

// ValueChanged<Color> callback
void changeColor(Color color) {
  setState(() => pickerColor = color);
}

// raise the [showDialog] widget
showDialog(
  context: context,
  child: AlertDialog(
    title: const Text('Pick a color!'),
    content: SingleChildScrollView(
      child: ColorPicker(
        pickerColor: pickerColor,
        onColorChanged: changeColor,
        enableLabel: true,
        pickerAreaHeightPercent: 0.8,
      ),
      // Use Material color picker:
      //
      // child: MaterialPicker(
      //   pickerColor: pickerColor,
      //   onColorChanged: changeColor,
      //   enableLabel: true, // only on portrait mode
      // ),
      //
      // Use Block color picker:
      //
      // child: BlockPicker(
      //   pickerColor: currentColor,
      //   onColorChanged: changeColor,
      // ),
    ),
    actions: <Widget>[
      FlatButton(
        child: const Text('Got it'),
        onPressed: () {
          setState(() => currentColor = pickerColor);
          Navigator.of(context).pop();
        },
      ),
    ],
  ),
)

preview

01 02 03 04 05

Details in example/ folder.

About

A HSV color picker inspired by chrome devtools and a material color picker for your flutter app.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Dart 96.8%
  • Objective-C 2.1%
  • Java 1.1%