Resolves #83 Calendar support
This commit is contained in:
parent
9bd3a41cf5
commit
8b961ebd69
@ -79,7 +79,6 @@ class Entity {
|
|||||||
int statelessType = 0;
|
int statelessType = 0;
|
||||||
|
|
||||||
List<Entity> childEntities = [];
|
List<Entity> childEntities = [];
|
||||||
List<String> attributesToShow = ["all"];
|
|
||||||
String deviceClass;
|
String deviceClass;
|
||||||
EntityHistoryConfig historyConfig = EntityHistoryConfig(
|
EntityHistoryConfig historyConfig = EntityHistoryConfig(
|
||||||
chartType: EntityHistoryWidgetType.simple
|
chartType: EntityHistoryWidgetType.simple
|
||||||
|
@ -7,20 +7,9 @@ class EntityAttributesList extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final entityModel = EntityModel.of(context);
|
final entityModel = EntityModel.of(context);
|
||||||
List<Widget> attrs = [];
|
List<Widget> attrs = [];
|
||||||
if ((entityModel.entityWrapper.entity.attributesToShow == null) ||
|
entityModel.entityWrapper.entity.attributes.forEach((name, value) {
|
||||||
(entityModel.entityWrapper.entity.attributesToShow.contains("all"))) {
|
attrs.add(_buildSingleAttribute("$name", "${value ?? '-'}"));
|
||||||
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"));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: EdgeInsets.only(bottom: Sizes.rowPadding),
|
padding: EdgeInsets.only(bottom: Sizes.rowPadding),
|
||||||
child: Column(
|
child: Column(
|
||||||
@ -49,7 +38,7 @@ class EntityAttributesList extends StatelessWidget {
|
|||||||
padding: EdgeInsets.fromLTRB(
|
padding: EdgeInsets.fromLTRB(
|
||||||
0.0, Sizes.rowPadding, Sizes.rightWidgetPadding, 0.0),
|
0.0, Sizes.rowPadding, Sizes.rightWidgetPadding, 0.0),
|
||||||
child: Text(
|
child: Text(
|
||||||
"$value",
|
"${value}",
|
||||||
textAlign: TextAlign.right,
|
textAlign: TextAlign.right,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -36,29 +36,28 @@ class EntityIcon extends StatelessWidget {
|
|||||||
image: DecorationImage(
|
image: DecorationImage(
|
||||||
fit:BoxFit.cover,
|
fit:BoxFit.cover,
|
||||||
image: CachedNetworkImageProvider(
|
image: CachedNetworkImageProvider(
|
||||||
"${data.entity.entityPicture}",
|
"${data.entity.entityPicture}"
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
String iconName = data.icon;
|
||||||
|
int iconCode = 0;
|
||||||
|
if (iconName.length > 0) {
|
||||||
|
iconCode = MaterialDesignIcons.getIconCodeByIconName(iconName);
|
||||||
} else {
|
} else {
|
||||||
String iconName = data.icon;
|
iconCode = getDefaultIconByEntityId(data.entity.entityId,
|
||||||
int iconCode = 0;
|
data.entity.deviceClass, data.entity.state); //
|
||||||
if (iconName.length > 0) {
|
}
|
||||||
iconCode = MaterialDesignIcons.getIconCodeByIconName(iconName);
|
return Padding(
|
||||||
} else {
|
padding: EdgeInsets.fromLTRB(6.0, 6.0, 6.0, 6.0),
|
||||||
iconCode = getDefaultIconByEntityId(data.entity.entityId,
|
child: Icon(
|
||||||
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'),
|
IconData(iconCode, fontFamily: 'Material Design Icons'),
|
||||||
size: size,
|
size: size,
|
||||||
color: color,
|
color: color,
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -23,6 +23,8 @@ class MaterialDesignIcons {
|
|||||||
"cover.closing": "mdi:window-open",
|
"cover.closing": "mdi:window-open",
|
||||||
"cover.opening": "mdi:window-open",
|
"cover.opening": "mdi:window-open",
|
||||||
"camera": "mdi:cctv",
|
"camera": "mdi:cctv",
|
||||||
|
"calendar": "mdi:calendar",
|
||||||
|
"timer": "mdi:timer",
|
||||||
"lock.locked": "mdi:lock",
|
"lock.locked": "mdi:lock",
|
||||||
"lock.unlocked": "mdi:lock-open",
|
"lock.unlocked": "mdi:lock-open",
|
||||||
"fan": "mdi:fan",
|
"fan": "mdi:fan",
|
||||||
|
Reference in New Issue
Block a user