Widget rendering improvements

This commit is contained in:
Yegor Vialov
2020-04-25 14:15:19 +00:00
parent 513bf85cae
commit 16c06a2d48
7 changed files with 120 additions and 132 deletions

View File

@ -33,10 +33,10 @@ class HAView {
});
}
cards.addAll(_createLovelaceCards(rawData["cards"] ?? []));
cards.addAll(_createLovelaceCards(rawData["cards"] ?? [], 1));
}
List<HACard> _createLovelaceCards(List rawCards) {
List<HACard> _createLovelaceCards(List rawCards, int depth) {
List<HACard> result = [];
rawCards.forEach((rawCard){
try {
@ -58,10 +58,11 @@ class HAView {
min: rawCardInfo['min'] ?? 0,
max: rawCardInfo['max'] ?? 100,
unit: rawCardInfo['unit'],
depth: depth,
severity: rawCardInfo['severity']
);
if (rawCardInfo["cards"] != null) {
card.childCards = _createLovelaceCards(rawCardInfo["cards"]);
card.childCards = _createLovelaceCards(rawCardInfo["cards"], depth + 1);
}
var rawEntities = rawCard["entities"] ?? rawCardInfo["entities"];
rawEntities?.forEach((rawEntity) {