This commit is contained in:
Hillel Coren 2019-11-05 17:02:14 +02:00
parent 112b4a65c6
commit ebe90a515c
1 changed files with 27 additions and 16 deletions

View File

@ -95,22 +95,33 @@ class _FormColorPickerState extends State<FormColorPicker> {
labelText: widget.labelText,
),
),
if (_selectedColor == null)
IconButton(
icon: Icon(Icons.color_lens),
onPressed: _showPicker,
),
if (_selectedColor != null)
IconButton(
icon: Icon(Icons.clear),
onPressed: () {
_textController.text = '';
setState(() {
_selectedColor = null;
});
widget.onSelected(null);
},
),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
Container(
color: convertHexStringToColor(widget.initialValue),
width: 100,
height: 20,
),
SizedBox(width: 20),
if (_selectedColor == null)
IconButton(
icon: Icon(Icons.color_lens),
onPressed: _showPicker,
)
else
IconButton(
icon: Icon(Icons.clear),
onPressed: () {
_textController.text = '';
setState(() {
_selectedColor = null;
});
widget.onSelected(null);
},
),
],
),
],
);
}