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, labelText: widget.labelText,
), ),
), ),
if (_selectedColor == null) Row(
IconButton( mainAxisAlignment: MainAxisAlignment.end,
icon: Icon(Icons.color_lens), children: <Widget>[
onPressed: _showPicker, Container(
), color: convertHexStringToColor(widget.initialValue),
if (_selectedColor != null) width: 100,
IconButton( height: 20,
icon: Icon(Icons.clear), ),
onPressed: () { SizedBox(width: 20),
_textController.text = ''; if (_selectedColor == null)
setState(() { IconButton(
_selectedColor = null; icon: Icon(Icons.color_lens),
}); onPressed: _showPicker,
widget.onSelected(null); )
}, else
), IconButton(
icon: Icon(Icons.clear),
onPressed: () {
_textController.text = '';
setState(() {
_selectedColor = null;
});
widget.onSelected(null);
},
),
],
),
], ],
); );
} }