diff --git a/lib/entity_class/entity.class.dart b/lib/entity_class/entity.class.dart index f4f009e..7cb6b23 100644 --- a/lib/entity_class/entity.class.dart +++ b/lib/entity_class/entity.class.dart @@ -79,7 +79,6 @@ class Entity { int statelessType = 0; List childEntities = []; - List attributesToShow = ["all"]; String deviceClass; EntityHistoryConfig historyConfig = EntityHistoryConfig( chartType: EntityHistoryWidgetType.simple diff --git a/lib/entity_widgets/common/entity_attributes_list.dart b/lib/entity_widgets/common/entity_attributes_list.dart index 48eca6b..b11a209 100644 --- a/lib/entity_widgets/common/entity_attributes_list.dart +++ b/lib/entity_widgets/common/entity_attributes_list.dart @@ -7,20 +7,9 @@ class EntityAttributesList extends StatelessWidget { Widget build(BuildContext context) { final entityModel = EntityModel.of(context); List 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")); - }); - } else { - entityModel.entityWrapper.entity.attributesToShow.forEach((String attr) { - String attrValue = entityModel.entityWrapper.entity.getAttribute("$attr"); - if (attrValue != null) { - attrs.add( - _buildSingleAttribute("$attr", "$attrValue")); - } - }); - } + entityModel.entityWrapper.entity.attributes.forEach((name, value) { + attrs.add(_buildSingleAttribute("$name", "${value ?? '-'}")); + }); 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, ), ), diff --git a/lib/entity_widgets/entity_icon.dart b/lib/entity_widgets/entity_icon.dart index 3a7f913..cb7d3e3 100644 --- a/lib/entity_widgets/entity_icon.dart +++ b/lib/entity_widgets/entity_icon.dart @@ -36,29 +36,28 @@ class EntityIcon extends StatelessWidget { image: DecorationImage( fit:BoxFit.cover, image: CachedNetworkImageProvider( - "${data.entity.entityPicture}", + "${data.entity.entityPicture}" ), ) ), ); + } + String iconName = data.icon; + int iconCode = 0; + if (iconName.length > 0) { + iconCode = MaterialDesignIcons.getIconCodeByIconName(iconName); } else { - String iconName = data.icon; - int iconCode = 0; - if (iconName.length > 0) { - iconCode = MaterialDesignIcons.getIconCodeByIconName(iconName); - } else { - iconCode = getDefaultIconByEntityId(data.entity.entityId, - data.entity.deviceClass, data.entity.state); // - } - return Padding( - padding: EdgeInsets.fromLTRB(6.0, 6.0, 6.0, 6.0), - child: Icon( + iconCode = getDefaultIconByEntityId(data.entity.entityId, + data.entity.deviceClass, data.entity.state); // + } + return Padding( + padding: EdgeInsets.fromLTRB(6.0, 6.0, 6.0, 6.0), + child: Icon( IconData(iconCode, fontFamily: 'Material Design Icons'), size: size, color: color, ) - ); - } + ); } @override diff --git a/lib/mdi.class.dart b/lib/mdi.class.dart index 1393968..a8664ff 100644 --- a/lib/mdi.class.dart +++ b/lib/mdi.class.dart @@ -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",