diff --git a/packages/flutter_chat/lib/src/flutter_chat_navigator_userstory.dart b/packages/flutter_chat/lib/src/flutter_chat_navigator_userstory.dart index d65ed3f..d2b812d 100644 --- a/packages/flutter_chat/lib/src/flutter_chat_navigator_userstory.dart +++ b/packages/flutter_chat/lib/src/flutter_chat_navigator_userstory.dart @@ -180,7 +180,7 @@ Widget _chatProfileScreenRoute( configuration, context, chatId, - userId, + user.id, ), ), ); diff --git a/packages/flutter_chat_view/lib/src/components/chat_bottom.dart b/packages/flutter_chat_view/lib/src/components/chat_bottom.dart index 1571c98..c924516 100644 --- a/packages/flutter_chat_view/lib/src/components/chat_bottom.dart +++ b/packages/flutter_chat_view/lib/src/components/chat_bottom.dart @@ -43,6 +43,8 @@ class ChatBottom extends StatefulWidget { class _ChatBottomState extends State { 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 { 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( diff --git a/packages/flutter_chat_view/lib/src/config/chat_options.dart b/packages/flutter_chat_view/lib/src/config/chat_options.dart index 7b49173..ced7211 100644 --- a/packages/flutter_chat_view/lib/src/config/chat_options.dart +++ b/packages/flutter_chat_view/lib/src/config/chat_options.dart @@ -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( diff --git a/packages/flutter_chat_view/lib/src/config/chat_translations.dart b/packages/flutter_chat_view/lib/src/config/chat_translations.dart index 77ba758..76cbb22 100644 --- a/packages/flutter_chat_view/lib/src/config/chat_translations.dart +++ b/packages/flutter_chat_view/lib/src/config/chat_translations.dart @@ -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:', diff --git a/packages/flutter_chat_view/lib/src/screens/chat_detail_screen.dart b/packages/flutter_chat_view/lib/src/screens/chat_detail_screen.dart index 3fc852d..beb99e0 100644 --- a/packages/flutter_chat_view/lib/src/screens/chat_detail_screen.dart +++ b/packages/flutter_chat_view/lib/src/screens/chat_detail_screen.dart @@ -145,6 +145,7 @@ class _ChatDetailScreenState extends State { widget.options.imagePickerContainerBuilder( () => Navigator.of(context).pop(), widget.translations, + context, ), ).then( (image) async { @@ -216,10 +217,10 @@ class _ChatDetailScreenState extends State { 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 { shrinkWrap: true, physics: const AlwaysScrollableScrollPhysics(), controller: controller, - reverse: true, + reverse: detailRows.isNotEmpty, padding: const EdgeInsets.only(top: 24.0), children: [ if (detailRows.isEmpty) diff --git a/packages/flutter_chat_view/lib/src/screens/chat_profile_screen.dart b/packages/flutter_chat_view/lib/src/screens/chat_profile_screen.dart index a6bfa9a..b28ac96 100644 --- a/packages/flutter_chat_view/lib/src/screens/chat_profile_screen.dart +++ b/packages/flutter_chat_view/lib/src/screens/chat_profile_screen.dart @@ -124,7 +124,9 @@ class _ProfileScreenState extends State { 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, diff --git a/packages/flutter_chat_view/lib/src/screens/chat_screen.dart b/packages/flutter_chat_view/lib/src/screens/chat_screen.dart index 1260af5..edafe45 100644 --- a/packages/flutter_chat_view/lib/src/screens/chat_screen.dart +++ b/packages/flutter_chat_view/lib/src/screens/chat_screen.dart @@ -82,10 +82,10 @@ class _ChatScreenState extends State { 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 { style: ElevatedButton .styleFrom( backgroundColor: - const Color - .fromRGBO( - 113, - 198, - 209, - 1, - ), + Theme.of(context) + .primaryColor, ), onPressed: () => Navigator.of( diff --git a/packages/flutter_chat_view/lib/src/screens/new_chat_screen.dart b/packages/flutter_chat_view/lib/src/screens/new_chat_screen.dart index 8d5be29..9f27442 100644 --- a/packages/flutter_chat_view/lib/src/screens/new_chat_screen.dart +++ b/packages/flutter_chat_view/lib/src/screens/new_chat_screen.dart @@ -161,10 +161,10 @@ class _NewChatScreenState extends State { : Text( widget.translations.newChatTitle, style: theme.appBarTheme.titleTextStyle ?? - const TextStyle( + TextStyle( fontWeight: FontWeight.w800, fontSize: 24, - color: Color(0xff71C6D1), + color: Theme.of(context).primaryColor, ), ); } diff --git a/packages/flutter_chat_view/lib/src/screens/new_group_chat_overview_screen.dart b/packages/flutter_chat_view/lib/src/screens/new_group_chat_overview_screen.dart index 22ff727..30fff15 100644 --- a/packages/flutter_chat_view/lib/src/screens/new_group_chat_overview_screen.dart +++ b/packages/flutter_chat_view/lib/src/screens/new_group_chat_overview_screen.dart @@ -53,6 +53,7 @@ class _NewGroupChatOverviewScreenState ), ), floatingActionButton: FloatingActionButton( + backgroundColor: Theme.of(context).primaryColor, onPressed: () async { await widget.onPressCompleteGroupChatCreation( widget.users, diff --git a/packages/flutter_chat_view/lib/src/screens/new_group_chat_screen.dart b/packages/flutter_chat_view/lib/src/screens/new_group_chat_screen.dart index d527e22..bca2bc3 100644 --- a/packages/flutter_chat_view/lib/src/screens/new_group_chat_screen.dart +++ b/packages/flutter_chat_view/lib/src/screens/new_group_chat_screen.dart @@ -58,7 +58,7 @@ class _NewGroupChatScreenState extends State { }, ), 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 { : Text( widget.translations.newGroupChatButton, style: theme.appBarTheme.titleTextStyle ?? - const TextStyle( + TextStyle( fontWeight: FontWeight.w800, fontSize: 24, - color: Color(0xff71C6D1), + color: Theme.of(context).primaryColor, ), ); }