mirror of
https://github.com/Iconica-Development/flutter_chat.git
synced 2025-05-19 02:43:50 +02:00
refactor: change delete chat snackbar
This commit is contained in:
parent
6bafc86a2d
commit
e85b107038
2 changed files with 103 additions and 68 deletions
|
@ -163,6 +163,8 @@ class _ChatScreenState extends State<ChatScreen> {
|
||||||
padding: const EdgeInsets.all(16.0),
|
padding: const EdgeInsets.all(16.0),
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
crossAxisAlignment:
|
||||||
|
CrossAxisAlignment.stretch,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
chat.canBeDeleted
|
chat.canBeDeleted
|
||||||
|
@ -170,50 +172,80 @@ class _ChatScreenState extends State<ChatScreen> {
|
||||||
.deleteChatModalTitle
|
.deleteChatModalTitle
|
||||||
: translations
|
: translations
|
||||||
.chatCantBeDeleted,
|
.chatCantBeDeleted,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 20,
|
fontSize: 24,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 16),
|
const SizedBox(height: 24),
|
||||||
if (chat.canBeDeleted)
|
if (chat.canBeDeleted)
|
||||||
Text(
|
Padding(
|
||||||
|
padding: const EdgeInsets
|
||||||
|
.symmetric(
|
||||||
|
horizontal: 16,
|
||||||
|
),
|
||||||
|
child: Text(
|
||||||
translations
|
translations
|
||||||
.deleteChatModalDescription,
|
.deleteChatModalDescription,
|
||||||
|
textAlign:
|
||||||
|
TextAlign.center,
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 16,
|
fontSize: 18,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 16),
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 24,
|
||||||
|
),
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment:
|
mainAxisAlignment:
|
||||||
MainAxisAlignment.center,
|
MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
TextButton(
|
|
||||||
child: Text(
|
|
||||||
translations
|
|
||||||
.deleteChatModalCancel,
|
|
||||||
style: const TextStyle(
|
|
||||||
fontSize: 16,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
onPressed: () =>
|
|
||||||
Navigator.of(
|
|
||||||
context,
|
|
||||||
).pop(false),
|
|
||||||
),
|
|
||||||
if (chat.canBeDeleted)
|
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
onPressed: () =>
|
onPressed: () =>
|
||||||
Navigator.of(
|
Navigator.of(
|
||||||
context,
|
context,
|
||||||
).pop(true),
|
).pop(false),
|
||||||
|
child: Text(
|
||||||
|
translations
|
||||||
|
.deleteChatModalCancel,
|
||||||
|
style: const TextStyle(
|
||||||
|
color: Colors.black,
|
||||||
|
fontSize: 18,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
if (chat.canBeDeleted)
|
||||||
|
const SizedBox(
|
||||||
|
width: 16,
|
||||||
|
),
|
||||||
|
if (chat.canBeDeleted)
|
||||||
|
ElevatedButton(
|
||||||
|
style: ElevatedButton
|
||||||
|
.styleFrom(
|
||||||
|
backgroundColor:
|
||||||
|
const Color
|
||||||
|
.fromRGBO(
|
||||||
|
113,
|
||||||
|
198,
|
||||||
|
209,
|
||||||
|
1,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
onPressed: () =>
|
||||||
|
Navigator.of(
|
||||||
|
context,
|
||||||
|
).pop(
|
||||||
|
true,
|
||||||
|
),
|
||||||
child: Text(
|
child: Text(
|
||||||
translations
|
translations
|
||||||
.deleteChatModalConfirm,
|
.deleteChatModalConfirm,
|
||||||
style:
|
style:
|
||||||
const TextStyle(
|
const TextStyle(
|
||||||
fontSize: 16,
|
color: Colors.white,
|
||||||
|
fontSize: 18,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
@ -146,7 +146,7 @@ class _NewGroupChatScreenState extends State<NewGroupChatScreen> {
|
||||||
return widget.options.noChatsPlaceholderBuilder(widget.translations);
|
return widget.options.noChatsPlaceholderBuilder(widget.translations);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ListView.separated(
|
return ListView.separated(
|
||||||
itemCount: filteredUsers.length,
|
itemCount: filteredUsers.length,
|
||||||
separatorBuilder: (context, index) => const Padding(
|
separatorBuilder: (context, index) => const Padding(
|
||||||
padding: EdgeInsets.symmetric(horizontal: 28.0),
|
padding: EdgeInsets.symmetric(horizontal: 28.0),
|
||||||
|
@ -154,7 +154,8 @@ return ListView.separated(
|
||||||
), // Add Divider here
|
), // Add Divider here
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
var user = filteredUsers[index];
|
var user = filteredUsers[index];
|
||||||
var isSelected = selectedUserList.any((selectedUser) => selectedUser == user);
|
var isSelected =
|
||||||
|
selectedUserList.any((selectedUser) => selectedUser == user);
|
||||||
|
|
||||||
return InkWell(
|
return InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
|
@ -170,7 +171,8 @@ return ListView.separated(
|
||||||
child: Container(
|
child: Container(
|
||||||
color: isSelected ? Colors.amber.shade200 : Colors.white,
|
color: isSelected ? Colors.amber.shade200 : Colors.white,
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 12.0, horizontal: 30),
|
padding:
|
||||||
|
const EdgeInsets.symmetric(vertical: 12.0, horizontal: 30),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Padding(
|
Padding(
|
||||||
|
@ -200,5 +202,6 @@ return ListView.separated(
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}}
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue