diff --git a/lib/features/scene/bloc/create_scene/create_scene_bloc.dart b/lib/features/scene/bloc/create_scene/create_scene_bloc.dart index b21ef5c..59cd89e 100644 --- a/lib/features/scene/bloc/create_scene/create_scene_bloc.dart +++ b/lib/features/scene/bloc/create_scene/create_scene_bloc.dart @@ -470,25 +470,24 @@ class CreateSceneBloc extends Bloc ///scene/icon /// -List iconModel = []; + List iconModel = []; -FutureOr _fetchIconScene( - SceneIconEvent event, Emitter emit) async { - emit(CreateSceneLoading()); - try { - final response = await SceneApi.getIcon(); - - // Parse the response as a List of IconModel - iconModel = (response as List) - .map((iconJson) => IconModel.fromJson(iconJson as Map)) - .toList(); - - emit(CreateSceneLoaded(iconModel)); // Ensure this state is defined to handle the loaded list - } catch (e) { - emit(const CreateSceneError(message: 'Something went wrong')); + FutureOr _fetchIconScene( + SceneIconEvent event, Emitter emit) async { + emit(CreateSceneLoading()); + try { + final response = await SceneApi.getIcon(); + iconModel = (response as List) + .map((iconJson) => + IconModel.fromJson(iconJson as Map)) + .toList(); + print(iconModel[0].iconBase64.toString()); + emit(CreateSceneLoaded( + iconModel)); // Ensure this state is defined to handle the loaded list + } catch (e) { + emit(const CreateSceneError(message: 'Something went wrong')); + } } -} - String _getDayFromIndex(int index) { const days = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']; diff --git a/lib/features/scene/view/scene_auto_settings.dart b/lib/features/scene/view/scene_auto_settings.dart index f61a881..2b47ec2 100644 --- a/lib/features/scene/view/scene_auto_settings.dart +++ b/lib/features/scene/view/scene_auto_settings.dart @@ -63,8 +63,6 @@ class SceneAutoSettings extends StatelessWidget { return CircularProgressIndicator(); } else if (state is CreateSceneLoaded) { return Container( - height: 100, - width: 100, child: ListView.builder( itemCount: state.iconModels.length, diff --git a/lib/services/api/scene_api.dart b/lib/services/api/scene_api.dart index bfe3e1b..13511a5 100644 --- a/lib/services/api/scene_api.dart +++ b/lib/services/api/scene_api.dart @@ -133,9 +133,6 @@ class SceneApi { rethrow; } } - - //getScene - static Future getSceneDetails(String sceneId) async { try { final response = await _httpService.get(