From 349b54b4b4888c14413f101e1f498e2df1da87a1 Mon Sep 17 00:00:00 2001 From: NicKoehler Date: Wed, 24 May 2023 20:26:41 +0200 Subject: [PATCH 1/2] fix padding --- flutter/lib/common/widgets/chat_page.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flutter/lib/common/widgets/chat_page.dart b/flutter/lib/common/widgets/chat_page.dart index 76d4eed3e..54ced1009 100644 --- a/flutter/lib/common/widgets/chat_page.dart +++ b/flutter/lib/common/widgets/chat_page.dart @@ -47,7 +47,7 @@ class ChatPage extends StatelessWidget implements PageShape { value: chatModel, child: Container( color: Theme.of(context).scaffoldBackgroundColor, - padding: EdgeInsets.only(top: 14.0, bottom: 14.0, left: 14.0), + padding: EdgeInsets.all(14.0), child: Consumer( builder: (context, chatModel, child) { final currentUser = chatModel.currentUser; From 04cfd4ab3f59f742d370c3552009d2790b429b96 Mon Sep 17 00:00:00 2001 From: NicKoehler Date: Thu, 25 May 2023 12:04:52 +0200 Subject: [PATCH 2/2] fix messages order/color --- flutter/lib/common/widgets/chat_page.dart | 74 +++++++++++------------ 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/flutter/lib/common/widgets/chat_page.dart b/flutter/lib/common/widgets/chat_page.dart index 54ced1009..6106bade5 100644 --- a/flutter/lib/common/widgets/chat_page.dart +++ b/flutter/lib/common/widgets/chat_page.dart @@ -105,43 +105,43 @@ class ChatPage extends StatelessWidget implements PageShape { ), ), messageOptions: MessageOptions( - showOtherUsersAvatar: false, - showOtherUsersName: false, - textColor: Colors.white, - maxWidth: constraints.maxWidth * 0.7, - messageTextBuilder: (message, _, __) { - final isOwnMessage = - message.user.id == currentUser.id; - return Column( - crossAxisAlignment: isOwnMessage - ? CrossAxisAlignment.start - : CrossAxisAlignment.end, - children: [ - Text(message.text, - style: TextStyle(color: Colors.white)), - Text( - "${message.createdAt.hour}:${message.createdAt.minute.toString().padLeft(2, '0')}", - style: TextStyle( - color: Colors.white, - fontSize: 8, - ), - ).marginOnly(top: 3), - ], - ); - }, - messageDecorationBuilder: (message, __, ___) { - final isOwnMessage = - message.user.id == currentUser.id; - return defaultMessageDecoration( - color: isOwnMessage - ? Colors.blueGrey - : MyTheme.accent, - borderTopLeft: 8, - borderTopRight: 8, - borderBottomRight: isOwnMessage ? 8 : 2, - borderBottomLeft: isOwnMessage ? 2 : 8, - ); - }), + showOtherUsersAvatar: false, + showOtherUsersName: false, + textColor: Colors.white, + maxWidth: constraints.maxWidth * 0.7, + messageTextBuilder: (message, _, __) { + final isOwnMessage = message.user.id.isBlank!; + return Column( + crossAxisAlignment: isOwnMessage + ? CrossAxisAlignment.end + : CrossAxisAlignment.start, + children: [ + Text(message.text, + style: TextStyle(color: Colors.white)), + Text( + "${message.createdAt.hour}:${message.createdAt.minute.toString().padLeft(2, '0')}", + style: TextStyle( + color: Colors.white, + fontSize: 8, + ), + ).marginOnly(top: 3), + ], + ); + }, + messageDecorationBuilder: + (message, previousMessage, nextMessage) { + final isOwnMessage = message.user.id.isBlank!; + print("message.user.id = ${message.user.id}\n"); + return defaultMessageDecoration( + color: + isOwnMessage ? MyTheme.accent : Colors.blueGrey, + borderTopLeft: 8, + borderTopRight: 8, + borderBottomRight: isOwnMessage ? 2 : 8, + borderBottomLeft: isOwnMessage ? 8 : 2, + ); + }, + ), ); return SelectionArea(child: chat); }),