Fix panel view scroll issue

This commit is contained in:
Yegor Vialov 2020-05-22 12:54:39 +00:00
parent dbeda6ea68
commit a6d1baca77
2 changed files with 19 additions and 20 deletions

View File

@ -14,8 +14,8 @@ class LightCard extends StatefulWidget {
class _LightCardState extends State<LightCard> {
double _newBrightness;
double _actualBrightness;
double _newBrightness;
bool _changedHere = false;
@override
@ -51,8 +51,9 @@ class _LightCardState extends State<LightCard> {
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<LightCard> {
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(

View File

@ -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: <Widget>[
badgesContainer,
cardsContainer
],
),
);
}
return SingleChildScrollView(
padding: EdgeInsets.all(0),
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
badgesContainer,
cardsContainer
],
),
);
}
Widget _buildPanelChild(BuildContext context) {