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,7 +889,25 @@ 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) {
|
||||||
|
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,
|
streamChatTheme: _streamChatTheme,
|
||||||
showUsername: showUsername,
|
showUsername: showUsername,
|
||||||
showTimeStamp: showTimeStamp,
|
showTimeStamp: showTimeStamp,
|
||||||
@@ -923,10 +947,11 @@ class _StreamMessageWidgetState extends State<StreamMessageWidget>
|
|||||||
onMentionTap: widget.onMentionTap,
|
onMentionTap: widget.onMentionTap,
|
||||||
onQuotedMessageTap: widget.onQuotedMessageTap,
|
onQuotedMessageTap: widget.onQuotedMessageTap,
|
||||||
bottomRowBuilderWithDefaultWidget:
|
bottomRowBuilderWithDefaultWidget:
|
||||||
widget.bottomRowBuilderWithDefaultWidget,
|
_bottomRowBuilderWithDefaultWidget,
|
||||||
onUserAvatarTap: widget.onUserAvatarTap,
|
onUserAvatarTap: widget.onUserAvatarTap,
|
||||||
userAvatarBuilder: widget.userAvatarBuilder,
|
userAvatarBuilder: widget.userAvatarBuilder,
|
||||||
),
|
);
|
||||||
|
}),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user