From 91a99e17e093a4517a1cca8d113b46b494e1af20 Mon Sep 17 00:00:00 2001 From: estevez-dev Date: Sun, 10 Mar 2019 22:50:39 +0200 Subject: [PATCH] Resolves #320 Fix eEntity_picture size --- .../default_entity_container.dart | 4 ++- lib/entity_widgets/entity_icon.dart | 30 ++++++++++++++----- lib/ui_widgets/card_widget.dart | 2 +- 3 files changed, 27 insertions(+), 9 deletions(-) diff --git a/lib/entity_widgets/default_entity_container.dart b/lib/entity_widgets/default_entity_container.dart index f9d29ca..4a1216c 100644 --- a/lib/entity_widgets/default_entity_container.dart +++ b/lib/entity_widgets/default_entity_container.dart @@ -30,7 +30,9 @@ class DefaultEntityContainer extends StatelessWidget { Flexible( fit: FlexFit.tight, flex: 3, - child: EntityName(), + child: EntityName( + padding: EdgeInsets.fromLTRB(10.0, 2.0, 10.0, 2.0), + ), ), state ], diff --git a/lib/entity_widgets/entity_icon.dart b/lib/entity_widgets/entity_icon.dart index f7f7242..7cfd804 100644 --- a/lib/entity_widgets/entity_icon.dart +++ b/lib/entity_widgets/entity_icon.dart @@ -6,8 +6,7 @@ class EntityIcon extends StatelessWidget { final double size; final Color color; - const EntityIcon({Key key, this.color, this.size: Sizes.iconSize, this.padding: const EdgeInsets.fromLTRB( - Sizes.leftWidgetPadding, 0.0, 12.0, 0.0)}) : super(key: key); + const EntityIcon({Key key, this.color, this.size: Sizes.iconSize, this.padding: const EdgeInsets.all(0.0)}) : super(key: key); int getDefaultIconByEntityId(String entityId, String deviceClass, String state) { String domain = entityId.split(".")[0]; @@ -29,8 +28,22 @@ class EntityIcon extends StatelessWidget { return null; } if (data.entity.entityPicture != null) { + return Container( + height: size+12, + width: size+12, + decoration: BoxDecoration( + shape: BoxShape.circle, + image: DecorationImage( + fit:BoxFit.cover, + image: CachedNetworkImageProvider( + "$homeAssistantWebHost${data.entity.entityPicture}", + ), + ) + ), + ); return CircleAvatar( - radius: size/2, + radius: size/2+0, + backgroundColor: Colors.white, backgroundImage: CachedNetworkImageProvider( "$homeAssistantWebHost${data.entity.entityPicture}", @@ -45,10 +58,13 @@ class EntityIcon extends StatelessWidget { iconCode = getDefaultIconByEntityId(data.entity.entityId, data.entity.deviceClass, data.entity.state); // } - return Icon( - IconData(iconCode, fontFamily: 'Material Design Icons'), - size: size, - color: color, + 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, + ) ); } } diff --git a/lib/ui_widgets/card_widget.dart b/lib/ui_widgets/card_widget.dart index 6b248ae..3f1c132 100644 --- a/lib/ui_widgets/card_widget.dart +++ b/lib/ui_widgets/card_widget.dart @@ -103,7 +103,7 @@ class CardWidget extends StatelessWidget { if (!entity.entity.isHidden) { body.add( Padding( - padding: EdgeInsets.fromLTRB(0.0, Sizes.rowPadding, 0.0, Sizes.rowPadding), + padding: EdgeInsets.fromLTRB(10.0, 4.0, 0.0, 4.0), child: EntityModel( entityWrapper: entity, handleTap: true,