1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-11-22 04:49:21 +00:00

Add user account image

This commit is contained in:
Pierre HUBERT 2021-03-13 08:26:56 +01:00
parent 5a25769b71
commit bedc3f5277

View File

@ -14,6 +14,7 @@ import 'package:comunic/ui/dialogs/pick_file_dialog.dart';
import 'package:comunic/ui/routes/main_route/main_route.dart';
import 'package:comunic/ui/tiles/conversation_message_tile.dart';
import 'package:comunic/ui/tiles/server_conversation_message_tile.dart';
import 'package:comunic/ui/widgets/account_image_widget.dart';
import 'package:comunic/ui/widgets/safe_state.dart';
import 'package:comunic/ui/widgets/scroll_watcher.dart';
import 'package:comunic/utils/date_utils.dart';
@ -83,7 +84,7 @@ class _ConversationScreenState extends SafeState<ConversationScreen> {
// Colors definition
Color get _senderColor =>
_conversation.color ??
(darkTheme() ? Color(0xff2b343b) : Colors.blue.shade900);
/*(darkTheme() ? Color(0xff2b343b) :*/ Colors.blue.shade900; //);
Color get _receiverColor =>
darkTheme() ? Color(0xff3a3d40) : Colors.grey.shade600;
@ -410,7 +411,8 @@ class _ConversationScreenState extends SafeState<ConversationScreen> {
final messageRadius = Radius.circular(10);
return Container(
margin: EdgeInsets.only(top: previousMessage?.isOwner == true ? 0 : 12),
margin: EdgeInsets.only(
top: previousMessage?.isOwner == true ? 0 : 12, right: 5),
constraints:
BoxConstraints(maxWidth: MediaQuery.of(context).size.width * 0.65),
decoration: BoxDecoration(
@ -432,27 +434,34 @@ class _ConversationScreenState extends SafeState<ConversationScreen> {
ConversationMessage message, ConversationMessage previousMessage) {
final messageRadius = Radius.circular(10);
return Container(
margin: EdgeInsets.only(
top: previousMessage == null ||
message.userID != previousMessage.userID
? 12
: 0),
constraints:
BoxConstraints(maxWidth: MediaQuery.of(context).size.width * 0.65),
decoration: BoxDecoration(
color: _receiverColor,
borderRadius: BorderRadius.only(
bottomRight: messageRadius,
topRight: messageRadius,
bottomLeft: messageRadius,
return Row(children: [
SizedBox(width: 5),
AccountImageWidget(
user: _usersInfo.getUser(message.userID),
),
SizedBox(width: 5),
Container(
margin: EdgeInsets.only(
top: previousMessage == null ||
message.userID != previousMessage.userID
? 12
: 0),
constraints:
BoxConstraints(maxWidth: MediaQuery.of(context).size.width * 0.65),
decoration: BoxDecoration(
color: _receiverColor,
borderRadius: BorderRadius.only(
bottomRight: messageRadius,
topRight: messageRadius,
bottomLeft: messageRadius,
),
),
child: Padding(
padding: EdgeInsets.all(10),
child: _buildMessage(message),
),
),
child: Padding(
padding: EdgeInsets.all(10),
child: _buildMessage(message),
),
);
]);
}
Widget _buildMessage(ConversationMessage msg) => ConversationMessageTile(