From 9c873fb0c5b88f0c2ba32b52f100de5877c03a27 Mon Sep 17 00:00:00 2001 From: hannathkadher Date: Tue, 5 Nov 2024 15:53:31 +0400 Subject: [PATCH] fixed icon assets issue --- .../devices/view/widgets/scene_listview.dart | 38 +++++++++++++------ 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/lib/features/devices/view/widgets/scene_listview.dart b/lib/features/devices/view/widgets/scene_listview.dart index 4fa2031..5a19bc5 100644 --- a/lib/features/devices/view/widgets/scene_listview.dart +++ b/lib/features/devices/view/widgets/scene_listview.dart @@ -40,10 +40,13 @@ class SceneListview extends StatelessWidget { sceneName: scene.name, ), ); - context.read().add(const SmartSceneClearEvent()); + context + .read() + .add(const SmartSceneClearEvent()); - BlocProvider.of(context) - .add(FetchSceneTasksEvent(sceneId: scene.id, isAutomation: false)); + BlocProvider.of(context).add( + FetchSceneTasksEvent( + sceneId: scene.id, isAutomation: false)); /// the state to set the scene type must be after the fetch BlocProvider.of(context) @@ -56,14 +59,27 @@ class SceneListview extends StatelessWidget { children: [ Padding( padding: const EdgeInsets.all(8.0), - child: Image.memory( - height: 32, - width: 32, - scene.iconInBytes, - fit: BoxFit.fill, - errorBuilder: (context, error, stackTrace) => Image.asset( - height: 32, width: 32, fit: BoxFit.fill, Assets.assetsIconsLogo), - ), + child: scene.iconInBytes != null && + scene.iconInBytes.isNotEmpty + ? Image.memory( + scene.iconInBytes, + height: 32, + width: 32, + fit: BoxFit.fill, + errorBuilder: (context, error, stackTrace) => + Image.asset( + Assets.assetsIconsLogo, + height: 32, + width: 32, + fit: BoxFit.fill, + ), + ) + : Image.asset( + Assets.assetsIconsLogo, + height: 32, + width: 32, + fit: BoxFit.fill, + ), ), Expanded( child: BodyMedium(