1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-11-22 21:09: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/routes/main_route/main_route.dart';
import 'package:comunic/ui/tiles/conversation_message_tile.dart'; import 'package:comunic/ui/tiles/conversation_message_tile.dart';
import 'package:comunic/ui/tiles/server_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/safe_state.dart';
import 'package:comunic/ui/widgets/scroll_watcher.dart'; import 'package:comunic/ui/widgets/scroll_watcher.dart';
import 'package:comunic/utils/date_utils.dart'; import 'package:comunic/utils/date_utils.dart';
@ -83,7 +84,7 @@ class _ConversationScreenState extends SafeState<ConversationScreen> {
// Colors definition // Colors definition
Color get _senderColor => Color get _senderColor =>
_conversation.color ?? _conversation.color ??
(darkTheme() ? Color(0xff2b343b) : Colors.blue.shade900); /*(darkTheme() ? Color(0xff2b343b) :*/ Colors.blue.shade900; //);
Color get _receiverColor => Color get _receiverColor =>
darkTheme() ? Color(0xff3a3d40) : Colors.grey.shade600; darkTheme() ? Color(0xff3a3d40) : Colors.grey.shade600;
@ -410,7 +411,8 @@ class _ConversationScreenState extends SafeState<ConversationScreen> {
final messageRadius = Radius.circular(10); final messageRadius = Radius.circular(10);
return Container( return Container(
margin: EdgeInsets.only(top: previousMessage?.isOwner == true ? 0 : 12), margin: EdgeInsets.only(
top: previousMessage?.isOwner == true ? 0 : 12, right: 5),
constraints: constraints:
BoxConstraints(maxWidth: MediaQuery.of(context).size.width * 0.65), BoxConstraints(maxWidth: MediaQuery.of(context).size.width * 0.65),
decoration: BoxDecoration( decoration: BoxDecoration(
@ -432,7 +434,13 @@ class _ConversationScreenState extends SafeState<ConversationScreen> {
ConversationMessage message, ConversationMessage previousMessage) { ConversationMessage message, ConversationMessage previousMessage) {
final messageRadius = Radius.circular(10); final messageRadius = Radius.circular(10);
return Container( return Row(children: [
SizedBox(width: 5),
AccountImageWidget(
user: _usersInfo.getUser(message.userID),
),
SizedBox(width: 5),
Container(
margin: EdgeInsets.only( margin: EdgeInsets.only(
top: previousMessage == null || top: previousMessage == null ||
message.userID != previousMessage.userID message.userID != previousMessage.userID
@ -452,7 +460,8 @@ class _ConversationScreenState extends SafeState<ConversationScreen> {
padding: EdgeInsets.all(10), padding: EdgeInsets.all(10),
child: _buildMessage(message), child: _buildMessage(message),
), ),
); ),
]);
} }
Widget _buildMessage(ConversationMessage msg) => ConversationMessageTile( Widget _buildMessage(ConversationMessage msg) => ConversationMessageTile(