Resolves #314 card icon priority

This commit is contained in:
estevez-dev
2019-03-13 22:12:01 +02:00
parent fb456878bc
commit 8b28bb2e9e
3 changed files with 13 additions and 7 deletions

View File

@ -4,6 +4,7 @@ class EntityWrapper {
String displayName;
String icon;
String entityPicture;
EntityUIAction uiAction;
Entity entity;
@ -16,6 +17,9 @@ class EntityWrapper {
}) {
if (entity.statelessType == StatelessEntityType.NONE || entity.statelessType == StatelessEntityType.CALL_SERVICE || entity.statelessType == StatelessEntityType.WEBLINK) {
this.icon = icon ?? entity.icon;
if (icon == null) {
entityPicture = entity.entityPicture;
}
this.displayName = displayName ?? entity.displayName;
if (uiAction == null) {
uiAction = EntityUIAction();

View File

@ -2,6 +2,8 @@ part of '../main.dart';
class EntityColor {
static const defaultStateColor = Color.fromRGBO(68, 115, 158, 1.0);
static const badgeColors = {
"default": Color.fromRGBO(223, 76, 30, 1.0),
"binary_sensor": Color.fromRGBO(3, 155, 229, 1.0)
@ -15,11 +17,11 @@ class EntityColor {
"above_horizon": Colors.amber,
EntityState.home: Colors.amber,
EntityState.open: Colors.amber,
EntityState.off: Color.fromRGBO(68, 115, 158, 1.0),
EntityState.closed: Color.fromRGBO(68, 115, 158, 1.0),
"below_horizon": Color.fromRGBO(68, 115, 158, 1.0),
"default": Color.fromRGBO(68, 115, 158, 1.0),
EntityState.idle: Color.fromRGBO(68, 115, 158, 1.0),
EntityState.off: defaultStateColor,
EntityState.closed: defaultStateColor,
"below_horizon": defaultStateColor,
"default": defaultStateColor,
EntityState.idle: defaultStateColor,
"heat": Colors.redAccent,
"cool": Colors.lightBlue,
EntityState.unavailable: Colors.black26,

View File

@ -27,7 +27,7 @@ class EntityIcon extends StatelessWidget {
if (data == null) {
return null;
}
if (data.entity.entityPicture != null) {
if (data.entityPicture != null) {
return Container(
height: size+12,
width: size+12,
@ -36,7 +36,7 @@ class EntityIcon extends StatelessWidget {
image: DecorationImage(
fit:BoxFit.cover,
image: CachedNetworkImageProvider(
"${data.entity.entityPicture}"
"${data.entityPicture}"
),
)
),