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 85a2a8f..fc17e1f 100644 --- a/packages/flutter_chat_view/lib/src/config/chat_translations.dart +++ b/packages/flutter_chat_view/lib/src/config/chat_translations.dart @@ -11,6 +11,7 @@ class ChatTranslations { this.newChatTitle = 'Start chat', this.image = 'Image', this.searchPlaceholder = 'Search...', + this.startTyping = 'Start typing to find a user to chat with.', this.cancelImagePickerBtn = 'Cancel', this.messagePlaceholder = 'Write your message here...', this.imageUploading = 'Image is uploading...', @@ -35,6 +36,7 @@ class ChatTranslations { final String deleteChatButton; final String image; final String searchPlaceholder; + final String startTyping; final String cancelImagePickerBtn; final String messagePlaceholder; final String imageUploading; 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 d5b5f60..f31e387 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 @@ -106,10 +106,7 @@ class _NewChatScreenState extends State { } else if (snapshot.hasData) { return _buildUserList(snapshot.data!); } else { - return Padding( - padding: const EdgeInsets.only(top: 20.0), - child: Text(widget.translations.noUsersFound), - ); + return Text(widget.translations.noUsersFound); } }, ), @@ -194,6 +191,22 @@ class _NewChatScreenState extends State { ) .toList(); + if (_textFieldFocusNode.hasFocus && query.isEmpty) { + return Padding( + padding: const EdgeInsets.only(top: 20.0), + child: Center( + child: Text( + widget.translations.startTyping, + style: const TextStyle( + fontSize: 16.0, + fontWeight: FontWeight.bold, + color: Colors.grey, + ), + ), + ), + ); + } + if (filteredUsers.isEmpty) { return widget.options.noChatsPlaceholderBuilder(widget.translations); } @@ -203,7 +216,7 @@ class _NewChatScreenState extends State { separatorBuilder: (context, index) => const Padding( padding: EdgeInsets.symmetric(horizontal: 28.0), child: Divider(), - ), // Add Divider here + ), itemBuilder: (context, index) { var user = filteredUsers[index]; return GestureDetector( @@ -220,11 +233,12 @@ class _NewChatScreenState extends State { ), Expanded( child: Container( - height: 40.0, // Adjust the height as needed + height: 40.0, alignment: Alignment.centerLeft, child: Text( user.fullName ?? widget.translations.anonymousUser, style: const TextStyle( + fontSize: 18.0, fontWeight: FontWeight.w800, ), ),