fixed delete community

This commit is contained in:
hannathkadher
2024-11-21 13:02:48 +04:00
parent 8a7f9ab2dc
commit 288360f1af
5 changed files with 64 additions and 28 deletions

View File

@ -119,7 +119,6 @@ class _CommunityStructureAreaState extends State<CommunityStructureArea> {
return SpaceContainerWidget(
index: index,
onDoubleTap: () {
print(spaces[index].toString());
_showEditSpaceDialog(spaces[index]);
},
icon: spaces[index].icon ?? '',
@ -209,12 +208,12 @@ class _CommunityStructureAreaState extends State<CommunityStructureArea> {
onPressed: () {
showDeleteConfirmationDialog(context, () {
// Handle the delete action here
print("Delete confirmed");
Navigator.of(context).pop(); // Close the dialog after confirming
_onDelete();
}, widget.selectedSpace != null);
},
icon: SvgPicture.asset(
Assets.acFanAuto, // Path to your SVG asset
Assets.delete, // Path to your SVG asset
width: 18, // Adjust width as needed
height: 18, // Adjust height as needed
),
@ -426,4 +425,13 @@ class _CommunityStructureAreaState extends State<CommunityStructureArea> {
communityUuid: communityUuid,
));
}
void _onDelete() {
if (widget.selectedCommunity != null && widget.selectedCommunity?.uuid != null) {
context.read<SpaceManagementBloc>().add(DeleteCommunityEvent(
communityUuid: widget.selectedCommunity!.uuid,
));
}
}
}