mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-08-26 07:59:40 +00:00
Compare commits
4 Commits
f03c28f7fd
...
06f00da02c
Author | SHA1 | Date | |
---|---|---|---|
06f00da02c | |||
7b5b40a03c | |||
8522c0bbc3 | |||
fc70669f1d |
@ -2,6 +2,8 @@ import 'package:syncrow_web/pages/space_management_v2/modules/communities/domain
|
|||||||
import 'package:syncrow_web/pages/space_management_v2/modules/space_details/domain/models/space_details_model.dart';
|
import 'package:syncrow_web/pages/space_management_v2/modules/space_details/domain/models/space_details_model.dart';
|
||||||
|
|
||||||
abstract final class SpacesRecursiveHelper {
|
abstract final class SpacesRecursiveHelper {
|
||||||
|
const SpacesRecursiveHelper._();
|
||||||
|
|
||||||
static List<SpaceModel> recusrivelyUpdate(
|
static List<SpaceModel> recusrivelyUpdate(
|
||||||
List<SpaceModel> spaces,
|
List<SpaceModel> spaces,
|
||||||
SpaceDetailsModel updatedSpace,
|
SpaceDetailsModel updatedSpace,
|
||||||
@ -41,20 +43,26 @@ abstract final class SpacesRecursiveHelper {
|
|||||||
return nonNullSpaces;
|
return nonNullSpaces;
|
||||||
}
|
}
|
||||||
|
|
||||||
static List<SpaceModel> recusrivelyInsert(
|
static List<SpaceModel> recursivelyInsert({
|
||||||
List<SpaceModel> spaces,
|
required List<SpaceModel> spaces,
|
||||||
SpaceModel newSpace,
|
required String parentUuid,
|
||||||
String parentUuid,
|
required SpaceModel newSpace,
|
||||||
) {
|
}) {
|
||||||
return spaces.map((space) {
|
return spaces.map((space) {
|
||||||
if (space.uuid == parentUuid) {
|
final isParentSpace = space.uuid == parentUuid;
|
||||||
|
if (isParentSpace) {
|
||||||
return space.copyWith(
|
return space.copyWith(
|
||||||
children: [...space.children, newSpace],
|
children: [...space.children, newSpace],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (space.children.isNotEmpty) {
|
final hasChildren = space.children.isNotEmpty;
|
||||||
|
if (hasChildren) {
|
||||||
return space.copyWith(
|
return space.copyWith(
|
||||||
children: recusrivelyInsert(space.children, newSpace, parentUuid),
|
children: recursivelyInsert(
|
||||||
|
spaces: space.children,
|
||||||
|
parentUuid: parentUuid,
|
||||||
|
newSpace: newSpace,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return space;
|
return space;
|
||||||
|
@ -330,10 +330,10 @@ class _CommunityStructureCanvasState extends State<CommunityStructureCanvas>
|
|||||||
communityUuid: widget.community.uuid,
|
communityUuid: widget.community.uuid,
|
||||||
parentUuid: space.uuid,
|
parentUuid: space.uuid,
|
||||||
onSuccess: (updatedSpaceModel) {
|
onSuccess: (updatedSpaceModel) {
|
||||||
final updatedSpaces = SpacesRecursiveHelper.recusrivelyInsert(
|
final updatedSpaces = SpacesRecursiveHelper.recursivelyInsert(
|
||||||
spaces,
|
spaces: widget.community.spaces,
|
||||||
updatedSpaceModel,
|
parentUuid: space.uuid,
|
||||||
space.uuid,
|
newSpace: updatedSpaceModel,
|
||||||
);
|
);
|
||||||
context.read<CommunitiesBloc>().add(
|
context.read<CommunitiesBloc>().add(
|
||||||
CommunitiesUpdateCommunity(
|
CommunitiesUpdateCommunity(
|
||||||
|
@ -20,9 +20,9 @@ class CommunityStructureHeader extends StatelessWidget {
|
|||||||
color: ColorsManager.whiteColors,
|
color: ColorsManager.whiteColors,
|
||||||
boxShadow: [
|
boxShadow: [
|
||||||
BoxShadow(
|
BoxShadow(
|
||||||
color: ColorsManager.shadowBlackColor,
|
color: ColorsManager.shadowBlackColor.withValues(alpha: 0.1),
|
||||||
blurRadius: 8,
|
blurRadius: 20,
|
||||||
offset: const Offset(0, 4),
|
offset: const Offset(0, 1),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
@ -13,7 +13,7 @@ class CreateSpaceParam {
|
|||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
return {
|
return {
|
||||||
'spaceModelUuid': parentUuid,
|
'parentUuid': parentUuid,
|
||||||
...space.toJson(),
|
...space.toJson(),
|
||||||
'x': 0,
|
'x': 0,
|
||||||
'y': 0,
|
'y': 0,
|
||||||
|
Reference in New Issue
Block a user