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 Sep 11, 2024
1 parent badc6ff commit 8b36128
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 @@ -444,6 +444,7 @@ class StreamMessageWidget extends StatefulWidget {
String? imageAttachmentThumbnailResizeType,
String? imageAttachmentThumbnailCropType,
AttachmentActionsBuilder? attachmentActionsModalBuilder,
bool? showFailedIndicator
}) {
return StreamMessageWidget(
key: key ?? this.key,
Expand Down Expand Up @@ -512,6 +513,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 @@ -324,6 +324,8 @@ class MessageWidgetContent extends StatelessWidget {
: MessageCard(
message: message,
isFailedState: isFailedState,
showFailedIndicator:
showFailedIndicator,
showUserAvatar: showUserAvatar,
messageTheme: messageTheme,
hasQuotedMessage: hasQuotedMessage,
Expand Down

0 comments on commit 8b36128

Please sign in to comment.