diff --git a/lib/cards/light_card.dart b/lib/cards/light_card.dart index 66d8ae9..30398f8 100644 --- a/lib/cards/light_card.dart +++ b/lib/cards/light_card.dart @@ -14,8 +14,8 @@ class LightCard extends StatefulWidget { class _LightCardState extends State { - double _newBrightness; double _actualBrightness; + double _newBrightness; bool _changedHere = false; @override @@ -51,8 +51,9 @@ class _LightCardState extends State { entityWrapper.displayName; entityWrapper.overrideIcon = widget.card.icon ?? entityWrapper.icon; - _actualBrightness = (entity.brightness ?? 0).toDouble(); + if (!_changedHere) { + _actualBrightness = (entity.brightness ?? 0).toDouble(); _newBrightness = _actualBrightness; } else { _changedHere = false; @@ -62,8 +63,9 @@ class _LightCardState extends State { if (lightColor != null && lightColor != Colors.white) { color = lightColor; } else { - color = HAClientTheme().getOnStateColor(context); + color = Theme.of(context).accentColor; } + return CardWrapper( padding: EdgeInsets.all(4), child: EntityModel( diff --git a/lib/viewWidget.widget.dart b/lib/viewWidget.widget.dart index c92538c..28937ac 100644 --- a/lib/viewWidget.widget.dart +++ b/lib/viewWidget.widget.dart @@ -10,15 +10,12 @@ class ViewWidget extends StatelessWidget { @override Widget build(BuildContext context) { + Widget cardsContainer; + Widget badgesContainer; if (this.view.isPanel) { - return FractionallySizedBox( - widthFactor: 1, - heightFactor: 1, - child: _buildPanelChild(context), - ); + cardsContainer = _buildPanelChild(context); + badgesContainer = Container(width: 0, height: 0); } else { - Widget cardsContainer; - Widget badgesContainer; if (this.view.badges != null && this.view.badges is BadgesData) { badgesContainer = this.view.badges.buildCardWidget(); } else { @@ -50,17 +47,17 @@ class ViewWidget extends StatelessWidget { } else { cardsContainer = Container(); } - return SingleChildScrollView( - padding: EdgeInsets.all(0), - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - badgesContainer, - cardsContainer - ], - ), - ); } + return SingleChildScrollView( + padding: EdgeInsets.all(0), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + badgesContainer, + cardsContainer + ], + ), + ); } Widget _buildPanelChild(BuildContext context) {