This repository has been archived on 2023-11-18. You can view files and clone it, but cannot push or open issues or pull requests.
ha_client/lib/ui_class/card.class.dart
Yegor Vialov 54e00c3403 WIP #55
2018-11-11 18:36:49 +02:00

65 lines
1.2 KiB
Dart

part of '../main.dart';
class HACard {
List<Entity> entities = [];
Entity linkedEntity;
String name;
String id;
String type;
HACard({
this.name,
this.id,
this.linkedEntity,
@required this.type
});
Widget build(BuildContext context) {
switch (type) {
case "entities": {
return EntitiesCardWidget(
card: this,
);
}
case "media-control": {
return MediaControlCardWidget(
card: this,
);
}
case "weather-forecast":
case "thermostat":
case "sensor":
case "plant-status":
case "picture-entity":
case "picture-elements":
case "picture":
case "map":
case "iframe":
case "gauge":
case "entity-button":
case "conditional":
case "alarm-panel": {
return UnsupportedCardWidget(
card: this,
);
}
default: {
if ((linkedEntity == null) && (entities.isNotEmpty)) {
return EntitiesCardWidget(
card: this,
);
} else {
return UnsupportedCardWidget(
card: this,
);
}
}
}
}
}