mirror of
https://github.com/Iconica-Development/flutter_chat.git
synced 2025-05-19 10:53:51 +02:00
feat: confirm deleting chat
This commit is contained in:
parent
3dde81838d
commit
e7f7ff5f27
6 changed files with 43 additions and 6 deletions
|
@ -179,7 +179,7 @@ packages:
|
||||||
description:
|
description:
|
||||||
path: "packages/flutter_community_chat_interface"
|
path: "packages/flutter_community_chat_interface"
|
||||||
ref: HEAD
|
ref: HEAD
|
||||||
resolved-ref: a6b21aab224b47e112ae771b3ce81c158843ee5d
|
resolved-ref: "68578b8ac21493b88cd5b1a2fd55634f0616ff77"
|
||||||
url: "https://github.com/Iconica-Development/flutter_community_chat.git"
|
url: "https://github.com/Iconica-Development/flutter_community_chat.git"
|
||||||
source: git
|
source: git
|
||||||
version: "0.0.1"
|
version: "0.0.1"
|
||||||
|
@ -188,7 +188,7 @@ packages:
|
||||||
description:
|
description:
|
||||||
path: "packages/flutter_community_chat_view"
|
path: "packages/flutter_community_chat_view"
|
||||||
ref: HEAD
|
ref: HEAD
|
||||||
resolved-ref: a6b21aab224b47e112ae771b3ce81c158843ee5d
|
resolved-ref: "68578b8ac21493b88cd5b1a2fd55634f0616ff77"
|
||||||
url: "https://github.com/Iconica-Development/flutter_community_chat.git"
|
url: "https://github.com/Iconica-Development/flutter_community_chat.git"
|
||||||
source: git
|
source: git
|
||||||
version: "0.0.1"
|
version: "0.0.1"
|
||||||
|
|
|
@ -228,7 +228,7 @@ packages:
|
||||||
description:
|
description:
|
||||||
path: "packages/flutter_community_chat_interface"
|
path: "packages/flutter_community_chat_interface"
|
||||||
ref: HEAD
|
ref: HEAD
|
||||||
resolved-ref: a6b21aab224b47e112ae771b3ce81c158843ee5d
|
resolved-ref: "68578b8ac21493b88cd5b1a2fd55634f0616ff77"
|
||||||
url: "https://github.com/Iconica-Development/flutter_community_chat.git"
|
url: "https://github.com/Iconica-Development/flutter_community_chat.git"
|
||||||
source: git
|
source: git
|
||||||
version: "0.0.1"
|
version: "0.0.1"
|
||||||
|
|
|
@ -186,7 +186,7 @@ packages:
|
||||||
description:
|
description:
|
||||||
path: "packages/flutter_community_chat_interface"
|
path: "packages/flutter_community_chat_interface"
|
||||||
ref: HEAD
|
ref: HEAD
|
||||||
resolved-ref: a6b21aab224b47e112ae771b3ce81c158843ee5d
|
resolved-ref: "68578b8ac21493b88cd5b1a2fd55634f0616ff77"
|
||||||
url: "https://github.com/Iconica-Development/flutter_community_chat.git"
|
url: "https://github.com/Iconica-Development/flutter_community_chat.git"
|
||||||
source: git
|
source: git
|
||||||
version: "0.0.1"
|
version: "0.0.1"
|
||||||
|
|
|
@ -13,6 +13,11 @@ class ChatTranslations {
|
||||||
this.messagePlaceholder = 'Write your message here...',
|
this.messagePlaceholder = 'Write your message here...',
|
||||||
this.imageUploading = 'Image is uploading...',
|
this.imageUploading = 'Image is uploading...',
|
||||||
this.deleteChatButton = 'Delete',
|
this.deleteChatButton = 'Delete',
|
||||||
|
this.deleteChatModalTitle = 'Delete chat',
|
||||||
|
this.deleteChatModalDescription =
|
||||||
|
'Are you sure you want to delete this chat?',
|
||||||
|
this.deleteChatModalCancel = 'Cancel',
|
||||||
|
this.deleteChatModalConfirm = 'Delete',
|
||||||
});
|
});
|
||||||
|
|
||||||
final String chatsTitle;
|
final String chatsTitle;
|
||||||
|
@ -24,4 +29,8 @@ class ChatTranslations {
|
||||||
final String cancelImagePickerBtn;
|
final String cancelImagePickerBtn;
|
||||||
final String messagePlaceholder;
|
final String messagePlaceholder;
|
||||||
final String imageUploading;
|
final String imageUploading;
|
||||||
|
final String deleteChatModalTitle;
|
||||||
|
final String deleteChatModalDescription;
|
||||||
|
final String deleteChatModalCancel;
|
||||||
|
final String deleteChatModalConfirm;
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,35 @@ class _ChatScreenState extends State<ChatScreen> {
|
||||||
for (ChatModel chat in snapshot.data ?? [])
|
for (ChatModel chat in snapshot.data ?? [])
|
||||||
Builder(
|
Builder(
|
||||||
builder: (context) => Dismissible(
|
builder: (context) => Dismissible(
|
||||||
onDismissed: (_) => widget.onDeleteChat(chat),
|
onDismissed: (_) => showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (BuildContext context) => AlertDialog(
|
||||||
|
title: Text(
|
||||||
|
widget.translations.deleteChatModalTitle,
|
||||||
|
),
|
||||||
|
content: Text(
|
||||||
|
widget.translations
|
||||||
|
.deleteChatModalDescription,
|
||||||
|
),
|
||||||
|
actions: [
|
||||||
|
TextButton(
|
||||||
|
child: Text(
|
||||||
|
widget
|
||||||
|
.translations.deleteChatModalCancel,
|
||||||
|
),
|
||||||
|
onPressed: () {},
|
||||||
|
),
|
||||||
|
ElevatedButton(
|
||||||
|
onPressed: () =>
|
||||||
|
widget.onDeleteChat(chat),
|
||||||
|
child: Text(
|
||||||
|
widget.translations
|
||||||
|
.deleteChatModalConfirm,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
background: Container(
|
background: Container(
|
||||||
color: Colors.red,
|
color: Colors.red,
|
||||||
child: Align(
|
child: Align(
|
||||||
|
|
|
@ -179,7 +179,7 @@ packages:
|
||||||
description:
|
description:
|
||||||
path: "packages/flutter_community_chat_interface"
|
path: "packages/flutter_community_chat_interface"
|
||||||
ref: HEAD
|
ref: HEAD
|
||||||
resolved-ref: a6b21aab224b47e112ae771b3ce81c158843ee5d
|
resolved-ref: "68578b8ac21493b88cd5b1a2fd55634f0616ff77"
|
||||||
url: "https://github.com/Iconica-Development/flutter_community_chat.git"
|
url: "https://github.com/Iconica-Development/flutter_community_chat.git"
|
||||||
source: git
|
source: git
|
||||||
version: "0.0.1"
|
version: "0.0.1"
|
||||||
|
|
Loading…
Reference in a new issue