Fix 'Paste color' button background when saved color is null

This commit is contained in:
estevez-dev
2019-03-10 23:49:05 +02:00
parent 4f4ac3b574
commit 0ef2ebfe31

View File

@ -179,32 +179,29 @@ class _LightControlsWidgetState extends State<LightControlsWidget> {
color: _tmpColor, color: _tmpColor,
onColorSelected: (color) => _setColor(entity, color), onColorSelected: (color) => _setColor(entity, color),
), ),
Padding( Row(
padding: EdgeInsets.only(top: 0.0), mainAxisSize: MainAxisSize.min,
child: Row( children: <Widget>[
mainAxisSize: MainAxisSize.min, FlatButton(
children: <Widget>[ color: _tmpColor.toColor(),
FlatButton( child: Text('Copy color'),
color: _tmpColor.toColor(), onPressed: _tmpColor == null ? null : () {
child: Text('Copy color'), setState(() {
onPressed: _tmpColor == null ? null : () { HomeAssistantModel
setState(() { .of(context)
HomeAssistantModel .homeAssistant
.of(context) .savedColor = _tmpColor;
.homeAssistant });
.savedColor = _tmpColor; },
}); ),
}, FlatButton(
), color: savedColor?.toColor() ?? Colors.transparent,
FlatButton( child: Text('Paste color'),
color: savedColor.toColor(), onPressed: savedColor == null ? null : () {
child: Text('Paste color'), _setColor(entity, savedColor);
onPressed: savedColor == null ? null : () { },
_setColor(entity, savedColor); )
}, ],
)
],
)
) )
], ],
); );