mirror of
https://github.com/Iconica-Development/flutter_chat.git
synced 2025-05-18 18:33:49 +02:00
fix: solve several issues
This commit is contained in:
parent
3d3153d2ce
commit
7cfd8087a1
10 changed files with 38 additions and 27 deletions
|
@ -180,7 +180,7 @@ Widget _chatProfileScreenRoute(
|
|||
configuration,
|
||||
context,
|
||||
chatId,
|
||||
userId,
|
||||
user.id,
|
||||
),
|
||||
),
|
||||
);
|
||||
|
|
|
@ -43,6 +43,8 @@ class ChatBottom extends StatefulWidget {
|
|||
class _ChatBottomState extends State<ChatBottom> {
|
||||
final TextEditingController _textEditingController = TextEditingController();
|
||||
bool _isTyping = false;
|
||||
bool _isSending = false;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
_textEditingController.addListener(() {
|
||||
|
@ -78,14 +80,22 @@ class _ChatBottomState extends State<ChatBottom> {
|
|||
IconButton(
|
||||
disabledColor: widget.iconDisabledColor,
|
||||
color: widget.iconColor,
|
||||
onPressed: _isTyping
|
||||
onPressed: _isTyping && !_isSending
|
||||
? () async {
|
||||
setState(() {
|
||||
_isSending = true;
|
||||
});
|
||||
|
||||
var value = _textEditingController.text;
|
||||
|
||||
if (value.isNotEmpty) {
|
||||
await widget.onMessageSubmit(value);
|
||||
_textEditingController.clear();
|
||||
}
|
||||
|
||||
setState(() {
|
||||
_isSending = false;
|
||||
});
|
||||
}
|
||||
: null,
|
||||
icon: const Icon(
|
||||
|
|
|
@ -62,7 +62,7 @@ Widget _createNewChatButton(
|
|||
padding: const EdgeInsets.fromLTRB(5, 24, 5, 24),
|
||||
child: ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: const Color.fromRGBO(113, 198, 209, 1),
|
||||
backgroundColor: Theme.of(context).primaryColor,
|
||||
fixedSize: const Size(254, 44),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(56),
|
||||
|
@ -136,6 +136,7 @@ Widget _createChatRowContainer(
|
|||
Widget _createImagePickerContainer(
|
||||
VoidCallback onClose,
|
||||
ChatTranslations translations,
|
||||
BuildContext context,
|
||||
) =>
|
||||
Container(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
|
@ -151,7 +152,7 @@ Widget _createImagePickerContainer(
|
|||
),
|
||||
customButton: ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: const Color.fromRGBO(113, 198, 209, 1),
|
||||
backgroundColor: Theme.of(context).primaryColor,
|
||||
),
|
||||
onPressed: onClose,
|
||||
child: Text(
|
||||
|
@ -240,6 +241,7 @@ typedef ContainerBuilder = Widget Function(
|
|||
typedef ImagePickerContainerBuilder = Widget Function(
|
||||
VoidCallback onClose,
|
||||
ChatTranslations translations,
|
||||
BuildContext context,
|
||||
);
|
||||
|
||||
typedef ScaffoldBuilder = Scaffold Function(
|
||||
|
|
|
@ -47,12 +47,12 @@ class ChatTranslations {
|
|||
this.newChatTitle = 'Start a chat',
|
||||
this.image = 'Image',
|
||||
this.searchPlaceholder = 'Search...',
|
||||
this.startTyping = 'Start typing to find a user to chat with.',
|
||||
this.startTyping = 'Start typing to find a user to chat with',
|
||||
this.cancelImagePickerBtn = 'Cancel',
|
||||
this.messagePlaceholder = 'Write your message here...',
|
||||
this.writeMessageToStartChat = 'Write a message to start the chat.',
|
||||
this.writeMessageToStartChat = 'Write a message to start the chat',
|
||||
this.writeFirstMessageInGroupChat =
|
||||
'Write the first message in this group chat.',
|
||||
'Write the first message in this group chat',
|
||||
this.imageUploading = 'Image is uploading...',
|
||||
this.deleteChatButton = 'Delete',
|
||||
this.deleteChatModalTitle = 'Delete chat',
|
||||
|
@ -60,8 +60,8 @@ class ChatTranslations {
|
|||
'Are you sure you want to delete this chat?',
|
||||
this.deleteChatModalCancel = 'Cancel',
|
||||
this.deleteChatModalConfirm = 'Delete',
|
||||
this.noUsersFound = 'No users were found to start a chat with.',
|
||||
this.noChatsFound = 'Click on \'Start a chat\' to create a new chat.',
|
||||
this.noUsersFound = 'No users were found to start a chat with',
|
||||
this.noChatsFound = 'Click on \'Start a chat\' to create a new chat',
|
||||
this.anonymousUser = 'Anonymous user',
|
||||
this.chatCantBeDeleted = 'This chat can\'t be deleted',
|
||||
this.chatProfileUsers = 'Users:',
|
||||
|
|
|
@ -145,6 +145,7 @@ class _ChatDetailScreenState extends State<ChatDetailScreen> {
|
|||
widget.options.imagePickerContainerBuilder(
|
||||
() => Navigator.of(context).pop(),
|
||||
widget.translations,
|
||||
context,
|
||||
),
|
||||
).then(
|
||||
(image) async {
|
||||
|
@ -216,10 +217,10 @@ class _ChatDetailScreenState extends State<ChatDetailScreen> {
|
|||
widget.translations.anonymousUser
|
||||
: '',
|
||||
style: theme.appBarTheme.titleTextStyle ??
|
||||
const TextStyle(
|
||||
TextStyle(
|
||||
fontWeight: FontWeight.w800,
|
||||
fontSize: 24,
|
||||
color: Color(0xff71C6D1),
|
||||
color: Theme.of(context).primaryColor,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@ -259,7 +260,7 @@ class _ChatDetailScreenState extends State<ChatDetailScreen> {
|
|||
shrinkWrap: true,
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
controller: controller,
|
||||
reverse: true,
|
||||
reverse: detailRows.isNotEmpty,
|
||||
padding: const EdgeInsets.only(top: 24.0),
|
||||
children: [
|
||||
if (detailRows.isEmpty)
|
||||
|
|
|
@ -124,7 +124,9 @@ class _ProfileScreenState extends State<ChatProfileScreen> {
|
|||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 4.0),
|
||||
child: GestureDetector(
|
||||
onTap: () => widget.onTapUser.call(e),
|
||||
onTap: () {
|
||||
widget.onTapUser.call(e);
|
||||
},
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
|
|
|
@ -82,10 +82,10 @@ class _ChatScreenState extends State<ChatScreen> {
|
|||
title: Text(
|
||||
translations.chatsTitle,
|
||||
style: theme.appBarTheme.titleTextStyle ??
|
||||
const TextStyle(
|
||||
TextStyle(
|
||||
fontWeight: FontWeight.w800,
|
||||
fontSize: 24,
|
||||
color: Color(0xff71C6D1),
|
||||
color: Theme.of(context).primaryColor,
|
||||
),
|
||||
),
|
||||
centerTitle: true,
|
||||
|
@ -230,13 +230,8 @@ class _ChatScreenState extends State<ChatScreen> {
|
|||
style: ElevatedButton
|
||||
.styleFrom(
|
||||
backgroundColor:
|
||||
const Color
|
||||
.fromRGBO(
|
||||
113,
|
||||
198,
|
||||
209,
|
||||
1,
|
||||
),
|
||||
Theme.of(context)
|
||||
.primaryColor,
|
||||
),
|
||||
onPressed: () =>
|
||||
Navigator.of(
|
||||
|
|
|
@ -161,10 +161,10 @@ class _NewChatScreenState extends State<NewChatScreen> {
|
|||
: Text(
|
||||
widget.translations.newChatTitle,
|
||||
style: theme.appBarTheme.titleTextStyle ??
|
||||
const TextStyle(
|
||||
TextStyle(
|
||||
fontWeight: FontWeight.w800,
|
||||
fontSize: 24,
|
||||
color: Color(0xff71C6D1),
|
||||
color: Theme.of(context).primaryColor,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
|
@ -53,6 +53,7 @@ class _NewGroupChatOverviewScreenState
|
|||
),
|
||||
),
|
||||
floatingActionButton: FloatingActionButton(
|
||||
backgroundColor: Theme.of(context).primaryColor,
|
||||
onPressed: () async {
|
||||
await widget.onPressCompleteGroupChatCreation(
|
||||
widget.users,
|
||||
|
|
|
@ -58,7 +58,7 @@ class _NewGroupChatScreenState extends State<NewGroupChatScreen> {
|
|||
},
|
||||
),
|
||||
floatingActionButton: FloatingActionButton(
|
||||
backgroundColor: const Color(0xff71C6D1),
|
||||
backgroundColor: Theme.of(context).primaryColor,
|
||||
onPressed: () async {
|
||||
await widget.onPressGroupChatOverview(selectedUserList);
|
||||
},
|
||||
|
@ -105,10 +105,10 @@ class _NewGroupChatScreenState extends State<NewGroupChatScreen> {
|
|||
: Text(
|
||||
widget.translations.newGroupChatButton,
|
||||
style: theme.appBarTheme.titleTextStyle ??
|
||||
const TextStyle(
|
||||
TextStyle(
|
||||
fontWeight: FontWeight.w800,
|
||||
fontSize: 24,
|
||||
color: Color(0xff71C6D1),
|
||||
color: Theme.of(context).primaryColor,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue