Reverting views refactoring

This commit is contained in:
Yegor Vialov
2018-10-21 02:39:51 +03:00
parent 33f9a1075e
commit 9b490d33d5
5 changed files with 123 additions and 55 deletions

View File

@ -781,12 +781,14 @@ class _LightControlsWidgetState extends State<LightControlsWidget> {
Color _tmpColor;
bool _changedHere = false;
String _tmpEffect;
String _tmpFlash;
void _resetState(LightEntity entity) {
_tmpBrightness = entity.brightness;
_tmpColorTemp = entity.colorTemp;
_tmpColor = entity.color;
_tmpEffect = null;
_tmpFlash = null;
}
void _setBrightness(LightEntity entity, double value) {
@ -844,6 +846,18 @@ class _LightControlsWidgetState extends State<LightControlsWidget> {
});
}
void _setFlash(LightEntity entity, String value) {
setState(() {
_tmpFlash = value;
_changedHere = true;
if (_tmpFlash != null) {
eventBus.fire(new ServiceCallEvent(
entity.domain, "turn_on", entity.entityId,
{"flash": "$value"}));
}
});
}
@override
Widget build(BuildContext context) {
final entityModel = EntityModel.of(context);