flutter_colorpicker
a hsv(hsb)/hsl color picker inspired by chrome devtools and a material color picker for your flutter app.
getting started
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,
showlabel: true,
pickerareaheightpercent: 0.8,
),
// use material color picker:
//
// child: materialpicker(
// pickercolor: pickercolor,
// oncolorchanged: changecolor,
// showlabel: true, // only on portrait mode
// ),
//
// use block color picker:
//
// child: blockpicker(
// pickercolor: currentcolor,
// oncolorchanged: changecolor,
// ),
//
// child: multiplechoiceblockpicker(
// pickercolors: currentcolors,
// oncolorschanged: changecolors,
// ),
),
actions: <widget>[
flatbutton(
child: const text('got it'),
onpressed: () {
setstate(() => currentcolor = pickercolor);
navigator.of(context).pop();
},
),
],
),
)
Comments are closed.