diff --git a/assets/icons/edit.svg b/assets/icons/edit.svg
new file mode 100644
index 00000000..ac510f4a
--- /dev/null
+++ b/assets/icons/edit.svg
@@ -0,0 +1,4 @@
+
diff --git a/lib/pages/spaces_management/bloc/space_management_bloc.dart b/lib/pages/spaces_management/bloc/space_management_bloc.dart
index 4b79ff1c..401a960a 100644
--- a/lib/pages/spaces_management/bloc/space_management_bloc.dart
+++ b/lib/pages/spaces_management/bloc/space_management_bloc.dart
@@ -20,6 +20,24 @@ class SpaceManagementBloc extends Bloc(_onSaveSpaces);
on(_onFetchProducts);
on(_onCommunityDelete);
+ on(_onUpdateCommunity);
+ }
+
+ void _onUpdateCommunity(
+ UpdateCommunityEvent event,
+ Emitter emit,
+ ) async {
+ try {
+ emit(SpaceManagementLoading());
+ final success = await _api.updateCommunity(event.communityUuid, event.name);
+ if (success) {
+ add(LoadCommunityAndSpacesEvent());
+ } else {
+ emit(const SpaceManagementError('Failed to update the community.'));
+ }
+ } catch (e) {
+ emit(SpaceManagementError('Error updating community: $e'));
+ }
}
void _onFetchProducts(
@@ -160,7 +178,7 @@ class SpaceManagementBloc extends Bloc get props => [communityId];
}
+
+class UpdateCommunityEvent extends SpaceManagementEvent {
+ final String communityUuid;
+ final String name;
+
+ const UpdateCommunityEvent({
+ required this.communityUuid,
+ required this.name,
+ });
+
+ @override
+ List