feat: add translation for find users to chat with

This commit is contained in:
Vick Top 2024-04-17 15:52:15 +02:00
parent f2e6875630
commit c4955e6eb7
2 changed files with 22 additions and 6 deletions

View file

@ -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;

View file

@ -106,10 +106,7 @@ class _NewChatScreenState extends State<NewChatScreen> {
} 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<NewChatScreen> {
)
.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<NewChatScreen> {
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<NewChatScreen> {
),
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,
),
),