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? imageAttachmentThumbnailCropType,
|
||||
}) {
|
||||
assert(
|
||||
bottomRowBuilder == null || bottomRowBuilderWithDefaultWidget == null,
|
||||
'You can only use one of the two bottom row builders',
|
||||
);
|
||||
|
||||
var _bottomRowBuilderWithDefaultWidget =
|
||||
bottomRowBuilderWithDefaultWidget ??
|
||||
this.bottomRowBuilderWithDefaultWidget;
|
||||
@@ -629,9 +634,10 @@ class StreamMessageWidget extends StatefulWidget {
|
||||
}
|
||||
|
||||
return defaultWidget.copyWith(
|
||||
onThreadTap: onThreadTap,
|
||||
usernameBuilder: usernameBuilder,
|
||||
deletedBottomRowBuilder: deletedBottomRowBuilder,
|
||||
onThreadTap: onThreadTap ?? this.onThreadTap,
|
||||
usernameBuilder: usernameBuilder ?? this.usernameBuilder,
|
||||
deletedBottomRowBuilder:
|
||||
deletedBottomRowBuilder ?? this.deletedBottomRowBuilder,
|
||||
);
|
||||
};
|
||||
|
||||
@@ -883,7 +889,25 @@ class _StreamMessageWidgetState extends State<StreamMessageWidget>
|
||||
? Alignment.centerRight
|
||||
: Alignment.centerLeft,
|
||||
widthFactor: widget.widthFactor,
|
||||
child: MessageWidgetContent(
|
||||
child: Builder(builder: (context) {
|
||||
var _bottomRowBuilderWithDefaultWidget =
|
||||
widget.bottomRowBuilderWithDefaultWidget;
|
||||
|
||||
_bottomRowBuilderWithDefaultWidget ??=
|
||||
(context, message, defaultWidget) {
|
||||
final _bottomRowBuilder = widget.bottomRowBuilder;
|
||||
if (_bottomRowBuilder != null) {
|
||||
return _bottomRowBuilder(context, message);
|
||||
}
|
||||
|
||||
return defaultWidget.copyWith(
|
||||
onThreadTap: widget.onThreadTap,
|
||||
usernameBuilder: widget.usernameBuilder,
|
||||
deletedBottomRowBuilder: widget.deletedBottomRowBuilder,
|
||||
);
|
||||
};
|
||||
|
||||
return MessageWidgetContent(
|
||||
streamChatTheme: _streamChatTheme,
|
||||
showUsername: showUsername,
|
||||
showTimeStamp: showTimeStamp,
|
||||
@@ -923,10 +947,11 @@ class _StreamMessageWidgetState extends State<StreamMessageWidget>
|
||||
onMentionTap: widget.onMentionTap,
|
||||
onQuotedMessageTap: widget.onQuotedMessageTap,
|
||||
bottomRowBuilderWithDefaultWidget:
|
||||
widget.bottomRowBuilderWithDefaultWidget,
|
||||
_bottomRowBuilderWithDefaultWidget,
|
||||
onUserAvatarTap: widget.onUserAvatarTap,
|
||||
userAvatarBuilder: widget.userAvatarBuilder,
|
||||
),
|
||||
);
|
||||
}),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user