chore(ui): minor changes and assertion.
Signed-off-by: xsahil03x <[email protected]>
This commit is contained in:
@@ -618,6 +618,11 @@ class StreamMessageWidget extends StatefulWidget {
|
|||||||
String? imageAttachmentThumbnailResizeType,
|
String? imageAttachmentThumbnailResizeType,
|
||||||
String? imageAttachmentThumbnailCropType,
|
String? imageAttachmentThumbnailCropType,
|
||||||
}) {
|
}) {
|
||||||
|
assert(
|
||||||
|
bottomRowBuilder == null || bottomRowBuilderWithDefaultWidget == null,
|
||||||
|
'You can only use one of the two bottom row builders',
|
||||||
|
);
|
||||||
|
|
||||||
var _bottomRowBuilderWithDefaultWidget =
|
var _bottomRowBuilderWithDefaultWidget =
|
||||||
bottomRowBuilderWithDefaultWidget ??
|
bottomRowBuilderWithDefaultWidget ??
|
||||||
this.bottomRowBuilderWithDefaultWidget;
|
this.bottomRowBuilderWithDefaultWidget;
|
||||||
@@ -629,9 +634,10 @@ class StreamMessageWidget extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return defaultWidget.copyWith(
|
return defaultWidget.copyWith(
|
||||||
onThreadTap: onThreadTap,
|
onThreadTap: onThreadTap ?? this.onThreadTap,
|
||||||
usernameBuilder: usernameBuilder,
|
usernameBuilder: usernameBuilder ?? this.usernameBuilder,
|
||||||
deletedBottomRowBuilder: deletedBottomRowBuilder,
|
deletedBottomRowBuilder:
|
||||||
|
deletedBottomRowBuilder ?? this.deletedBottomRowBuilder,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -883,50 +889,69 @@ class _StreamMessageWidgetState extends State<StreamMessageWidget>
|
|||||||
? Alignment.centerRight
|
? Alignment.centerRight
|
||||||
: Alignment.centerLeft,
|
: Alignment.centerLeft,
|
||||||
widthFactor: widget.widthFactor,
|
widthFactor: widget.widthFactor,
|
||||||
child: MessageWidgetContent(
|
child: Builder(builder: (context) {
|
||||||
streamChatTheme: _streamChatTheme,
|
var _bottomRowBuilderWithDefaultWidget =
|
||||||
showUsername: showUsername,
|
widget.bottomRowBuilderWithDefaultWidget;
|
||||||
showTimeStamp: showTimeStamp,
|
|
||||||
showThreadReplyIndicator: showThreadReplyIndicator,
|
_bottomRowBuilderWithDefaultWidget ??=
|
||||||
showSendingIndicator: showSendingIndicator,
|
(context, message, defaultWidget) {
|
||||||
showInChannel: showInChannel,
|
final _bottomRowBuilder = widget.bottomRowBuilder;
|
||||||
isGiphy: isGiphy,
|
if (_bottomRowBuilder != null) {
|
||||||
isOnlyEmoji: isOnlyEmoji,
|
return _bottomRowBuilder(context, message);
|
||||||
hasUrlAttachments: hasUrlAttachments,
|
}
|
||||||
messageTheme: widget.messageTheme,
|
|
||||||
reverse: widget.reverse,
|
return defaultWidget.copyWith(
|
||||||
message: widget.message,
|
onThreadTap: widget.onThreadTap,
|
||||||
hasNonUrlAttachments: hasNonUrlAttachments,
|
usernameBuilder: widget.usernameBuilder,
|
||||||
shouldShowReactions: shouldShowReactions,
|
deletedBottomRowBuilder: widget.deletedBottomRowBuilder,
|
||||||
hasQuotedMessage: hasQuotedMessage,
|
);
|
||||||
textPadding: widget.textPadding,
|
};
|
||||||
attachmentBuilders: widget.attachmentBuilders,
|
|
||||||
attachmentPadding: widget.attachmentPadding,
|
return MessageWidgetContent(
|
||||||
avatarWidth: avatarWidth,
|
streamChatTheme: _streamChatTheme,
|
||||||
bottomRowPadding: bottomRowPadding,
|
showUsername: showUsername,
|
||||||
isFailedState: isFailedState,
|
showTimeStamp: showTimeStamp,
|
||||||
isPinned: isPinned,
|
showThreadReplyIndicator: showThreadReplyIndicator,
|
||||||
messageWidget: widget,
|
showSendingIndicator: showSendingIndicator,
|
||||||
showBottomRow: showBottomRow,
|
showInChannel: showInChannel,
|
||||||
showPinHighlight: widget.showPinHighlight,
|
isGiphy: isGiphy,
|
||||||
showReactionPickerIndicator:
|
isOnlyEmoji: isOnlyEmoji,
|
||||||
widget.showReactionPickerIndicator,
|
hasUrlAttachments: hasUrlAttachments,
|
||||||
showReactions: showReactions,
|
messageTheme: widget.messageTheme,
|
||||||
showUserAvatar: widget.showUserAvatar,
|
reverse: widget.reverse,
|
||||||
streamChat: _streamChat,
|
message: widget.message,
|
||||||
translateUserAvatar: widget.translateUserAvatar,
|
hasNonUrlAttachments: hasNonUrlAttachments,
|
||||||
shape: widget.shape,
|
shouldShowReactions: shouldShowReactions,
|
||||||
borderSide: widget.borderSide,
|
hasQuotedMessage: hasQuotedMessage,
|
||||||
borderRadiusGeometry: widget.borderRadiusGeometry,
|
textPadding: widget.textPadding,
|
||||||
textBuilder: widget.textBuilder,
|
attachmentBuilders: widget.attachmentBuilders,
|
||||||
onLinkTap: widget.onLinkTap,
|
attachmentPadding: widget.attachmentPadding,
|
||||||
onMentionTap: widget.onMentionTap,
|
avatarWidth: avatarWidth,
|
||||||
onQuotedMessageTap: widget.onQuotedMessageTap,
|
bottomRowPadding: bottomRowPadding,
|
||||||
bottomRowBuilderWithDefaultWidget:
|
isFailedState: isFailedState,
|
||||||
widget.bottomRowBuilderWithDefaultWidget,
|
isPinned: isPinned,
|
||||||
onUserAvatarTap: widget.onUserAvatarTap,
|
messageWidget: widget,
|
||||||
userAvatarBuilder: widget.userAvatarBuilder,
|
showBottomRow: showBottomRow,
|
||||||
),
|
showPinHighlight: widget.showPinHighlight,
|
||||||
|
showReactionPickerIndicator:
|
||||||
|
widget.showReactionPickerIndicator,
|
||||||
|
showReactions: showReactions,
|
||||||
|
showUserAvatar: widget.showUserAvatar,
|
||||||
|
streamChat: _streamChat,
|
||||||
|
translateUserAvatar: widget.translateUserAvatar,
|
||||||
|
shape: widget.shape,
|
||||||
|
borderSide: widget.borderSide,
|
||||||
|
borderRadiusGeometry: widget.borderRadiusGeometry,
|
||||||
|
textBuilder: widget.textBuilder,
|
||||||
|
onLinkTap: widget.onLinkTap,
|
||||||
|
onMentionTap: widget.onMentionTap,
|
||||||
|
onQuotedMessageTap: widget.onQuotedMessageTap,
|
||||||
|
bottomRowBuilderWithDefaultWidget:
|
||||||
|
_bottomRowBuilderWithDefaultWidget,
|
||||||
|
onUserAvatarTap: widget.onUserAvatarTap,
|
||||||
|
userAvatarBuilder: widget.userAvatarBuilder,
|
||||||
|
);
|
||||||
|
}),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user