Merge branch 'feature/new-ui' into qa4-fixes
This commit is contained in:
@@ -218,12 +218,14 @@ class _ImageFooterState extends State<ImageFooter> {
|
|||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
physics: NeverScrollableScrollPhysics(),
|
physics: NeverScrollableScrollPhysics(),
|
||||||
itemBuilder: (context, position) {
|
itemBuilder: (context, position) {
|
||||||
|
Widget media;
|
||||||
|
|
||||||
if (widget.mediaAttachments[position].type == 'video') {
|
if (widget.mediaAttachments[position].type == 'video') {
|
||||||
var controllerPackage = widget.videoPackages[
|
var controllerPackage = widget.videoPackages[
|
||||||
videoAttachments
|
videoAttachments
|
||||||
.indexOf(widget.mediaAttachments[position])];
|
.indexOf(widget.mediaAttachments[position])];
|
||||||
|
|
||||||
return InkWell(
|
media = InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
widget.mediaSelectedCallBack(position);
|
widget.mediaSelectedCallBack(position);
|
||||||
},
|
},
|
||||||
@@ -235,7 +237,7 @@ class _ImageFooterState extends State<ImageFooter> {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return InkWell(
|
media = InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
widget.mediaSelectedCallBack(position);
|
widget.mediaSelectedCallBack(position);
|
||||||
},
|
},
|
||||||
@@ -254,6 +256,28 @@ class _ImageFooterState extends State<ImageFooter> {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return Stack(
|
||||||
|
children: [
|
||||||
|
media,
|
||||||
|
Padding(
|
||||||
|
padding: EdgeInsets.all(8.0),
|
||||||
|
child: Align(
|
||||||
|
alignment: Alignment.topLeft,
|
||||||
|
child: UserAvatar(
|
||||||
|
user: widget.message.user,
|
||||||
|
constraints: BoxConstraints.tight(
|
||||||
|
Size(
|
||||||
|
24,
|
||||||
|
24,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
showOnlineStatus: false,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
},
|
},
|
||||||
itemCount: widget.mediaAttachments.length,
|
itemCount: widget.mediaAttachments.length,
|
||||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||||
|
|||||||
+152
-157
@@ -333,172 +333,167 @@ class _MessageListViewState extends State<MessageListView> {
|
|||||||
childAnchor: Alignment.topCenter,
|
childAnchor: Alignment.topCenter,
|
||||||
message: statusString,
|
message: statusString,
|
||||||
child: LazyLoadScrollView(
|
child: LazyLoadScrollView(
|
||||||
child: LazyLoadScrollView(
|
onStartOfPage: () async {
|
||||||
onStartOfPage: () async {
|
_inBetweenList = false;
|
||||||
_inBetweenList = false;
|
if (!_upToDate) {
|
||||||
if (!_upToDate) {
|
_topPaginationActive = false;
|
||||||
_topPaginationActive = false;
|
_bottomPaginationActive = true;
|
||||||
_bottomPaginationActive = true;
|
return _paginateData(
|
||||||
return _paginateData(
|
streamChannel,
|
||||||
|
QueryDirection.bottom,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onEndOfPage: () async {
|
||||||
|
_inBetweenList = false;
|
||||||
|
_topPaginationActive = true;
|
||||||
|
_bottomPaginationActive = false;
|
||||||
|
return _paginateData(
|
||||||
|
streamChannel,
|
||||||
|
QueryDirection.top,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
onInBetweenOfPage: () {
|
||||||
|
_inBetweenList = true;
|
||||||
|
},
|
||||||
|
child: ScrollablePositionedList.separated(
|
||||||
|
key: ValueKey(initialIndex + initialAlignment),
|
||||||
|
itemPositionsListener: _itemPositionListener,
|
||||||
|
addAutomaticKeepAlives: true,
|
||||||
|
initialScrollIndex: initialIndex ?? 0,
|
||||||
|
initialAlignment: initialAlignment ?? 0,
|
||||||
|
physics: widget.scrollPhysics,
|
||||||
|
itemScrollController: _scrollController,
|
||||||
|
reverse: true,
|
||||||
|
itemCount: messages.length +
|
||||||
|
2 +
|
||||||
|
(_isThreadConversation ? 1 : 0),
|
||||||
|
separatorBuilder: (context, i) {
|
||||||
|
if (i == messages.length) return Offstage();
|
||||||
|
if (i == 0) return SizedBox(height: 30);
|
||||||
|
if (i == messages.length + 1) {
|
||||||
|
final replyCount =
|
||||||
|
widget.parentMessage.replyCount;
|
||||||
|
return Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
gradient: StreamChatTheme.of(context)
|
||||||
|
.colorTheme
|
||||||
|
.bgGradient,
|
||||||
|
),
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Text(
|
||||||
|
'$replyCount ${replyCount == 1 ? 'Reply' : 'Replies'}',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: StreamChatTheme.of(context)
|
||||||
|
.channelTheme
|
||||||
|
.channelHeaderTheme
|
||||||
|
.lastMessageAt,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
final message = messages[i];
|
||||||
|
final nextMessage = messages[i - 1];
|
||||||
|
if (!Jiffy(message.createdAt.toLocal()).isSame(
|
||||||
|
nextMessage.createdAt.toLocal(),
|
||||||
|
Units.DAY,
|
||||||
|
)) {
|
||||||
|
final divider = widget.dateDividerBuilder != null
|
||||||
|
? widget.dateDividerBuilder(
|
||||||
|
nextMessage.createdAt.toLocal(),
|
||||||
|
)
|
||||||
|
: DateDivider(
|
||||||
|
dateTime: nextMessage.createdAt.toLocal(),
|
||||||
|
);
|
||||||
|
return Padding(
|
||||||
|
padding:
|
||||||
|
const EdgeInsets.symmetric(vertical: 12.0),
|
||||||
|
child: divider,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
final timeDiff =
|
||||||
|
Jiffy(nextMessage.createdAt.toLocal()).diff(
|
||||||
|
message.createdAt.toLocal(),
|
||||||
|
Units.MINUTE,
|
||||||
|
);
|
||||||
|
|
||||||
|
final isNextUserSame =
|
||||||
|
message.user.id == nextMessage.user?.id;
|
||||||
|
final isThread = message.replyCount > 0;
|
||||||
|
final isDeleted = message.isDeleted;
|
||||||
|
if (timeDiff >= 1 ||
|
||||||
|
!isNextUserSame ||
|
||||||
|
isThread ||
|
||||||
|
isDeleted) {
|
||||||
|
return SizedBox(height: 8);
|
||||||
|
}
|
||||||
|
return SizedBox(height: 2);
|
||||||
|
},
|
||||||
|
itemBuilder: (context, i) {
|
||||||
|
if (i == messages.length + 2) {
|
||||||
|
if (widget.parentMessageBuilder != null) {
|
||||||
|
return widget.parentMessageBuilder(
|
||||||
|
context,
|
||||||
|
widget.parentMessage,
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return buildParentMessage(widget.parentMessage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (i == messages.length + 1) {
|
||||||
|
return _buildLoadingIndicator(
|
||||||
|
streamChannel,
|
||||||
|
QueryDirection.top,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (i == 0) {
|
||||||
|
return _buildLoadingIndicator(
|
||||||
streamChannel,
|
streamChannel,
|
||||||
QueryDirection.bottom,
|
QueryDirection.bottom,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
final message = messages[i - 1];
|
||||||
onEndOfPage: () async {
|
|
||||||
_inBetweenList = false;
|
|
||||||
_topPaginationActive = true;
|
|
||||||
_bottomPaginationActive = false;
|
|
||||||
return _paginateData(
|
|
||||||
streamChannel,
|
|
||||||
QueryDirection.top,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
onInBetweenOfPage: () {
|
|
||||||
_inBetweenList = true;
|
|
||||||
},
|
|
||||||
child: ScrollablePositionedList.separated(
|
|
||||||
key: ValueKey(initialIndex + initialAlignment),
|
|
||||||
itemPositionsListener: _itemPositionListener,
|
|
||||||
addAutomaticKeepAlives: true,
|
|
||||||
initialScrollIndex: initialIndex ?? 0,
|
|
||||||
initialAlignment: initialAlignment ?? 0,
|
|
||||||
physics: widget.scrollPhysics,
|
|
||||||
itemScrollController: _scrollController,
|
|
||||||
reverse: true,
|
|
||||||
itemCount: messages.length +
|
|
||||||
2 +
|
|
||||||
(_isThreadConversation ? 1 : 0),
|
|
||||||
separatorBuilder: (context, i) {
|
|
||||||
if (i == messages.length) return Offstage();
|
|
||||||
if (i == 0) return SizedBox(height: 30);
|
|
||||||
if (i == messages.length + 1) {
|
|
||||||
final replyCount =
|
|
||||||
widget.parentMessage.replyCount;
|
|
||||||
return Container(
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
gradient: StreamChatTheme.of(context)
|
|
||||||
.colorTheme
|
|
||||||
.bgGradient,
|
|
||||||
),
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.all(8.0),
|
|
||||||
child: Text(
|
|
||||||
'$replyCount ${replyCount == 1 ? 'Reply' : 'Replies'}',
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: StreamChatTheme.of(context)
|
|
||||||
.channelTheme
|
|
||||||
.channelHeaderTheme
|
|
||||||
.lastMessageAt,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
final message = messages[i];
|
Widget messageWidget;
|
||||||
final nextMessage = messages[i - 1];
|
|
||||||
if (!Jiffy(message.createdAt.toLocal()).isSame(
|
if (i == 1) {
|
||||||
nextMessage.createdAt.toLocal(),
|
messageWidget = _buildBottomMessage(
|
||||||
Units.DAY,
|
context,
|
||||||
)) {
|
message,
|
||||||
final divider =
|
messages,
|
||||||
widget.dateDividerBuilder != null
|
streamChannel,
|
||||||
? widget.dateDividerBuilder(
|
|
||||||
nextMessage.createdAt.toLocal(),
|
|
||||||
)
|
|
||||||
: DateDivider(
|
|
||||||
dateTime:
|
|
||||||
nextMessage.createdAt.toLocal(),
|
|
||||||
);
|
|
||||||
return Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(
|
|
||||||
vertical: 12.0),
|
|
||||||
child: divider,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
final timeDiff =
|
|
||||||
Jiffy(nextMessage.createdAt.toLocal()).diff(
|
|
||||||
message.createdAt.toLocal(),
|
|
||||||
Units.MINUTE,
|
|
||||||
);
|
);
|
||||||
|
} else if (i == messages.length - 1) {
|
||||||
final isNextUserSame =
|
messageWidget = _buildTopMessage(
|
||||||
message.user.id == nextMessage.user?.id;
|
context,
|
||||||
final isThread = message.replyCount > 0;
|
message,
|
||||||
final isDeleted = message.isDeleted;
|
messages,
|
||||||
if (timeDiff >= 1 ||
|
streamChannel,
|
||||||
!isNextUserSame ||
|
);
|
||||||
isThread ||
|
} else {
|
||||||
isDeleted) {
|
if (widget.messageBuilder != null) {
|
||||||
return SizedBox(height: 8);
|
messageWidget = Builder(
|
||||||
}
|
key:
|
||||||
return SizedBox(height: 2);
|
ValueKey<String>('MESSAGE-${message.id}'),
|
||||||
},
|
builder: (context) => widget.messageBuilder(
|
||||||
itemBuilder: (context, i) {
|
context,
|
||||||
if (i == messages.length + 2) {
|
MessageDetails(
|
||||||
if (widget.parentMessageBuilder != null) {
|
context,
|
||||||
return widget.parentMessageBuilder(
|
message,
|
||||||
context,
|
messages,
|
||||||
widget.parentMessage,
|
i,
|
||||||
);
|
),
|
||||||
} else {
|
messages),
|
||||||
return buildParentMessage(
|
|
||||||
widget.parentMessage);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (i == messages.length + 1) {
|
|
||||||
return _buildLoadingIndicator(
|
|
||||||
streamChannel,
|
|
||||||
QueryDirection.top,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (i == 0) {
|
|
||||||
return _buildLoadingIndicator(
|
|
||||||
streamChannel,
|
|
||||||
QueryDirection.bottom,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
final message = messages[i - 1];
|
|
||||||
|
|
||||||
Widget messageWidget;
|
|
||||||
|
|
||||||
if (i == 1) {
|
|
||||||
messageWidget = _buildBottomMessage(
|
|
||||||
context,
|
|
||||||
message,
|
|
||||||
messages,
|
|
||||||
streamChannel,
|
|
||||||
);
|
|
||||||
} else if (i == messages.length - 1) {
|
|
||||||
messageWidget = _buildTopMessage(
|
|
||||||
context,
|
|
||||||
message,
|
|
||||||
messages,
|
|
||||||
streamChannel,
|
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
if (widget.messageBuilder != null) {
|
messageWidget =
|
||||||
messageWidget = Builder(
|
buildMessage(message, messages, i);
|
||||||
key: ValueKey<String>(
|
|
||||||
'MESSAGE-${message.id}'),
|
|
||||||
builder: (context) => widget.messageBuilder(
|
|
||||||
context,
|
|
||||||
MessageDetails(
|
|
||||||
context,
|
|
||||||
message,
|
|
||||||
messages,
|
|
||||||
i,
|
|
||||||
),
|
|
||||||
messages),
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
messageWidget =
|
|
||||||
buildMessage(message, messages, i);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return messageWidget;
|
}
|
||||||
},
|
return messageWidget;
|
||||||
),
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user