mirror of
https://github.com/Iconica-Development/flutter_chat.git
synced 2025-05-19 02:43:50 +02:00
feat: add translations for anonymous user
This commit is contained in:
parent
08e695517b
commit
29d993682a
6 changed files with 14 additions and 5 deletions
|
@ -1,4 +1,4 @@
|
|||
## 0.4.0 - October 27 2023
|
||||
## 0.4.0 - November 6 2023
|
||||
|
||||
- Show amount of unread messages per chat
|
||||
- More intuitive chat UI
|
||||
|
|
|
@ -10,12 +10,14 @@ import 'package:flutter_community_chat_view/src/services/date_formatter.dart';
|
|||
|
||||
class ChatDetailRow extends StatefulWidget {
|
||||
const ChatDetailRow({
|
||||
required this.translations,
|
||||
required this.isFirstMessage,
|
||||
required this.message,
|
||||
required this.userAvatarBuilder,
|
||||
super.key,
|
||||
});
|
||||
|
||||
final ChatTranslations translations;
|
||||
final bool isFirstMessage;
|
||||
final ChatMessageModel message;
|
||||
final UserAvatarBuilder userAvatarBuilder;
|
||||
|
@ -62,7 +64,7 @@ class _ChatDetailRowState extends State<ChatDetailRow> {
|
|||
children: [
|
||||
Text(
|
||||
widget.message.sender.fullName?.toUpperCase() ??
|
||||
'',
|
||||
widget.translations.anonymousUser,
|
||||
style: const TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w500,
|
||||
|
|
|
@ -20,6 +20,7 @@ class ChatTranslations {
|
|||
this.deleteChatModalCancel = 'Cancel',
|
||||
this.deleteChatModalConfirm = 'Delete',
|
||||
this.noUsersFound = 'No users found',
|
||||
this.anonymousUser = 'Anonymous user',
|
||||
});
|
||||
|
||||
final String chatsTitle;
|
||||
|
@ -37,4 +38,7 @@ class ChatTranslations {
|
|||
final String deleteChatModalCancel;
|
||||
final String deleteChatModalConfirm;
|
||||
final String noUsersFound;
|
||||
|
||||
/// Shown when the user has no name
|
||||
final String anonymousUser;
|
||||
}
|
||||
|
|
|
@ -136,7 +136,7 @@ class _ChatDetailScreenState extends State<ChatDetailScreen> {
|
|||
? (widget.chat! as PersonalChatModel)
|
||||
.user
|
||||
.fullName ??
|
||||
''
|
||||
widget.translations.anonymousUser
|
||||
: '',
|
||||
style: const TextStyle(fontSize: 18),
|
||||
),
|
||||
|
@ -161,6 +161,7 @@ class _ChatDetailScreenState extends State<ChatDetailScreen> {
|
|||
lastMessage.sender.id != message.sender.id;
|
||||
messageWidgets.add(
|
||||
ChatDetailRow(
|
||||
translations: widget.translations,
|
||||
message: message,
|
||||
isFirstMessage: isFirstMessage,
|
||||
userAvatarBuilder: widget.options.userAvatarBuilder,
|
||||
|
|
|
@ -129,7 +129,8 @@ class _ChatScreenState extends State<ChatScreen> {
|
|||
chat.user,
|
||||
40.0,
|
||||
),
|
||||
title: chat.user.fullName ?? '',
|
||||
title: chat.user.fullName ??
|
||||
translations.anonymousUser,
|
||||
subTitle: chat.lastMessage != null
|
||||
? chat.lastMessage
|
||||
is ChatTextMessageModel
|
||||
|
|
|
@ -90,7 +90,8 @@ class _NewChatScreenState extends State<NewChatScreen> {
|
|||
user,
|
||||
40.0,
|
||||
),
|
||||
title: user.fullName ?? '',
|
||||
title:
|
||||
user.fullName ?? widget.translations.anonymousUser,
|
||||
),
|
||||
),
|
||||
onTap: () => widget.onPressCreateChat(user),
|
||||
|
|
Loading…
Reference in a new issue