Refactor DuplicateSpaceService to return a list of SpaceModel objects instead of a single instance. Update related components including DuplicateSpaceSuccess state and DuplicateSpaceDialog to handle multiple spaces. Enhance CommunityStructureHeaderActionButtonsComposer to reflect these changes in the success callback.

This commit is contained in:
Faris Armoush
2025-07-23 12:42:23 +03:00
parent d21850edc8
commit 2077ef053f
5 changed files with 23 additions and 17 deletions

View File

@ -1,5 +1,3 @@
import 'dart:developer';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:syncrow_web/pages/space_management_v2/main_module/helpers/spaces_recursive_helper.dart';
@ -53,8 +51,16 @@ class CommunityStructureHeaderActionButtonsComposer extends StatelessWidget {
initialName: space.spaceName,
selectedSpaceUuid: space.uuid,
selectedCommunityUuid: selectedCommunity.uuid,
onSuccess: (space) {
log('space: $space');
onSuccess: (spaces) {
final updatedCommunity = selectedCommunity.copyWith(
spaces: spaces,
);
context.read<CommunitiesBloc>().add(
CommunitiesUpdateCommunity(updatedCommunity),
);
context.read<CommunitiesTreeSelectionBloc>().add(
SelectCommunityEvent(community: updatedCommunity),
);
},
),
),