mirror of
https://github.com/Iconica-Development/flutter_chat.git
synced 2025-05-18 18:33:49 +02:00
feat(chat-message-bubble): add status marker
This commit is contained in:
parent
61b588cfd5
commit
b8e22425a1
2 changed files with 41 additions and 8 deletions
|
@ -225,6 +225,7 @@ class LocalChatRepository implements ChatRepositoryInterface {
|
||||||
messageType: messageType,
|
messageType: messageType,
|
||||||
senderId: senderId,
|
senderId: senderId,
|
||||||
imageUrl: imageUrl,
|
imageUrl: imageUrl,
|
||||||
|
status: MessageStatus.sent,
|
||||||
);
|
);
|
||||||
|
|
||||||
var chat = chats.firstWhereOrNull((e) => e.id == chatId);
|
var chat = chats.firstWhereOrNull((e) => e.id == chatId);
|
||||||
|
|
|
@ -147,6 +147,30 @@ class DefaultChatMessageBuilder extends StatelessWidget {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class _ChatMessageStatus extends StatelessWidget {
|
||||||
|
const _ChatMessageStatus({
|
||||||
|
required this.messageTheme,
|
||||||
|
required this.status,
|
||||||
|
});
|
||||||
|
|
||||||
|
final MessageTheme messageTheme;
|
||||||
|
final MessageStatus status;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) => switch (status) {
|
||||||
|
MessageStatus.sending => Icon(
|
||||||
|
Icons.access_time,
|
||||||
|
size: 16.0,
|
||||||
|
color: messageTheme.textColor,
|
||||||
|
),
|
||||||
|
MessageStatus.sent => Icon(
|
||||||
|
Icons.check,
|
||||||
|
size: 16.0,
|
||||||
|
color: messageTheme.textColor,
|
||||||
|
),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
class _ChatMessageBubble extends StatelessWidget {
|
class _ChatMessageBubble extends StatelessWidget {
|
||||||
const _ChatMessageBubble({
|
const _ChatMessageBubble({
|
||||||
required this.isSameSender,
|
required this.isSameSender,
|
||||||
|
@ -200,12 +224,15 @@ class _ChatMessageBubble extends StatelessWidget {
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
var messageTimeRow = Row(
|
var messageTimeRow = Padding(
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
padding: const EdgeInsets.only(
|
||||||
children: [
|
bottom: 8.0,
|
||||||
Padding(
|
right: 8.0,
|
||||||
padding: const EdgeInsets.only(right: 8, bottom: 4),
|
),
|
||||||
child: CustomSemantics(
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
|
children: [
|
||||||
|
CustomSemantics(
|
||||||
identifier: semanticIdTime,
|
identifier: semanticIdTime,
|
||||||
value: messageTime,
|
value: messageTime,
|
||||||
child: Text(
|
child: Text(
|
||||||
|
@ -216,8 +243,13 @@ class _ChatMessageBubble extends StatelessWidget {
|
||||||
textAlign: TextAlign.end,
|
textAlign: TextAlign.end,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
const SizedBox(width: 4.0),
|
||||||
],
|
_ChatMessageStatus(
|
||||||
|
messageTheme: messageTheme,
|
||||||
|
status: message.status,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
var showName =
|
var showName =
|
||||||
|
|
Loading…
Reference in a new issue