mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2025-01-25 19:44:17 +01:00
chore: Follow up leave abandoned DM room
This commit is contained in:
parent
ddb7cc841b
commit
4afb9a4790
@ -165,6 +165,20 @@ class ChatController extends State<Chat> {
|
|||||||
VRouter.of(context).toSegments(['rooms', roomId]);
|
VRouter.of(context).toSegments(['rooms', roomId]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void leaveChat() async {
|
||||||
|
final room = this.room;
|
||||||
|
if (room == null) {
|
||||||
|
throw Exception(
|
||||||
|
'Leave room button clicked while room is null. This should not be possible from the UI!');
|
||||||
|
}
|
||||||
|
final success = await showFutureLoadingDialog(
|
||||||
|
context: context,
|
||||||
|
future: room.leave,
|
||||||
|
);
|
||||||
|
if (success.error != null) return;
|
||||||
|
VRouter.of(context).to('/rooms');
|
||||||
|
}
|
||||||
|
|
||||||
EmojiPickerType emojiPickerType = EmojiPickerType.keyboard;
|
EmojiPickerType emojiPickerType = EmojiPickerType.keyboard;
|
||||||
|
|
||||||
void requestHistory() async {
|
void requestHistory() async {
|
||||||
|
@ -298,6 +298,8 @@ class ChatView extends StatelessWidget {
|
|||||||
children: [
|
children: [
|
||||||
TextButton.icon(
|
TextButton.icon(
|
||||||
style: TextButton.styleFrom(
|
style: TextButton.styleFrom(
|
||||||
|
padding:
|
||||||
|
const EdgeInsets.all(16),
|
||||||
foregroundColor:
|
foregroundColor:
|
||||||
Theme.of(context)
|
Theme.of(context)
|
||||||
.colorScheme
|
.colorScheme
|
||||||
@ -306,12 +308,16 @@ class ChatView extends StatelessWidget {
|
|||||||
icon: const Icon(
|
icon: const Icon(
|
||||||
Icons.archive_outlined,
|
Icons.archive_outlined,
|
||||||
),
|
),
|
||||||
onPressed: () {},
|
onPressed: controller.leaveChat,
|
||||||
label: Text(
|
label: Text(
|
||||||
L10n.of(context)!.leave,
|
L10n.of(context)!.leave,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
TextButton.icon(
|
TextButton.icon(
|
||||||
|
style: TextButton.styleFrom(
|
||||||
|
padding:
|
||||||
|
const EdgeInsets.all(16),
|
||||||
|
),
|
||||||
icon: const Icon(
|
icon: const Icon(
|
||||||
Icons.chat_outlined,
|
Icons.chat_outlined,
|
||||||
),
|
),
|
||||||
|
Loading…
Reference in New Issue
Block a user