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

46 lines
922 B
Dart
Raw Normal View History

2018-10-27 17:28:47 +03:00
part of '../main.dart';
class HACard {
2018-11-15 19:08:47 +02:00
List<EntityWrapper> entities = [];
2018-11-25 20:44:19 +02:00
List<HACard> childCards = [];
EntityWrapper linkedEntityWrapper;
2018-10-27 17:28:47 +03:00
String name;
String id;
String type;
2018-11-15 19:08:47 +02:00
bool showName;
bool showState;
bool showEmpty;
2018-11-14 19:52:17 +02:00
int columnsCount;
List stateFilter;
2018-10-27 17:28:47 +03:00
HACard({
this.name,
this.id,
this.linkedEntityWrapper,
2018-11-14 19:52:17 +02:00
this.columnsCount: 4,
2018-11-15 19:08:47 +02:00
this.showName: true,
this.showState: true,
this.stateFilter: const [],
this.showEmpty: true,
2018-10-27 17:28:47 +03:00
@required this.type
});
List<EntityWrapper> getEntitiesToShow() {
return entities.where((entityWrapper) {
if (entityWrapper.entity.isHidden) {
return false;
}
if (stateFilter.isNotEmpty) {
return stateFilter.contains(entityWrapper.entity.state);
2018-10-27 17:28:47 +03:00
}
return true;
}).toList();
}
Widget build(BuildContext context) {
return CardWidget(
card: this,
);
2018-10-27 17:28:47 +03:00
}
}