minor fixes
This commit is contained in:
@@ -432,6 +432,7 @@ class _MessageListViewState extends State<MessageListView> {
|
|||||||
physics: widget.scrollPhysics,
|
physics: widget.scrollPhysics,
|
||||||
itemScrollController: _scrollController,
|
itemScrollController: _scrollController,
|
||||||
reverse: true,
|
reverse: true,
|
||||||
|
addAutomaticKeepAlives: false,
|
||||||
itemCount:
|
itemCount:
|
||||||
messages.length + 2 + (_isThreadConversation ? 1 : 0),
|
messages.length + 2 + (_isThreadConversation ? 1 : 0),
|
||||||
separatorBuilder: (context, i) {
|
separatorBuilder: (context, i) {
|
||||||
|
|||||||
@@ -449,189 +449,182 @@ class _MessageWidgetState extends State<MessageWidget>
|
|||||||
final leftPadding =
|
final leftPadding =
|
||||||
widget.showUserAvatar != DisplayWidget.gone ? avatarWidth + 8.5 : 0.5;
|
widget.showUserAvatar != DisplayWidget.gone ? avatarWidth + 8.5 : 0.5;
|
||||||
|
|
||||||
return Material(
|
return Portal(
|
||||||
type: MaterialType.transparency,
|
child: GestureDetector(
|
||||||
child: Portal(
|
onTap: () {
|
||||||
child: InkWell(
|
widget.onMessageTap!(widget.message);
|
||||||
onTap: () {
|
},
|
||||||
widget.onMessageTap!(widget.message);
|
onLongPress: widget.message.isDeleted && !isFailedState
|
||||||
},
|
? null
|
||||||
onLongPress: widget.message.isDeleted && !isFailedState
|
: () => onLongPress(context),
|
||||||
? null
|
child: Padding(
|
||||||
: () => onLongPress(context),
|
padding: widget.padding ?? const EdgeInsets.all(8),
|
||||||
child: Padding(
|
child: FractionallySizedBox(
|
||||||
padding: widget.padding ?? const EdgeInsets.all(8),
|
alignment:
|
||||||
child: FractionallySizedBox(
|
widget.reverse ? Alignment.centerRight : Alignment.centerLeft,
|
||||||
alignment:
|
widthFactor: 0.78,
|
||||||
widget.reverse ? Alignment.centerRight : Alignment.centerLeft,
|
child: Column(
|
||||||
widthFactor: 0.78,
|
crossAxisAlignment: widget.reverse
|
||||||
child: Column(
|
? CrossAxisAlignment.end
|
||||||
crossAxisAlignment: widget.reverse
|
: CrossAxisAlignment.start,
|
||||||
? CrossAxisAlignment.end
|
mainAxisSize: MainAxisSize.min,
|
||||||
: CrossAxisAlignment.start,
|
children: <Widget>[
|
||||||
mainAxisSize: MainAxisSize.min,
|
Stack(
|
||||||
children: <Widget>[
|
clipBehavior: Clip.none,
|
||||||
Stack(
|
alignment: widget.reverse
|
||||||
clipBehavior: Clip.none,
|
? AlignmentDirectional.bottomEnd
|
||||||
alignment: widget.reverse
|
: AlignmentDirectional.bottomStart,
|
||||||
? AlignmentDirectional.bottomEnd
|
children: [
|
||||||
: AlignmentDirectional.bottomStart,
|
Column(
|
||||||
children: [
|
crossAxisAlignment: widget.reverse
|
||||||
Column(
|
? CrossAxisAlignment.end
|
||||||
crossAxisAlignment: widget.reverse
|
: CrossAxisAlignment.start,
|
||||||
? CrossAxisAlignment.end
|
mainAxisSize: MainAxisSize.min,
|
||||||
: CrossAxisAlignment.start,
|
children: [
|
||||||
mainAxisSize: MainAxisSize.min,
|
Row(
|
||||||
children: [
|
crossAxisAlignment: CrossAxisAlignment.end,
|
||||||
Row(
|
mainAxisSize: MainAxisSize.min,
|
||||||
crossAxisAlignment: CrossAxisAlignment.end,
|
children: <Widget>[
|
||||||
mainAxisSize: MainAxisSize.min,
|
if (widget.showUserAvatar == DisplayWidget.show &&
|
||||||
children: <Widget>[
|
widget.message.user != null) ...[
|
||||||
if (widget.showUserAvatar == DisplayWidget.show &&
|
_buildUserAvatar(),
|
||||||
widget.message.user != null) ...[
|
const SizedBox(width: 4),
|
||||||
_buildUserAvatar(),
|
],
|
||||||
const SizedBox(width: 4),
|
if (widget.showUserAvatar == DisplayWidget.hide)
|
||||||
],
|
SizedBox(width: avatarWidth + 4),
|
||||||
if (widget.showUserAvatar == DisplayWidget.hide)
|
Flexible(
|
||||||
SizedBox(width: avatarWidth + 4),
|
child: PortalEntry(
|
||||||
Flexible(
|
portal: Container(
|
||||||
child: PortalEntry(
|
transform: Matrix4.translationValues(
|
||||||
portal: Container(
|
widget.reverse ? 12 : -12, 0, 0),
|
||||||
transform: Matrix4.translationValues(
|
constraints:
|
||||||
widget.reverse ? 12 : -12, 0, 0),
|
const BoxConstraints(maxWidth: 22 * 6.0),
|
||||||
constraints: const BoxConstraints(
|
child: _buildReactionIndicator(context),
|
||||||
maxWidth: 22 * 6.0),
|
),
|
||||||
child: _buildReactionIndicator(context),
|
portalAnchor:
|
||||||
),
|
Alignment(widget.reverse ? 1 : -1, -1),
|
||||||
portalAnchor:
|
childAnchor:
|
||||||
Alignment(widget.reverse ? 1 : -1, -1),
|
Alignment(widget.reverse ? -1 : 1, -1),
|
||||||
childAnchor:
|
child: Stack(
|
||||||
Alignment(widget.reverse ? -1 : 1, -1),
|
clipBehavior: Clip.none,
|
||||||
child: Stack(
|
children: [
|
||||||
clipBehavior: Clip.none,
|
Padding(
|
||||||
children: [
|
padding: widget.showReactions
|
||||||
Padding(
|
? EdgeInsets.only(
|
||||||
padding: widget.showReactions
|
top: widget.message.reactionCounts
|
||||||
? EdgeInsets.only(
|
?.isNotEmpty ==
|
||||||
top: widget
|
true
|
||||||
.message
|
? 18
|
||||||
.reactionCounts
|
: 0,
|
||||||
?.isNotEmpty ==
|
)
|
||||||
true
|
: EdgeInsets.zero,
|
||||||
? 18
|
child: (widget.message.isDeleted &&
|
||||||
: 0,
|
!isFailedState)
|
||||||
)
|
? Container(
|
||||||
: EdgeInsets.zero,
|
// ignore: lines_longer_than_80_chars
|
||||||
child: (widget.message.isDeleted &&
|
margin: EdgeInsets.symmetric(
|
||||||
!isFailedState)
|
horizontal:
|
||||||
? Container(
|
|
||||||
// ignore: lines_longer_than_80_chars
|
|
||||||
margin: EdgeInsets.symmetric(
|
|
||||||
horizontal:
|
|
||||||
// ignore: lines_longer_than_80_chars
|
|
||||||
widget.showUserAvatar ==
|
|
||||||
// ignore: lines_longer_than_80_chars
|
|
||||||
DisplayWidget
|
|
||||||
.gone
|
|
||||||
? 0
|
|
||||||
: 4.0),
|
|
||||||
child: DeletedMessage(
|
|
||||||
borderRadiusGeometry: widget
|
|
||||||
.borderRadiusGeometry,
|
|
||||||
borderSide: widget.borderSide,
|
|
||||||
shape: widget.shape,
|
|
||||||
messageTheme:
|
|
||||||
widget.messageTheme,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
: Card(
|
|
||||||
clipBehavior: Clip.antiAlias,
|
|
||||||
elevation: 0,
|
|
||||||
margin: EdgeInsets.symmetric(
|
|
||||||
horizontal: (isFailedState
|
|
||||||
? 15.0
|
|
||||||
: 0.0) +
|
|
||||||
// ignore: lines_longer_than_80_chars
|
// ignore: lines_longer_than_80_chars
|
||||||
(widget.showUserAvatar ==
|
widget.showUserAvatar ==
|
||||||
|
// ignore: lines_longer_than_80_chars
|
||||||
DisplayWidget.gone
|
DisplayWidget.gone
|
||||||
? 0
|
? 0
|
||||||
: 4.0),
|
: 4.0),
|
||||||
),
|
child: DeletedMessage(
|
||||||
shape: widget.shape ??
|
borderRadiusGeometry:
|
||||||
RoundedRectangleBorder(
|
widget.borderRadiusGeometry,
|
||||||
side: widget.borderSide ??
|
borderSide: widget.borderSide,
|
||||||
BorderSide(
|
shape: widget.shape,
|
||||||
color: widget
|
messageTheme:
|
||||||
// ignore: lines_longer_than_80_chars
|
widget.messageTheme,
|
||||||
.messageTheme
|
),
|
||||||
// ignore: lines_longer_than_80_chars
|
)
|
||||||
.messageBorderColor ??
|
: Card(
|
||||||
Colors.grey,
|
clipBehavior: Clip.antiAlias,
|
||||||
),
|
elevation: 0,
|
||||||
borderRadius: widget
|
margin: EdgeInsets.symmetric(
|
||||||
// ignore: lines_longer_than_80_chars
|
horizontal: (isFailedState
|
||||||
.borderRadiusGeometry ??
|
? 15.0
|
||||||
BorderRadius.zero,
|
: 0.0) +
|
||||||
),
|
// ignore: lines_longer_than_80_chars
|
||||||
color: _getBackgroundColor(),
|
(widget.showUserAvatar ==
|
||||||
child: Column(
|
DisplayWidget.gone
|
||||||
crossAxisAlignment:
|
? 0
|
||||||
CrossAxisAlignment.end,
|
: 4.0),
|
||||||
mainAxisSize:
|
),
|
||||||
MainAxisSize.min,
|
shape: widget.shape ??
|
||||||
children: <Widget>[
|
RoundedRectangleBorder(
|
||||||
if (hasQuotedMessage)
|
side: widget.borderSide ??
|
||||||
_buildQuotedMessage(),
|
BorderSide(
|
||||||
if (hasNonUrlAttachments)
|
color: widget
|
||||||
_parseAttachments(),
|
// ignore: lines_longer_than_80_chars
|
||||||
if (!isGiphy)
|
.messageTheme
|
||||||
_buildTextBubble(),
|
// ignore: lines_longer_than_80_chars
|
||||||
],
|
.messageBorderColor ??
|
||||||
),
|
Colors.grey,
|
||||||
|
),
|
||||||
|
borderRadius: widget
|
||||||
|
// ignore: lines_longer_than_80_chars
|
||||||
|
.borderRadiusGeometry ??
|
||||||
|
BorderRadius.zero,
|
||||||
|
),
|
||||||
|
color: _getBackgroundColor(),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment:
|
||||||
|
CrossAxisAlignment.end,
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: <Widget>[
|
||||||
|
if (hasQuotedMessage)
|
||||||
|
_buildQuotedMessage(),
|
||||||
|
if (hasNonUrlAttachments)
|
||||||
|
_parseAttachments(),
|
||||||
|
if (!isGiphy)
|
||||||
|
_buildTextBubble(),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
),
|
|
||||||
if (widget.showReactionPickerIndicator)
|
|
||||||
Positioned(
|
|
||||||
right: widget.reverse ? null : 4,
|
|
||||||
left: widget.reverse ? 4 : null,
|
|
||||||
top: -8,
|
|
||||||
child: CustomPaint(
|
|
||||||
painter: ReactionBubblePainter(
|
|
||||||
StreamChatTheme.of(context)
|
|
||||||
.colorTheme
|
|
||||||
.white,
|
|
||||||
Colors.transparent,
|
|
||||||
Colors.transparent,
|
|
||||||
tailCirclesSpace: 1,
|
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
if (widget.showReactionPickerIndicator)
|
||||||
|
Positioned(
|
||||||
|
right: widget.reverse ? null : 4,
|
||||||
|
left: widget.reverse ? 4 : null,
|
||||||
|
top: -8,
|
||||||
|
child: CustomPaint(
|
||||||
|
painter: ReactionBubblePainter(
|
||||||
|
StreamChatTheme.of(context)
|
||||||
|
.colorTheme
|
||||||
|
.white,
|
||||||
|
Colors.transparent,
|
||||||
|
Colors.transparent,
|
||||||
|
tailCirclesSpace: 1,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
),
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
),
|
],
|
||||||
if (showBottomRow)
|
),
|
||||||
SizedBox(height: context.textScaleFactor * 18.0),
|
if (showBottomRow)
|
||||||
],
|
SizedBox(height: context.textScaleFactor * 18.0),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
if (showBottomRow)
|
||||||
|
Padding(
|
||||||
|
padding: EdgeInsets.only(left: leftPadding),
|
||||||
|
child: _bottomRow,
|
||||||
),
|
),
|
||||||
if (showBottomRow)
|
if (isFailedState)
|
||||||
Padding(
|
Positioned(
|
||||||
padding: EdgeInsets.only(left: leftPadding),
|
left: widget.reverse ? 0 : null,
|
||||||
child: _bottomRow,
|
right: widget.reverse ? null : 0,
|
||||||
),
|
bottom: showBottomRow ? 18 : -2,
|
||||||
if (isFailedState)
|
child: StreamSvgIcon.error(size: 20),
|
||||||
Positioned(
|
),
|
||||||
left: widget.reverse ? 0 : null,
|
],
|
||||||
right: widget.reverse ? null : 0,
|
),
|
||||||
bottom: showBottomRow ? 18 : -2,
|
],
|
||||||
child: StreamSvgIcon.error(size: 20),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user