commit
865ac8240c
@ -47,7 +47,7 @@ class ChatPage extends StatelessWidget implements PageShape {
|
|||||||
value: chatModel,
|
value: chatModel,
|
||||||
child: Container(
|
child: Container(
|
||||||
color: Theme.of(context).scaffoldBackgroundColor,
|
color: Theme.of(context).scaffoldBackgroundColor,
|
||||||
padding: EdgeInsets.only(top: 14.0, bottom: 14.0, left: 14.0),
|
padding: EdgeInsets.all(14.0),
|
||||||
child: Consumer<ChatModel>(
|
child: Consumer<ChatModel>(
|
||||||
builder: (context, chatModel, child) {
|
builder: (context, chatModel, child) {
|
||||||
final currentUser = chatModel.currentUser;
|
final currentUser = chatModel.currentUser;
|
||||||
@ -110,12 +110,11 @@ class ChatPage extends StatelessWidget implements PageShape {
|
|||||||
textColor: Colors.white,
|
textColor: Colors.white,
|
||||||
maxWidth: constraints.maxWidth * 0.7,
|
maxWidth: constraints.maxWidth * 0.7,
|
||||||
messageTextBuilder: (message, _, __) {
|
messageTextBuilder: (message, _, __) {
|
||||||
final isOwnMessage =
|
final isOwnMessage = message.user.id.isBlank!;
|
||||||
message.user.id == currentUser.id;
|
|
||||||
return Column(
|
return Column(
|
||||||
crossAxisAlignment: isOwnMessage
|
crossAxisAlignment: isOwnMessage
|
||||||
? CrossAxisAlignment.start
|
? CrossAxisAlignment.end
|
||||||
: CrossAxisAlignment.end,
|
: CrossAxisAlignment.start,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Text(message.text,
|
Text(message.text,
|
||||||
style: TextStyle(color: Colors.white)),
|
style: TextStyle(color: Colors.white)),
|
||||||
@ -129,19 +128,20 @@ class ChatPage extends StatelessWidget implements PageShape {
|
|||||||
],
|
],
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
messageDecorationBuilder: (message, __, ___) {
|
messageDecorationBuilder:
|
||||||
final isOwnMessage =
|
(message, previousMessage, nextMessage) {
|
||||||
message.user.id == currentUser.id;
|
final isOwnMessage = message.user.id.isBlank!;
|
||||||
|
print("message.user.id = ${message.user.id}\n");
|
||||||
return defaultMessageDecoration(
|
return defaultMessageDecoration(
|
||||||
color: isOwnMessage
|
color:
|
||||||
? Colors.blueGrey
|
isOwnMessage ? MyTheme.accent : Colors.blueGrey,
|
||||||
: MyTheme.accent,
|
|
||||||
borderTopLeft: 8,
|
borderTopLeft: 8,
|
||||||
borderTopRight: 8,
|
borderTopRight: 8,
|
||||||
borderBottomRight: isOwnMessage ? 8 : 2,
|
borderBottomRight: isOwnMessage ? 2 : 8,
|
||||||
borderBottomLeft: isOwnMessage ? 2 : 8,
|
borderBottomLeft: isOwnMessage ? 8 : 2,
|
||||||
);
|
);
|
||||||
}),
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
return SelectionArea(child: chat);
|
return SelectionArea(child: chat);
|
||||||
}),
|
}),
|
||||||
|
Loading…
Reference in New Issue
Block a user