mirror of
https://github.com/SyncrowIOT/web.git
synced 2026-10-24 18:07:57 +00:00
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:
+3
-3
@@ -16,12 +16,12 @@ final class DuplicateSpaceLoading extends DuplicateSpaceState {
|
||||
}
|
||||
|
||||
final class DuplicateSpaceSuccess extends DuplicateSpaceState {
|
||||
const DuplicateSpaceSuccess(this.space);
|
||||
const DuplicateSpaceSuccess(this.spaces);
|
||||
|
||||
final SpaceModel space;
|
||||
final List<SpaceModel> spaces;
|
||||
|
||||
@override
|
||||
List<Object> get props => [space];
|
||||
List<Object> get props => [spaces];
|
||||
}
|
||||
|
||||
final class DuplicateSpaceFailure extends DuplicateSpaceState {
|
||||
|
||||
+4
-6
@@ -18,7 +18,7 @@ class DuplicateSpaceDialog extends StatelessWidget {
|
||||
});
|
||||
|
||||
final String initialName;
|
||||
final void Function(SpaceModel space) onSuccess;
|
||||
final void Function(List<SpaceModel> spaces) onSuccess;
|
||||
final String selectedSpaceUuid;
|
||||
final String selectedCommunityUuid;
|
||||
|
||||
@@ -55,13 +55,11 @@ class DuplicateSpaceDialog extends StatelessWidget {
|
||||
context.showFailureSnackbar(errorMessage);
|
||||
break;
|
||||
|
||||
case DuplicateSpaceSuccess(:final space):
|
||||
onSuccess.call(space);
|
||||
case DuplicateSpaceSuccess(:final spaces):
|
||||
onSuccess.call(spaces);
|
||||
Navigator.of(context).pop();
|
||||
Navigator.of(context).pop();
|
||||
context.showSuccessSnackbar(
|
||||
'${space.spaceName} duplicated successfully',
|
||||
);
|
||||
context.showSuccessSnackbar('Space duplicated successfully');
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user