Resolves #83 Calendar support

This commit is contained in:
estevez-dev 2019-03-13 20:07:44 +02:00
parent 9bd3a41cf5
commit 8b961ebd69
4 changed files with 19 additions and 30 deletions

View File

@ -79,7 +79,6 @@ class Entity {
int statelessType = 0;
List<Entity> childEntities = [];
List<String> attributesToShow = ["all"];
String deviceClass;
EntityHistoryConfig historyConfig = EntityHistoryConfig(
chartType: EntityHistoryWidgetType.simple

View File

@ -7,20 +7,9 @@ class EntityAttributesList extends StatelessWidget {
Widget build(BuildContext context) {
final entityModel = EntityModel.of(context);
List<Widget> attrs = [];
if ((entityModel.entityWrapper.entity.attributesToShow == null) ||
(entityModel.entityWrapper.entity.attributesToShow.contains("all"))) {
entityModel.entityWrapper.entity.attributes.forEach((name, value) {
attrs.add(_buildSingleAttribute("$name", "$value"));
attrs.add(_buildSingleAttribute("$name", "${value ?? '-'}"));
});
} else {
entityModel.entityWrapper.entity.attributesToShow.forEach((String attr) {
String attrValue = entityModel.entityWrapper.entity.getAttribute("$attr");
if (attrValue != null) {
attrs.add(
_buildSingleAttribute("$attr", "$attrValue"));
}
});
}
return Padding(
padding: EdgeInsets.only(bottom: Sizes.rowPadding),
child: Column(
@ -49,7 +38,7 @@ class EntityAttributesList extends StatelessWidget {
padding: EdgeInsets.fromLTRB(
0.0, Sizes.rowPadding, Sizes.rightWidgetPadding, 0.0),
child: Text(
"$value",
"${value}",
textAlign: TextAlign.right,
),
),

View File

@ -36,12 +36,12 @@ class EntityIcon extends StatelessWidget {
image: DecorationImage(
fit:BoxFit.cover,
image: CachedNetworkImageProvider(
"${data.entity.entityPicture}",
"${data.entity.entityPicture}"
),
)
),
);
} else {
}
String iconName = data.icon;
int iconCode = 0;
if (iconName.length > 0) {
@ -59,7 +59,6 @@ class EntityIcon extends StatelessWidget {
)
);
}
}
@override
Widget build(BuildContext context) {

View File

@ -23,6 +23,8 @@ class MaterialDesignIcons {
"cover.closing": "mdi:window-open",
"cover.opening": "mdi:window-open",
"camera": "mdi:cctv",
"calendar": "mdi:calendar",
"timer": "mdi:timer",
"lock.locked": "mdi:lock",
"lock.unlocked": "mdi:lock-open",
"fan": "mdi:fan",