mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-11-24 04:59:26 +01:00
Forget rooms with slide
This commit is contained in:
parent
be8f3a4a47
commit
e13df1cbf0
@ -88,6 +88,14 @@ class ChatListItem extends StatelessWidget {
|
||||
|
||||
Future<bool> archiveAction(BuildContext context) async {
|
||||
{
|
||||
if ([Membership.leave, Membership.ban].contains(room.membership)) {
|
||||
final success =
|
||||
await Matrix.of(context).tryRequestWithLoadingDialog(room.forget());
|
||||
if (success != false) {
|
||||
if (this.onForget != null) this.onForget();
|
||||
}
|
||||
return success;
|
||||
}
|
||||
final bool confirmed = await SimpleDialogs(context).askConfirmation();
|
||||
if (!confirmed) {
|
||||
return false;
|
||||
@ -113,6 +121,13 @@ class ChatListItem extends StatelessWidget {
|
||||
icon: Icons.archive,
|
||||
onTap: () => archiveAction(context),
|
||||
),
|
||||
if ([Membership.leave, Membership.ban].contains(room.membership))
|
||||
IconSlideAction(
|
||||
caption: I18n.of(context).delete,
|
||||
color: Colors.red,
|
||||
icon: Icons.delete_forever,
|
||||
onTap: () => archiveAction(context),
|
||||
),
|
||||
],
|
||||
actionPane: SlidableDrawerActionPane(),
|
||||
dismissal: SlidableDismissal(
|
||||
|
@ -36,7 +36,7 @@ class _ArchiveState extends State<Archive> {
|
||||
itemCount: archive.length,
|
||||
itemBuilder: (BuildContext context, int i) => ChatListItem(
|
||||
archive[i],
|
||||
onForget: () => setState(() => archive = null)),
|
||||
onForget: () => setState(() => archive.removeAt(i))),
|
||||
);
|
||||
}
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user