Skip to content

Commit

Permalink
added showFailedIndicator parameter to MessageCard
Browse files Browse the repository at this point in the history
  • Loading branch information
TinhHuynh authored and Nathan Pham committed Nov 21, 2024
1 parent 596d729 commit 7e314f8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class MessageCard extends StatefulWidget {
required this.attachmentActionsModalBuilder,
required this.textPadding,
required this.reverse,
required this.showFailedIndicator,
this.shape,
this.borderSide,
this.borderRadiusGeometry,
Expand Down Expand Up @@ -116,6 +117,9 @@ class MessageCard extends StatefulWidget {
/// {@macro reverse}
final bool reverse;

/// {@macro showFailedIndicator}
final bool showFailedIndicator;

@override
State<MessageCard> createState() => _MessageCardState();
}
Expand Down Expand Up @@ -161,8 +165,9 @@ class _MessageCardState extends State<MessageCard> {
return Container(
constraints: const BoxConstraints().copyWith(maxWidth: widthLimit),
margin: EdgeInsets.symmetric(
horizontal: (widget.isFailedState ? 15.0 : 0.0) +
(widget.showUserAvatar == DisplayWidget.gone ? 0 : 4.0),
horizontal:
(widget.isFailedState && widget.showFailedIndicator ? 15.0 : 0.0) +
(widget.showUserAvatar == DisplayWidget.gone ? 0 : 4.0),
),
clipBehavior: Clip.hardEdge,
decoration: ShapeDecoration(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,7 @@ class StreamMessageWidget extends StatefulWidget {
String? imageAttachmentThumbnailResizeType,
String? imageAttachmentThumbnailCropType,
AttachmentActionsBuilder? attachmentActionsModalBuilder,
bool? showFailedIndicator
}) {
return StreamMessageWidget(
key: key ?? this.key,
Expand Down Expand Up @@ -520,6 +521,7 @@ class StreamMessageWidget extends StatefulWidget {
this.imageAttachmentThumbnailCropType,
attachmentActionsModalBuilder:
attachmentActionsModalBuilder ?? this.attachmentActionsModalBuilder,
showFailedIndicator: showFailedIndicator ?? this.showFailedIndicator,
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,8 @@ class MessageWidgetContent extends StatelessWidget {
: MessageCard(
message: message,
isFailedState: isFailedState,
showFailedIndicator:
showFailedIndicator,
showUserAvatar: showUserAvatar,
messageTheme: messageTheme,
hasQuotedMessage: hasQuotedMessage,
Expand Down

0 comments on commit 7e314f8

Please sign in to comment.