fixed icon assets issue

This commit is contained in:
hannathkadher
2024-11-05 15:53:31 +04:00
parent e9615cd351
commit 9c873fb0c5

View File

@ -40,10 +40,13 @@ class SceneListview extends StatelessWidget {
sceneName: scene.name, sceneName: scene.name,
), ),
); );
context.read<SmartSceneSelectBloc>().add(const SmartSceneClearEvent()); context
.read<SmartSceneSelectBloc>()
.add(const SmartSceneClearEvent());
BlocProvider.of<CreateSceneBloc>(context) BlocProvider.of<CreateSceneBloc>(context).add(
.add(FetchSceneTasksEvent(sceneId: scene.id, isAutomation: false)); FetchSceneTasksEvent(
sceneId: scene.id, isAutomation: false));
/// the state to set the scene type must be after the fetch /// the state to set the scene type must be after the fetch
BlocProvider.of<CreateSceneBloc>(context) BlocProvider.of<CreateSceneBloc>(context)
@ -56,14 +59,27 @@ class SceneListview extends StatelessWidget {
children: [ children: [
Padding( Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: Image.memory( child: scene.iconInBytes != null &&
height: 32, scene.iconInBytes.isNotEmpty
width: 32, ? Image.memory(
scene.iconInBytes, scene.iconInBytes,
fit: BoxFit.fill, height: 32,
errorBuilder: (context, error, stackTrace) => Image.asset( width: 32,
height: 32, width: 32, fit: BoxFit.fill, Assets.assetsIconsLogo), 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( Expanded(
child: BodyMedium( child: BodyMedium(