fix messages update
This commit is contained in:
+47
-47
@@ -95,55 +95,53 @@ class _MessageWidgetState extends State<MessageWidget>
|
|||||||
|
|
||||||
Widget child;
|
Widget child;
|
||||||
|
|
||||||
if (widget.message.type == 'deleted') {
|
var row = <Widget>[
|
||||||
child = _buildDeletedMessage(alignment);
|
Column(
|
||||||
} else {
|
crossAxisAlignment:
|
||||||
var row = <Widget>[
|
isMyMessage ? CrossAxisAlignment.end : CrossAxisAlignment.start,
|
||||||
Column(
|
children: <Widget>[
|
||||||
crossAxisAlignment:
|
widget.message.type == 'deleted'
|
||||||
isMyMessage ? CrossAxisAlignment.end : CrossAxisAlignment.start,
|
? _buildDeletedMessage(alignment)
|
||||||
children: <Widget>[
|
: _buildBubble(context, isLastUser),
|
||||||
_buildBubble(context, isLastUser),
|
streamChannel.channel.config.replies
|
||||||
streamChannel.channel.config.replies
|
? _buildThreadIndicator(context)
|
||||||
? _buildThreadIndicator(context)
|
: SizedBox(),
|
||||||
: SizedBox(),
|
isNextUser ? SizedBox() : _buildTimestamp(alignment),
|
||||||
isNextUser ? SizedBox() : _buildTimestamp(alignment),
|
],
|
||||||
],
|
),
|
||||||
),
|
isNextUser
|
||||||
isNextUser
|
? Container(
|
||||||
? Container(
|
width: 40,
|
||||||
width: 40,
|
)
|
||||||
)
|
: Padding(
|
||||||
: Padding(
|
padding: EdgeInsets.only(
|
||||||
padding: EdgeInsets.only(
|
left: isMyMessage ? 8.0 : 0,
|
||||||
left: isMyMessage ? 8.0 : 0,
|
right: isMyMessage ? 0 : 8.0,
|
||||||
right: isMyMessage ? 0 : 8.0,
|
|
||||||
),
|
|
||||||
child: UserAvatar(user: widget.message.user),
|
|
||||||
),
|
),
|
||||||
];
|
child: UserAvatar(user: widget.message.user),
|
||||||
|
),
|
||||||
|
];
|
||||||
|
|
||||||
if (!isMyMessage) {
|
if (!isMyMessage) {
|
||||||
row = row.reversed.toList();
|
row = row.reversed.toList();
|
||||||
}
|
|
||||||
|
|
||||||
child = AnimatedContainer(
|
|
||||||
duration: Duration(milliseconds: 300),
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 10.0),
|
|
||||||
margin: EdgeInsets.only(
|
|
||||||
top: isLastUser ? 5 : 24,
|
|
||||||
bottom: widget.nextMessage == null ? 30 : 0,
|
|
||||||
),
|
|
||||||
child: Row(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.end,
|
|
||||||
mainAxisAlignment:
|
|
||||||
isMyMessage ? MainAxisAlignment.end : MainAxisAlignment.start,
|
|
||||||
mainAxisSize: MainAxisSize.max,
|
|
||||||
children: row,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
child = AnimatedContainer(
|
||||||
|
duration: Duration(milliseconds: 300),
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 10.0),
|
||||||
|
margin: EdgeInsets.only(
|
||||||
|
top: isLastUser ? 5 : 24,
|
||||||
|
bottom: widget.nextMessage == null ? 30 : 0,
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.end,
|
||||||
|
mainAxisAlignment:
|
||||||
|
isMyMessage ? MainAxisAlignment.end : MainAxisAlignment.start,
|
||||||
|
mainAxisSize: MainAxisSize.max,
|
||||||
|
children: row,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
return AnimatedSwitcher(
|
return AnimatedSwitcher(
|
||||||
duration: Duration(milliseconds: 300),
|
duration: Duration(milliseconds: 300),
|
||||||
child: child,
|
child: child,
|
||||||
@@ -155,7 +153,7 @@ class _MessageWidgetState extends State<MessageWidget>
|
|||||||
alignment: alignment,
|
alignment: alignment,
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.symmetric(
|
padding: const EdgeInsets.symmetric(
|
||||||
horizontal: 54,
|
horizontal: 16,
|
||||||
vertical: 14,
|
vertical: 14,
|
||||||
),
|
),
|
||||||
child: Text(
|
child: Text(
|
||||||
@@ -551,7 +549,9 @@ class _MessageWidgetState extends State<MessageWidget>
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
: SizedBox(),
|
: SizedBox(),
|
||||||
streamChannel.channel.config.replies
|
(streamChannel.channel.config.replies &&
|
||||||
|
widget.message.parentId == null &&
|
||||||
|
!widget.isParent)
|
||||||
? FlatButton(
|
? FlatButton(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.all(28.0),
|
padding: const EdgeInsets.all(28.0),
|
||||||
|
|||||||
@@ -103,22 +103,13 @@ class StreamChannelState extends State<StreamChannel> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> queryMembersAndWatchers() async {
|
Future<void> queryMembersAndWatchers() async {
|
||||||
String firstMemberId;
|
|
||||||
if (channel.state.members?.isNotEmpty == true) {
|
|
||||||
firstMemberId = channel.state.members.first.userId;
|
|
||||||
}
|
|
||||||
String firstWatcherId;
|
|
||||||
if (channel.state.watchers?.isNotEmpty == true) {
|
|
||||||
firstWatcherId = channel.state.watchers.first.id;
|
|
||||||
}
|
|
||||||
|
|
||||||
await widget.channel.query(
|
await widget.channel.query(
|
||||||
membersPagination: PaginationParams(
|
membersPagination: PaginationParams(
|
||||||
lessThan: firstMemberId,
|
offset: channel.state.members?.length,
|
||||||
limit: 100,
|
limit: 100,
|
||||||
),
|
),
|
||||||
watchersPagination: PaginationParams(
|
watchersPagination: PaginationParams(
|
||||||
lessThan: firstWatcherId,
|
offset: channel.state.watchers?.length,
|
||||||
limit: 100,
|
limit: 100,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
+1
-1
@@ -21,7 +21,7 @@ dependencies:
|
|||||||
file_picker: ^1.4.3+2
|
file_picker: ^1.4.3+2
|
||||||
image_picker: ^0.6.3+4
|
image_picker: ^0.6.3+4
|
||||||
keyboard_visibility: ^0.5.6
|
keyboard_visibility: ^0.5.6
|
||||||
stream_chat: ^0.1.15
|
stream_chat: ^0.1.16
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
pedantic: ^1.8.0+1
|
pedantic: ^1.8.0+1
|
||||||
|
|||||||
Reference in New Issue
Block a user