From 6c96f849faf1959f4abd1fbe2f1dcff89c382081 Mon Sep 17 00:00:00 2001 From: Waqas Date: Mon, 29 Apr 2024 11:20:27 -0400 Subject: [PATCH] Archive Button --- lib/pages/chat_details/chat_details_view.dart | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/lib/pages/chat_details/chat_details_view.dart b/lib/pages/chat_details/chat_details_view.dart index ddb64b167..2b6f22d5f 100644 --- a/lib/pages/chat_details/chat_details_view.dart +++ b/lib/pages/chat_details/chat_details_view.dart @@ -559,6 +559,39 @@ class ChatDetailsView extends StatelessWidget { } }, ), + if (!room.isDirectChat) + ListTile( + title: Text(L10n.of(context)!.archive), + subtitle: Text( + L10n.of(context)!.archiveRoomDescription, + ), + leading: CircleAvatar( + backgroundColor: + Theme.of(context).scaffoldBackgroundColor, + foregroundColor: iconColor, + child: const Icon( + Icons.edit_attributes_outlined, + ), + ), + trailing: const Icon(Icons.chevron_right_outlined), + onTap: () async { + final confirmed = await showOkCancelAlertDialog( + useRootNavigator: false, + context: context, + title: L10n.of(context)!.areYouSure, + okLabel: L10n.of(context)!.yes, + cancelLabel: L10n.of(context)!.no, + message: + L10n.of(context)!.archiveRoomDescription, + ); + if (confirmed == OkCancelResult.cancel) return; + await showFutureLoadingDialog( + context: context, + future: () => room.leave(), + ); + }, + ), + if (room.isRoomAdmin && !room.isDirectChat) SwitchListTile.adaptive( activeColor: AppConfig.activeToggleColor,