Fix light color controls appearence issue

This commit is contained in:
Yegor Vialov 2018-12-29 17:44:11 +02:00
parent c65ade9827
commit be5ea55f6b
3 changed files with 8 additions and 8 deletions

View File

@ -10,15 +10,15 @@ class LightControlsWidget extends StatefulWidget {
class _LightControlsWidgetState extends State<LightControlsWidget> { class _LightControlsWidgetState extends State<LightControlsWidget> {
int _tmpBrightness; int _tmpBrightness;
int _tmpColorTemp; int _tmpColorTemp = 0;
Color _tmpColor; Color _tmpColor = Colors.white;
bool _changedHere = false; bool _changedHere = false;
String _tmpEffect; String _tmpEffect;
void _resetState(LightEntity entity) { void _resetState(LightEntity entity) {
_tmpBrightness = entity.brightness ?? 0; _tmpBrightness = entity.brightness ?? 0;
_tmpColorTemp = entity.colorTemp; _tmpColorTemp = entity.colorTemp ?? entity.minMireds?.toInt();
_tmpColor = entity.color; _tmpColor = entity.color ?? _tmpColor;
_tmpEffect = null; _tmpEffect = null;
} }
@ -119,7 +119,7 @@ class _LightControlsWidgetState extends State<LightControlsWidget> {
} }
Widget _buildColorTempControl(LightEntity entity) { Widget _buildColorTempControl(LightEntity entity) {
if ((entity.supportColorTemp) && (_tmpColorTemp != null)) { if (entity.supportColorTemp) {
return UniversalSlider( return UniversalSlider(
title: "Color temperature", title: "Color temperature",
leading: Text("Cold", style: TextStyle(color: Colors.lightBlue),), leading: Text("Cold", style: TextStyle(color: Colors.lightBlue),),
@ -141,7 +141,7 @@ class _LightControlsWidgetState extends State<LightControlsWidget> {
} }
Widget _buildColorControl(LightEntity entity) { Widget _buildColorControl(LightEntity entity) {
if ((entity.supportColor) && (entity.color != null)) { if (entity.supportColor) {
return Column( return Column(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[ children: <Widget>[

View File

@ -85,7 +85,7 @@ part 'ui_widgets/card_header_widget.dart';
EventBus eventBus = new EventBus(); EventBus eventBus = new EventBus();
const String appName = "HA Client"; const String appName = "HA Client";
const appVersion = "0.3.13-81"; const appVersion = "0.3.13-82";
String homeAssistantWebHost; String homeAssistantWebHost;

View File

@ -1,7 +1,7 @@
name: hass_client name: hass_client
description: Home Assistant Android Client description: Home Assistant Android Client
version: 0.3.13+81 version: 0.3.13+82
environment: environment:
sdk: ">=2.0.0-dev.68.0 <3.0.0" sdk: ">=2.0.0-dev.68.0 <3.0.0"