Resolves #208 Gauge card
This commit is contained in:
@ -1,56 +0,0 @@
|
||||
part of '../main.dart';
|
||||
|
||||
class HACard {
|
||||
List<EntityWrapper> entities = [];
|
||||
List<HACard> childCards = [];
|
||||
EntityWrapper linkedEntityWrapper;
|
||||
String name;
|
||||
String id;
|
||||
String type;
|
||||
bool showName;
|
||||
bool showState;
|
||||
bool showEmpty;
|
||||
int columnsCount;
|
||||
List stateFilter;
|
||||
List states;
|
||||
List conditions;
|
||||
String content;
|
||||
|
||||
HACard({
|
||||
this.name,
|
||||
this.id,
|
||||
this.linkedEntityWrapper,
|
||||
this.columnsCount: 4,
|
||||
this.showName: true,
|
||||
this.showState: true,
|
||||
this.stateFilter: const [],
|
||||
this.showEmpty: true,
|
||||
this.content,
|
||||
this.states,
|
||||
this.conditions: const [],
|
||||
@required this.type
|
||||
}) {
|
||||
if (this.columnsCount <= 0) {
|
||||
this.columnsCount = 4;
|
||||
}
|
||||
}
|
||||
|
||||
List<EntityWrapper> getEntitiesToShow() {
|
||||
return entities.where((entityWrapper) {
|
||||
if (entityWrapper.entity.isHidden) {
|
||||
return false;
|
||||
}
|
||||
if (stateFilter.isNotEmpty) {
|
||||
return stateFilter.contains(entityWrapper.entity.state);
|
||||
}
|
||||
return true;
|
||||
}).toList();
|
||||
}
|
||||
|
||||
Widget build(BuildContext context) {
|
||||
return CardWidget(
|
||||
card: this,
|
||||
);
|
||||
}
|
||||
|
||||
}
|
@ -29,7 +29,7 @@ class HAView {
|
||||
name: e.displayName,
|
||||
id: e.entityId,
|
||||
linkedEntityWrapper: EntityWrapper(entity: e),
|
||||
type: CardType.mediaControl
|
||||
type: CardType.MEDIA_CONTROL
|
||||
);
|
||||
cards.add(card);
|
||||
});
|
||||
@ -40,7 +40,7 @@ class HAView {
|
||||
HACard card = HACard(
|
||||
id: groupIdToAdd,
|
||||
name: entity.domain,
|
||||
type: CardType.entities
|
||||
type: CardType.ENTITIES
|
||||
);
|
||||
card.entities.add(EntityWrapper(entity: entity));
|
||||
autoGeneratedCards.add(card);
|
||||
@ -52,7 +52,7 @@ class HAView {
|
||||
name: entity.displayName,
|
||||
id: entity.entityId,
|
||||
linkedEntityWrapper: EntityWrapper(entity: entity),
|
||||
type: CardType.entities
|
||||
type: CardType.ENTITIES
|
||||
);
|
||||
card.entities.addAll(entity.childEntities.where((entity) {return entity.domain != "media_player";}).map((e) {return EntityWrapper(entity: e);}));
|
||||
entity.childEntities.where((entity) {return entity.domain == "media_player";}).forEach((entity){
|
||||
@ -60,7 +60,7 @@ class HAView {
|
||||
name: entity.displayName,
|
||||
id: entity.entityId,
|
||||
linkedEntityWrapper: EntityWrapper(entity: entity),
|
||||
type: CardType.mediaControl
|
||||
type: CardType.MEDIA_CONTROL
|
||||
);
|
||||
cards.add(mediaCard);
|
||||
});
|
||||
|
Reference in New Issue
Block a user