diff --git a/lib/pages/spaces_management/all_spaces/bloc/space_management_bloc.dart b/lib/pages/spaces_management/all_spaces/bloc/space_management_bloc.dart index a171f2a7..ffa5687e 100644 --- a/lib/pages/spaces_management/all_spaces/bloc/space_management_bloc.dart +++ b/lib/pages/spaces_management/all_spaces/bloc/space_management_bloc.dart @@ -309,8 +309,6 @@ class SpaceManagementBloc await _api.deleteSpace(communityUuid, parent.uuid!); } } catch (e) { - print( - 'Error deleting space ${parent.name} (UUID: ${parent.uuid}, Community UUID: $communityUuid): $e'); rethrow; // Decide whether to stop execution or continue } } @@ -342,7 +340,6 @@ class SpaceManagementBloc space.uuid = response?.uuid; } } catch (e) { - print('Error creating space ${space.name}: $e'); rethrow; // Stop further execution on failure } } diff --git a/lib/pages/spaces_management/all_spaces/widgets/dialogs/create_space_dialog.dart b/lib/pages/spaces_management/all_spaces/widgets/dialogs/create_space_dialog.dart index e0853e3a..f6a02833 100644 --- a/lib/pages/spaces_management/all_spaces/widgets/dialogs/create_space_dialog.dart +++ b/lib/pages/spaces_management/all_spaces/widgets/dialogs/create_space_dialog.dart @@ -133,13 +133,7 @@ class CreateSpaceDialogState extends State { isNameFieldInvalid = value.isEmpty; if (!isNameFieldInvalid) { - if ((widget.parentSpace?.children.any( - (child) => child.name == value) ?? - false) || - (widget.parentSpace?.name == value) || - (widget.editSpace?.children.any( - (child) => child.name == value) ?? - false)) { + if (_isNameConflict(value)) { isNameFieldExist = true; isOkButtonEnabled = false; } else { @@ -387,7 +381,14 @@ class CreateSpaceDialogState extends State { ); } - + bool _isNameConflict(String value) { + return (widget.parentSpace?.children.any((child) => child.name == value) ?? + false) || + (widget.parentSpace?.name == value) || + (widget.editSpace?.parent?.name == value) || + (widget.editSpace?.children.any((child) => child.name == value) ?? + false); + } String _mapIconToProduct(String uuid, List products) { // Find the product with the matching UUID