WIP #212 Light card support

This commit is contained in:
estevez-dev
2019-09-08 19:04:12 +03:00
parent 38c37fa212
commit 127e0b8182
13 changed files with 1009 additions and 11 deletions

View File

@ -62,6 +62,10 @@ class CardWidget extends StatelessWidget {
return _buildGaugeCard(context);
}
case CardType.LIGHT: {
return _buildLightCard(context);
}
case CardType.MARKDOWN: {
return _buildMarkdownCard(context);
}
@ -306,6 +310,22 @@ class CardWidget extends StatelessWidget {
);
}
Widget _buildLightCard(BuildContext context) {
card.linkedEntityWrapper.displayName = card.name ??
card.linkedEntityWrapper.displayName;
return Card(
child: EntityModel(
entityWrapper: card.linkedEntityWrapper,
child: LightCardBody(
min: card.min,
max: card.max,
severity: card.severity,
),
handleTap: true
)
);
}
Widget _buildUnsupportedCard(BuildContext context) {
List<Widget> body = [];
body.add(CardHeader(name: card.name ?? ""));