Fix missed entity picture
This commit is contained in:
parent
a85fb3d03b
commit
0792cae2b1
@ -42,52 +42,53 @@ class EntityIcon extends StatelessWidget {
|
|||||||
)
|
)
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
|
||||||
String iconName = data.icon;
|
|
||||||
int iconCode = 0;
|
|
||||||
if (iconName.length > 0) {
|
|
||||||
iconCode = MaterialDesignIcons.getIconCodeByIconName(iconName);
|
|
||||||
} else {
|
} else {
|
||||||
iconCode = getDefaultIconByEntityId(data.entity.entityId,
|
String iconName = data.icon;
|
||||||
data.entity.deviceClass, data.entity.state); //
|
int iconCode = 0;
|
||||||
}
|
if (iconName.length > 0) {
|
||||||
result = Icon(
|
iconCode = MaterialDesignIcons.getIconCodeByIconName(iconName);
|
||||||
IconData(iconCode, fontFamily: 'Material Design Icons'),
|
} else {
|
||||||
size: size,
|
iconCode = getDefaultIconByEntityId(data.entity.entityId,
|
||||||
color: color,
|
data.entity.deviceClass, data.entity.state); //
|
||||||
);
|
}
|
||||||
if (data.entity is LightEntity &&
|
result = Icon(
|
||||||
(data.entity as LightEntity).supportColor &&
|
IconData(iconCode, fontFamily: 'Material Design Icons'),
|
||||||
(data.entity as LightEntity).color != null
|
size: size,
|
||||||
) {
|
color: color,
|
||||||
Color lightColor = (data.entity as LightEntity).color.toColor();
|
|
||||||
if (lightColor == Colors.white) {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
result = Stack(
|
|
||||||
children: <Widget>[
|
|
||||||
result,
|
|
||||||
Positioned(
|
|
||||||
bottom: 0,
|
|
||||||
right: 0,
|
|
||||||
child: Container(
|
|
||||||
width: size / 3,
|
|
||||||
height: size / 3,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: lightColor,
|
|
||||||
shape: BoxShape.circle,
|
|
||||||
boxShadow: <BoxShadow>[
|
|
||||||
BoxShadow(
|
|
||||||
spreadRadius: 0,
|
|
||||||
blurRadius: 0,
|
|
||||||
offset: Offset(0.3, 0.3)
|
|
||||||
)
|
|
||||||
]
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
);
|
);
|
||||||
|
if (data.entity is LightEntity &&
|
||||||
|
(data.entity as LightEntity).supportColor &&
|
||||||
|
(data.entity as LightEntity).color != null
|
||||||
|
) {
|
||||||
|
Color lightColor = (data.entity as LightEntity).color.toColor();
|
||||||
|
if (lightColor == Colors.white) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
result = Stack(
|
||||||
|
children: <Widget>[
|
||||||
|
result,
|
||||||
|
Positioned(
|
||||||
|
bottom: 0,
|
||||||
|
right: 0,
|
||||||
|
child: Container(
|
||||||
|
width: size / 3,
|
||||||
|
height: size / 3,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: lightColor,
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
boxShadow: <BoxShadow>[
|
||||||
|
BoxShadow(
|
||||||
|
spreadRadius: 0,
|
||||||
|
blurRadius: 0,
|
||||||
|
offset: Offset(0.3, 0.3)
|
||||||
|
)
|
||||||
|
]
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user