fix: visible footnote spacing and visibility.
Signed-off-by: xsahil03x <[email protected]>
This commit is contained in:
@@ -22,7 +22,6 @@ class StreamQuotedMessageWidget extends StatelessWidget {
|
|||||||
this.padding = const EdgeInsets.all(8),
|
this.padding = const EdgeInsets.all(8),
|
||||||
this.onTap,
|
this.onTap,
|
||||||
this.onQuotedMessageClear,
|
this.onQuotedMessageClear,
|
||||||
this.composing = true,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
/// The message
|
/// The message
|
||||||
@@ -53,9 +52,6 @@ class StreamQuotedMessageWidget extends StatelessWidget {
|
|||||||
/// Callback for clearing quoted messages.
|
/// Callback for clearing quoted messages.
|
||||||
final VoidCallback? onQuotedMessageClear;
|
final VoidCallback? onQuotedMessageClear;
|
||||||
|
|
||||||
/// True if the message is being composed
|
|
||||||
final bool composing;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final children = [
|
final children = [
|
||||||
@@ -63,11 +59,10 @@ class StreamQuotedMessageWidget extends StatelessWidget {
|
|||||||
child: _QuotedMessage(
|
child: _QuotedMessage(
|
||||||
message: message,
|
message: message,
|
||||||
textLimit: textLimit,
|
textLimit: textLimit,
|
||||||
composing: composing,
|
|
||||||
onQuotedMessageClear: onQuotedMessageClear,
|
|
||||||
messageTheme: messageTheme,
|
messageTheme: messageTheme,
|
||||||
showBorder: showBorder,
|
showBorder: showBorder,
|
||||||
reverse: reverse,
|
reverse: reverse,
|
||||||
|
onQuotedMessageClear: onQuotedMessageClear,
|
||||||
attachmentThumbnailBuilders: attachmentThumbnailBuilders,
|
attachmentThumbnailBuilders: attachmentThumbnailBuilders,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -104,17 +99,15 @@ class _QuotedMessage extends StatelessWidget {
|
|||||||
const _QuotedMessage({
|
const _QuotedMessage({
|
||||||
required this.message,
|
required this.message,
|
||||||
required this.textLimit,
|
required this.textLimit,
|
||||||
required this.composing,
|
|
||||||
required this.onQuotedMessageClear,
|
|
||||||
required this.messageTheme,
|
required this.messageTheme,
|
||||||
required this.showBorder,
|
required this.showBorder,
|
||||||
required this.reverse,
|
required this.reverse,
|
||||||
|
this.onQuotedMessageClear,
|
||||||
this.attachmentThumbnailBuilders,
|
this.attachmentThumbnailBuilders,
|
||||||
});
|
});
|
||||||
|
|
||||||
final Message message;
|
final Message message;
|
||||||
final int textLimit;
|
final int textLimit;
|
||||||
final bool composing;
|
|
||||||
final VoidCallback? onQuotedMessageClear;
|
final VoidCallback? onQuotedMessageClear;
|
||||||
final StreamMessageThemeData messageTheme;
|
final StreamMessageThemeData messageTheme;
|
||||||
final bool showBorder;
|
final bool showBorder;
|
||||||
@@ -161,7 +154,7 @@ class _QuotedMessage extends StatelessWidget {
|
|||||||
} else {
|
} else {
|
||||||
// Show quoted message
|
// Show quoted message
|
||||||
children = [
|
children = [
|
||||||
if (composing)
|
if (onQuotedMessageClear != null)
|
||||||
PlatformWidgetBuilder(
|
PlatformWidgetBuilder(
|
||||||
web: (context, child) => child,
|
web: (context, child) => child,
|
||||||
desktop: (context, child) => child,
|
desktop: (context, child) => child,
|
||||||
|
|||||||
@@ -282,9 +282,14 @@ class StreamMessageListView extends StatefulWidget {
|
|||||||
BuildContext context,
|
BuildContext context,
|
||||||
List<SpacingType> spacingTypes,
|
List<SpacingType> spacingTypes,
|
||||||
) {
|
) {
|
||||||
if (!spacingTypes.contains(SpacingType.defaultSpacing)) {
|
if (spacingTypes.contains(SpacingType.otherUser)) {
|
||||||
|
return const SizedBox(height: 8);
|
||||||
|
} else if (spacingTypes.contains(SpacingType.thread)) {
|
||||||
|
return const SizedBox(height: 8);
|
||||||
|
} else if (spacingTypes.contains(SpacingType.timeDiff)) {
|
||||||
return const SizedBox(height: 8);
|
return const SizedBox(height: 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
return const SizedBox(height: 2);
|
return const SizedBox(height: 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -644,7 +649,8 @@ class _StreamMessageListViewState extends State<StreamMessageListView> {
|
|||||||
|
|
||||||
Widget separator;
|
Widget separator;
|
||||||
|
|
||||||
final isThread = message.replyCount! > 0;
|
final isPartOfThread = message.replyCount! > 0 ||
|
||||||
|
message.showInChannel == true;
|
||||||
|
|
||||||
if (!Jiffy(message.createdAt.toLocal()).isSame(
|
if (!Jiffy(message.createdAt.toLocal()).isSame(
|
||||||
nextMessage.createdAt.toLocal(),
|
nextMessage.createdAt.toLocal(),
|
||||||
@@ -666,7 +672,7 @@ class _StreamMessageListViewState extends State<StreamMessageListView> {
|
|||||||
final spacingRules = [
|
final spacingRules = [
|
||||||
if (hasTimeDiff) SpacingType.timeDiff,
|
if (hasTimeDiff) SpacingType.timeDiff,
|
||||||
if (!isNextUserSame) SpacingType.otherUser,
|
if (!isNextUserSame) SpacingType.otherUser,
|
||||||
if (isThread) SpacingType.thread,
|
if (isPartOfThread) SpacingType.thread,
|
||||||
if (isDeleted) SpacingType.deleted,
|
if (isDeleted) SpacingType.deleted,
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -680,7 +686,7 @@ class _StreamMessageListViewState extends State<StreamMessageListView> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isThread &&
|
if (!isPartOfThread &&
|
||||||
unreadCount > 0 &&
|
unreadCount > 0 &&
|
||||||
_oldestUnreadMessage?.id == nextMessage.id) {
|
_oldestUnreadMessage?.id == nextMessage.id) {
|
||||||
final unreadMessagesSeparator =
|
final unreadMessagesSeparator =
|
||||||
|
|||||||
@@ -147,11 +147,15 @@ class BottomRow extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
if (isDeleted) {
|
if (isDeleted) {
|
||||||
return deletedBottomRowBuilder?.call(
|
final deletedBottomRowBuilder = this.deletedBottomRowBuilder;
|
||||||
context,
|
if (deletedBottomRowBuilder != null) {
|
||||||
message,
|
return deletedBottomRowBuilder(context, message);
|
||||||
) ??
|
}
|
||||||
const StreamVisibleFootnote();
|
|
||||||
|
// Only show visible footnote for ownUser.
|
||||||
|
final currentUser = streamChat.currentUser;
|
||||||
|
final isOwnUser = message.user?.id == currentUser?.id;
|
||||||
|
if (isOwnUser) return const StreamVisibleFootnote();
|
||||||
}
|
}
|
||||||
|
|
||||||
final children = <WidgetSpan>[];
|
final children = <WidgetSpan>[];
|
||||||
|
|||||||
@@ -794,8 +794,7 @@ class _StreamMessageWidgetState extends State<StreamMessageWidget>
|
|||||||
showUsername ||
|
showUsername ||
|
||||||
showTimeStamp ||
|
showTimeStamp ||
|
||||||
showInChannel ||
|
showInChannel ||
|
||||||
showSendingIndicator ||
|
showSendingIndicator;
|
||||||
isDeleted;
|
|
||||||
|
|
||||||
/// {@template isPinned}
|
/// {@template isPinned}
|
||||||
/// Whether [StreamMessageWidget.message] is pinned or not.
|
/// Whether [StreamMessageWidget.message] is pinned or not.
|
||||||
|
|||||||
@@ -65,7 +65,6 @@ class _QuotedMessageState extends State<QuotedMessage> {
|
|||||||
top: 8,
|
top: 8,
|
||||||
bottom: widget.hasNonUrlAttachments ? 8 : 0,
|
bottom: widget.hasNonUrlAttachments ? 8 : 0,
|
||||||
),
|
),
|
||||||
composing: false,
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user