updated subspace edit flow

This commit is contained in:
hannathkadher
2025-01-22 17:21:35 +04:00
parent f35b699d4c
commit ba7db3a5fb
5 changed files with 70 additions and 134 deletions

View File

@ -177,7 +177,7 @@ class _CommunityStructureAreaState extends State<CommunityStructureArea> {
painter: CurvedLinePainter([connection])),
),
for (var entry in spaces.asMap().entries)
if (entry.value.status != SpaceStatus.deleted ||
if (entry.value.status != SpaceStatus.deleted &&
entry.value.status != SpaceStatus.parentDeleted)
Positioned(
left: entry.value.position.dx,
@ -301,7 +301,6 @@ class _CommunityStructureAreaState extends State<CommunityStructureArea> {
List<Tag>? tags) {
setState(() {
// Set the first space in the center or use passed position
Offset centerPosition =
position ?? _getCenterPosition(screenSize);
SpaceModel newSpace = SpaceModel(
@ -385,10 +384,10 @@ class _CommunityStructureAreaState extends State<CommunityStructureArea> {
void flatten(SpaceModel space) {
if (space.status == SpaceStatus.deleted ||
space.status == SpaceStatus.parentDeleted) return;
space.status == SpaceStatus.parentDeleted) {
return;
}
result.add(space);
for (var child in space.children) {
flatten(child);
}
@ -456,21 +455,17 @@ class _CommunityStructureAreaState extends State<CommunityStructureArea> {
}
void _onDelete() {
if (widget.selectedCommunity != null &&
widget.selectedCommunity?.uuid != null &&
widget.selectedSpace == null) {
context.read<SpaceManagementBloc>().add(DeleteCommunityEvent(
communityUuid: widget.selectedCommunity!.uuid,
));
}
if (widget.selectedSpace != null) {
setState(() {
for (var space in spaces) {
if (space.uuid == widget.selectedSpace?.uuid) {
if (space.internalId == widget.selectedSpace?.internalId) {
space.status = SpaceStatus.deleted;
_markChildrenAsDeleted(space);
}
}
for (var space in spaces) {
print("space ${space.name} and ${space.status}");
}
_removeConnectionsForDeletedSpaces();
});
}