1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-11-22 12:59: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,27 +434,34 @@ 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: [
margin: EdgeInsets.only( SizedBox(width: 5),
top: previousMessage == null || AccountImageWidget(
message.userID != previousMessage.userID user: _usersInfo.getUser(message.userID),
? 12 ),
: 0), SizedBox(width: 5),
constraints: Container(
BoxConstraints(maxWidth: MediaQuery.of(context).size.width * 0.65), margin: EdgeInsets.only(
decoration: BoxDecoration( top: previousMessage == null ||
color: _receiverColor, message.userID != previousMessage.userID
borderRadius: BorderRadius.only( ? 12
bottomRight: messageRadius, : 0),
topRight: messageRadius, constraints:
bottomLeft: messageRadius, 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( Widget _buildMessage(ConversationMessage msg) => ConversationMessageTile(