Closed Tremx389 closed 6 years ago
Hi @Tremx389,
Can you send your code?
Colors.black is not a ColorSwatch type (a list of shaded colors with a primary color), but rather a Color type. This plugin is made to choose, first a primary color, then a shaded color.
So, if you want to have a color picker with black color shades (from white to very dark gray), you can set colors:
colors: [
Colors.grey,
]
and for the selectedColor parameter:
selectedColor: Colors.grey[900],
But Colors.grey[900] is not completely black.
So, if you really want black color, you can create your own ColorSwatch object with Colors.black in primary color and in shaded color. And then for selectedColor: Colors.black.
Example:
ColorSwatch blackColors = new ColorSwatch(
Colors.black.value,
{
500: Colors.black,
},
);
MaterialColorPicker (
onColorChange: _onColorChange,
selectedColor: Colors.black,
colors: [
blackColors,
],
);
Of course you can add shaded colors, to have other color choices, instead of just having the color black.
Hi, I've tried to use black in the selectedColor param, but it doesn't really select anything, also when I took Colors.black to to colors list, i've got an error.
How is it possible to have black as an option?
Thanks, Ben