From cdaac639e1133a3cbeaabb056bc7f5cf787fa415 Mon Sep 17 00:00:00 2001 From: RaulRodrigo06 Date: Thu, 26 Oct 2023 19:52:53 -0300 Subject: [PATCH] fix: passing reply content to ds card --- .../controllers/chat/ds_reply.controller.dart | 15 --------- lib/src/models/ds_message_item.model.dart | 5 +++ .../audio/ds_audio_message_bubble.widget.dart | 6 ++-- .../ds_application_json_bubble.widget.dart | 8 ++--- .../ds_contact_message_bubble.widget.dart | 7 ++-- .../chat/ds_file_message_bubble.widget.dart | 6 ++-- .../chat/ds_image_message_bubble.widget.dart | 6 ++-- .../ds_location_message_bubble.widget.dart | 6 ++-- .../chat/ds_message_bubble.widget.dart | 8 ++--- .../chat/ds_reply_container.widget.dart | 21 ++++++------ .../ds_request_location_bubble.widget.dart | 6 ++-- .../chat/ds_text_message_bubble.widget.dart | 6 ++-- ...pported_content_message_bubble.widget.dart | 6 ++-- lib/src/widgets/chat/ds_weblink.widget.dart | 8 ++--- .../video/ds_video_message_bubble.widget.dart | 8 ++--- lib/src/widgets/utils/ds_card.widget.dart | 32 +++++++++---------- .../widgets/utils/ds_group_card.widget.dart | 10 ++---- 17 files changed, 75 insertions(+), 89 deletions(-) delete mode 100644 lib/src/controllers/chat/ds_reply.controller.dart diff --git a/lib/src/controllers/chat/ds_reply.controller.dart b/lib/src/controllers/chat/ds_reply.controller.dart deleted file mode 100644 index 0586f3fb..00000000 --- a/lib/src/controllers/chat/ds_reply.controller.dart +++ /dev/null @@ -1,15 +0,0 @@ -import 'package:get/get.dart'; - -import '../../models/ds_message_item.model.dart'; - -class DSReplyController extends GetxController { - final List messages = []; - - void addMessages(List newMessages) { - messages.addAll(newMessages); - } - - DSMessageItemModel? getMessageById(String id) { - return messages.firstWhereOrNull((element) => element.id == id); - } -} diff --git a/lib/src/models/ds_message_item.model.dart b/lib/src/models/ds_message_item.model.dart index 856119b8..4dde23bf 100644 --- a/lib/src/models/ds_message_item.model.dart +++ b/lib/src/models/ds_message_item.model.dart @@ -26,6 +26,9 @@ class DSMessageItemModel { /// Customer data Map? customer; + /// The message content + dynamic replyContent; + /// Used to define if a message detail (typicament a messages date and time) should be displayed or not bool? hideMessageDetail; @@ -40,6 +43,7 @@ class DSMessageItemModel { this.content, this.customer, this.hideMessageDetail, + this.replyContent, }); factory DSMessageItemModel.fromJson(Map json) { @@ -52,6 +56,7 @@ class DSMessageItemModel { content: json['content'], status: DSDeliveryReportStatus.unknown.getValue(json['status']), hideMessageDetail: json['hideMessageDetail'], + replyContent: json['replyContent'], ); if (json.containsKey('customer')) { diff --git a/lib/src/widgets/chat/audio/ds_audio_message_bubble.widget.dart b/lib/src/widgets/chat/audio/ds_audio_message_bubble.widget.dart index aa01d4b4..e7193f6c 100644 --- a/lib/src/widgets/chat/audio/ds_audio_message_bubble.widget.dart +++ b/lib/src/widgets/chat/audio/ds_audio_message_bubble.widget.dart @@ -15,7 +15,7 @@ class DSAudioMessageBubble extends StatelessWidget { final String? uniqueId; final String audioType; final bool shouldAuthenticate; - final String? replyId; + final dynamic replyContent; DSAudioMessageBubble({ super.key, @@ -23,7 +23,7 @@ class DSAudioMessageBubble extends StatelessWidget { required this.align, required this.audioType, this.uniqueId, - this.replyId, + this.replyContent, this.borderRadius = const [DSBorderRadius.all], this.shouldAuthenticate = false, final DSMessageBubbleStyle? style, @@ -37,7 +37,7 @@ class DSAudioMessageBubble extends StatelessWidget { return DSMessageBubble( borderRadius: borderRadius, align: align, - replyId: replyId, + replyContent: replyContent, style: style, padding: const EdgeInsets.only( left: 4.0, diff --git a/lib/src/widgets/chat/ds_application_json_bubble.widget.dart b/lib/src/widgets/chat/ds_application_json_bubble.widget.dart index 2ec30d9c..307f3fbf 100644 --- a/lib/src/widgets/chat/ds_application_json_bubble.widget.dart +++ b/lib/src/widgets/chat/ds_application_json_bubble.widget.dart @@ -15,14 +15,14 @@ class DSApplicationJsonMessageBubble extends StatelessWidget { required this.borderRadius, required this.content, this.status, - this.replyId, + this.replyContent, DSMessageBubbleStyle? style, }) : style = style ?? DSMessageBubbleStyle(); final DSAlign align; final List borderRadius; final Map content; - final String? replyId; + final dynamic replyContent; final DSDeliveryReportStatus? status; final DSMessageBubbleStyle style; @@ -33,7 +33,7 @@ class DSApplicationJsonMessageBubble extends StatelessWidget { opacity: status == DSDeliveryReportStatus.failed ? .3 : 1, child: DSUnsupportedContentMessageBubble( align: align, - replyId: replyId, + replyContent: replyContent, borderRadius: borderRadius, style: style, overflow: TextOverflow.visible, @@ -53,7 +53,7 @@ class DSApplicationJsonMessageBubble extends StatelessWidget { align: align, borderRadius: borderRadius, style: style, - replyId: replyId, + replyContent: replyContent, ); } } diff --git a/lib/src/widgets/chat/ds_contact_message_bubble.widget.dart b/lib/src/widgets/chat/ds_contact_message_bubble.widget.dart index 664ca2d1..80b83553 100644 --- a/lib/src/widgets/chat/ds_contact_message_bubble.widget.dart +++ b/lib/src/widgets/chat/ds_contact_message_bubble.widget.dart @@ -6,7 +6,7 @@ class DSContactMessageBubble extends StatelessWidget { final String? phone; final String? email; final String? address; - final String? replyId; + final dynamic replyContent; final DSAlign align; final List borderRadius; final DSMessageBubbleStyle style; @@ -18,7 +18,7 @@ class DSContactMessageBubble extends StatelessWidget { required this.address, required this.email, required this.align, - this.replyId, + this.replyContent, this.borderRadius = const [DSBorderRadius.all], DSMessageBubbleStyle? style, }) : style = style ?? DSMessageBubbleStyle(); @@ -31,7 +31,7 @@ class DSContactMessageBubble extends StatelessWidget { padding: const EdgeInsets.all(16.0), shouldUseDefaultSize: true, style: style, - replyId: replyId, + replyContent: replyContent, child: _buildContactCard(), ); } @@ -53,6 +53,7 @@ class DSContactMessageBubble extends StatelessWidget { ), ), const SizedBox(height: 16.0), + /// TODO(format): Format phone number if (phone != null) Padding( diff --git a/lib/src/widgets/chat/ds_file_message_bubble.widget.dart b/lib/src/widgets/chat/ds_file_message_bubble.widget.dart index 21b63e25..6c6a0e5a 100644 --- a/lib/src/widgets/chat/ds_file_message_bubble.widget.dart +++ b/lib/src/widgets/chat/ds_file_message_bubble.widget.dart @@ -22,7 +22,7 @@ class DSFileMessageBubble extends StatelessWidget { final List borderRadius; final DSMessageBubbleStyle style; final bool shouldAuthenticate; - final String? replyId; + final dynamic replyContent; /// Creates a Design System's [DSMessageBubble] used on files other than image, audio, or video DSFileMessageBubble({ @@ -31,7 +31,7 @@ class DSFileMessageBubble extends StatelessWidget { required this.url, required this.size, required this.filename, - this.replyId, + this.replyContent, this.borderRadius = const [DSBorderRadius.all], this.shouldAuthenticate = false, DSMessageBubbleStyle? style, @@ -48,7 +48,7 @@ class DSFileMessageBubble extends StatelessWidget { ), child: DSMessageBubble( borderRadius: borderRadius, - replyId: replyId, + replyContent: replyContent, padding: EdgeInsets.zero, align: align, style: style, diff --git a/lib/src/widgets/chat/ds_image_message_bubble.widget.dart b/lib/src/widgets/chat/ds_image_message_bubble.widget.dart index d558f00d..d97bf801 100644 --- a/lib/src/widgets/chat/ds_image_message_bubble.widget.dart +++ b/lib/src/widgets/chat/ds_image_message_bubble.widget.dart @@ -29,7 +29,7 @@ class DSImageMessageBubble extends StatefulWidget { this.showSelect = false, this.onSelected, this.onOpenLink, - this.replyId, + this.replyContent, this.shouldAuthenticate = false, this.mediaType, this.imageMaxHeight, @@ -44,7 +44,7 @@ class DSImageMessageBubble extends StatefulWidget { final String? text; final String appBarText; final Uri? appBarPhotoUri; - final String? replyId; + final dynamic replyContent; final DSMessageBubbleStyle style; final List selectOptions; final bool showSelect; @@ -86,7 +86,7 @@ class _DSImageMessageBubbleState extends State defaultMaxSize: 360.0, shouldUseDefaultSize: true, align: widget.align, - replyId:widget.replyId, + replyContent: widget.replyContent, borderRadius: widget.borderRadius, padding: EdgeInsets.zero, hasSpacer: widget.hasSpacer, diff --git a/lib/src/widgets/chat/ds_location_message_bubble.widget.dart b/lib/src/widgets/chat/ds_location_message_bubble.widget.dart index 688361b9..924e666e 100644 --- a/lib/src/widgets/chat/ds_location_message_bubble.widget.dart +++ b/lib/src/widgets/chat/ds_location_message_bubble.widget.dart @@ -16,7 +16,7 @@ class DSLocationMessageBubble extends StatelessWidget { final DSAlign align; final DSMessageBubbleStyle style; final String? title; - final String? replyId; + final dynamic replyContent; final String latitude; final String longitude; final List borderRadius; @@ -26,7 +26,7 @@ class DSLocationMessageBubble extends StatelessWidget { required this.align, required this.latitude, required this.longitude, - this.replyId, + this.replyContent, this.borderRadius = const [DSBorderRadius.all], DSMessageBubbleStyle? style, this.title, @@ -58,7 +58,7 @@ class DSLocationMessageBubble extends StatelessWidget { defaultMaxSize: 240.0, defaultMinSize: 240.0, borderRadius: borderRadius, - replyId: replyId, + replyContent: replyContent, padding: EdgeInsets.zero, align: align, style: style, diff --git a/lib/src/widgets/chat/ds_message_bubble.widget.dart b/lib/src/widgets/chat/ds_message_bubble.widget.dart index bcea3632..07f27c9e 100644 --- a/lib/src/widgets/chat/ds_message_bubble.widget.dart +++ b/lib/src/widgets/chat/ds_message_bubble.widget.dart @@ -11,7 +11,7 @@ import '../animations/ds_animated_size.widget.dart'; class DSMessageBubble extends StatelessWidget { final DSAlign align; final Widget child; - final String? replyId; + final dynamic replyContent; final List borderRadius; final EdgeInsets padding; final bool shouldUseDefaultSize; @@ -24,7 +24,7 @@ class DSMessageBubble extends StatelessWidget { Key? key, required this.align, required this.child, - this.replyId, + this.replyContent, this.borderRadius = const [DSBorderRadius.all], this.padding = const EdgeInsets.symmetric( vertical: 8.0, @@ -67,9 +67,9 @@ class DSMessageBubble extends StatelessWidget { mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: [ - if (replyId != null) + if (replyContent != null) DSReplyContainer( - replyId: replyId!, + replyContent: replyContent!, style: style, align: align, ), diff --git a/lib/src/widgets/chat/ds_reply_container.widget.dart b/lib/src/widgets/chat/ds_reply_container.widget.dart index 8dbc1d9f..ff0fb12e 100644 --- a/lib/src/widgets/chat/ds_reply_container.widget.dart +++ b/lib/src/widgets/chat/ds_reply_container.widget.dart @@ -1,7 +1,5 @@ import 'package:flutter/material.dart'; -import 'package:get/get.dart'; -import '../../controllers/chat/ds_reply.controller.dart'; import '../../enums/ds_align.enum.dart'; import '../../models/ds_message_bubble_style.model.dart'; import '../../themes/colors/ds_colors.theme.dart'; @@ -13,13 +11,13 @@ import '../texts/ds_caption_text.widget.dart'; class DSReplyContainer extends StatelessWidget { const DSReplyContainer({ super.key, - required this.replyId, + required this.replyContent, required this.style, required this.align, }); final DSAlign align; - final String replyId; + final dynamic replyContent; final DSMessageBubbleStyle style; @override @@ -84,7 +82,7 @@ class DSReplyContainer extends StatelessWidget { left: 8.0, bottom: 8.0, ), - child: _replyWidget(replyId, style, align), + child: _replyWidget(replyContent, style, align), ), ), ], @@ -98,17 +96,18 @@ class DSReplyContainer extends StatelessWidget { } Widget _replyWidget( - String id, + dynamic replyContent, DSMessageBubbleStyle style, DSAlign align, ) { - final replyController = Get.find(); - final message = replyController.getMessageById(id); - - switch (message?.type) { + final replyType = + replyContent != '' ? replyContent['content']['replied']['type'] : ''; + switch (replyType) { case DSMessageContentType.textPlain: return DSBodyText( - message?.content is String ? message?.content : '**********', + replyContent['content']['replied']['value'] is String + ? replyContent['content']['replied']['value'] + : '**********', color: _color(align, style), overflow: TextOverflow.visible, ); diff --git a/lib/src/widgets/chat/ds_request_location_bubble.widget.dart b/lib/src/widgets/chat/ds_request_location_bubble.widget.dart index d8ceba85..b43455d6 100644 --- a/lib/src/widgets/chat/ds_request_location_bubble.widget.dart +++ b/lib/src/widgets/chat/ds_request_location_bubble.widget.dart @@ -14,7 +14,7 @@ class DSRequestLocationBubble extends StatelessWidget { required this.label, required this.value, required this.align, - this.replyId, + this.replyContent, this.type = DSMessageContentType.textPlain, this.borderRadius = const [DSBorderRadius.all], this.showRequestLocationButton = false, @@ -24,7 +24,7 @@ class DSRequestLocationBubble extends StatelessWidget { final String? label; final String type; final String? value; - final String? replyId; + final dynamic replyContent; final DSAlign align; final List borderRadius; final bool showRequestLocationButton; @@ -47,7 +47,7 @@ class DSRequestLocationBubble extends StatelessWidget { ), child: DSTextMessageBubble( text: value!, - replyId: replyId, + replyContent: replyContent, align: align, borderRadius: borderRadius, style: style, diff --git a/lib/src/widgets/chat/ds_text_message_bubble.widget.dart b/lib/src/widgets/chat/ds_text_message_bubble.widget.dart index 35faf79d..a1c5c98b 100644 --- a/lib/src/widgets/chat/ds_text_message_bubble.widget.dart +++ b/lib/src/widgets/chat/ds_text_message_bubble.widget.dart @@ -16,7 +16,7 @@ class DSTextMessageBubble extends StatefulWidget { final bool hasSpacer; final List borderRadius; final dynamic selectContent; - final String? replyId; + final dynamic replyContent; final bool showSelect; final void Function(String, Map)? onSelected; final DSMessageBubbleStyle style; @@ -25,7 +25,7 @@ class DSTextMessageBubble extends StatefulWidget { Key? key, required this.text, required this.align, - this.replyId, + this.replyContent, this.borderRadius = const [DSBorderRadius.all], this.selectContent, this.hasSpacer = true, @@ -63,7 +63,7 @@ class _DSTextMessageBubbleState extends State { padding: EdgeInsets.zero, style: widget.style, hasSpacer: widget.hasSpacer, - replyId: widget.replyId, + replyContent: widget.replyContent, child: _buildText(), ); } diff --git a/lib/src/widgets/chat/ds_unsupported_content_message_bubble.widget.dart b/lib/src/widgets/chat/ds_unsupported_content_message_bubble.widget.dart index 6ef590b7..160b4d5f 100644 --- a/lib/src/widgets/chat/ds_unsupported_content_message_bubble.widget.dart +++ b/lib/src/widgets/chat/ds_unsupported_content_message_bubble.widget.dart @@ -11,7 +11,7 @@ import 'ds_message_bubble.widget.dart'; class DSUnsupportedContentMessageBubble extends StatelessWidget { final DSAlign align; final Widget? leftWidget; - final String? replyId; + final dynamic replyContent; final String? text; final TextOverflow overflow; final List borderRadius; @@ -22,7 +22,7 @@ class DSUnsupportedContentMessageBubble extends StatelessWidget { required this.align, this.leftWidget, this.text, - this.replyId, + this.replyContent, this.overflow = TextOverflow.ellipsis, this.borderRadius = const [DSBorderRadius.all], DSMessageBubbleStyle? style, @@ -39,7 +39,7 @@ class DSUnsupportedContentMessageBubble extends StatelessWidget { borderRadius: borderRadius, align: align, style: style, - replyId: replyId, + replyContent: replyContent, child: Row( mainAxisSize: MainAxisSize.min, children: [ diff --git a/lib/src/widgets/chat/ds_weblink.widget.dart b/lib/src/widgets/chat/ds_weblink.widget.dart index 96f81a32..1bcb3953 100644 --- a/lib/src/widgets/chat/ds_weblink.widget.dart +++ b/lib/src/widgets/chat/ds_weblink.widget.dart @@ -29,8 +29,8 @@ class DSWeblink extends StatelessWidget { /// Card styling to adjust custom colors final DSMessageBubbleStyle style; - /// replyId - final String? replyId; + /// replyContent + final dynamic replyContent; DSWeblink({ Key? key, @@ -38,7 +38,7 @@ class DSWeblink extends StatelessWidget { required this.text, required this.align, required this.url, - this.replyId, + this.replyContent, this.borderRadius = const [DSBorderRadius.all], DSMessageBubbleStyle? style, }) : style = style ?? DSMessageBubbleStyle(), @@ -54,7 +54,7 @@ class DSWeblink extends StatelessWidget { return DSMessageBubble( align: align, - replyId: replyId, + replyContent: replyContent, borderRadius: borderRadius, style: style, child: Column( diff --git a/lib/src/widgets/chat/video/ds_video_message_bubble.widget.dart b/lib/src/widgets/chat/video/ds_video_message_bubble.widget.dart index ea037bad..b5e9afaa 100644 --- a/lib/src/widgets/chat/video/ds_video_message_bubble.widget.dart +++ b/lib/src/widgets/chat/video/ds_video_message_bubble.widget.dart @@ -39,8 +39,8 @@ class DSVideoMessageBubble extends StatefulWidget { /// Style for bubble final DSMessageBubbleStyle style; - // reply id message - final String? replyId; + // reply id message + final dynamic replyContent; /// The video size final int mediaSize; @@ -63,7 +63,7 @@ class DSVideoMessageBubble extends StatefulWidget { required this.appBarText, required this.mediaSize, this.appBarPhotoUri, - this.replyId, + this.replyContent, this.type = 'video/mp4', this.text, this.borderRadius = const [DSBorderRadius.all], @@ -125,7 +125,7 @@ class _DSVideoMessageBubbleState extends State borderRadius: widget.borderRadius, padding: EdgeInsets.zero, style: widget.style, - replyId: widget.replyId, + replyContent: widget.replyContent, child: LayoutBuilder( builder: (_, constraints) => Column( crossAxisAlignment: CrossAxisAlignment.start, diff --git a/lib/src/widgets/utils/ds_card.widget.dart b/lib/src/widgets/utils/ds_card.widget.dart index 6532b391..2c2d3966 100644 --- a/lib/src/widgets/utils/ds_card.widget.dart +++ b/lib/src/widgets/utils/ds_card.widget.dart @@ -43,7 +43,7 @@ class DSCard extends StatelessWidget { this.customer, this.showQuickReplyOptions = false, this.showRequestLocationButton = false, - this.replyId, + this.replyContent, }) : style = style ?? DSMessageBubbleStyle(); final String type; @@ -59,7 +59,7 @@ class DSCard extends StatelessWidget { final Map? customer; final bool showQuickReplyOptions; final bool showRequestLocationButton; - final String? replyId; + final dynamic replyContent; @override Widget build(BuildContext context) { @@ -75,7 +75,7 @@ class DSCard extends StatelessWidget { align: align, borderRadius: borderRadius, style: style, - replyId: replyId, + replyContent: replyContent, ); case DSMessageContentType.contact: @@ -94,7 +94,7 @@ class DSCard extends StatelessWidget { onOpenLink: onOpenLink, messageId: messageId, customer: customer, - replyId: content['inReplyTo']['id'], + replyContent: replyContent, ); case DSMessageContentType.mediaLink: @@ -123,7 +123,7 @@ class DSCard extends StatelessWidget { text: content['text'], url: content['uri'], align: align, - replyId: replyId, + replyContent: replyContent, borderRadius: borderRadius, style: style, ); @@ -136,7 +136,7 @@ class DSCard extends StatelessWidget { borderRadius: borderRadius, align: align, style: style, - replyId: replyId, + replyContent: replyContent, ); case DSMessageContentType.ticket: return DSTicketMessage( @@ -160,7 +160,7 @@ class DSCard extends StatelessWidget { default: return DSUnsupportedContentMessageBubble( align: align, - replyId: replyId, + replyContent: replyContent, borderRadius: borderRadius, style: style, ); @@ -185,7 +185,7 @@ class DSCard extends StatelessWidget { selectOptions: documentSelectModel.options, borderRadius: borderRadius, style: style, - replyId: replyId, + replyContent: replyContent, showSelect: true, onSelected: onSelected, onOpenLink: onOpenLink, @@ -204,7 +204,7 @@ class DSCard extends StatelessWidget { child: DSTextMessageBubble( align: align, text: content['text'], - replyId: replyId, + replyContent: replyContent, borderRadius: borderRadius, style: style, ), @@ -226,7 +226,7 @@ class DSCard extends StatelessWidget { borderRadius: borderRadius, selectContent: content, showSelect: true, - replyId: replyId, + replyContent: replyContent, onSelected: onSelected, style: style, ); @@ -239,7 +239,7 @@ class DSCard extends StatelessWidget { address: content['address'], email: content['email'], align: align, - replyId: replyId, + replyContent: replyContent, style: style, borderRadius: borderRadius, ); @@ -265,7 +265,7 @@ class DSCard extends StatelessWidget { align: align, borderRadius: borderRadius, style: style, - replyId: replyId, + replyContent: replyContent, uniqueId: messageId, audioType: media.type, shouldAuthenticate: shouldAuthenticate, @@ -283,7 +283,7 @@ class DSCard extends StatelessWidget { : avatarConfig.sentAvatar, text: media.text, title: media.title, - replyId: replyId, + replyContent: replyContent, borderRadius: borderRadius, style: style, shouldAuthenticate: shouldAuthenticate, @@ -302,7 +302,7 @@ class DSCard extends StatelessWidget { ? avatarConfig.receivedAvatar : avatarConfig.sentAvatar, text: media.text, - replyId: replyId, + replyContent: replyContent, borderRadius: borderRadius, style: style, mediaSize: size, @@ -312,7 +312,7 @@ class DSCard extends StatelessWidget { return DSFileMessageBubble( align: align, url: media.uri, - replyId: replyId, + replyContent: replyContent, size: size, filename: media.title ?? '${media.uri.hashCode}.${DSFileService.getFileExtensionFromMime(media.type)}', @@ -330,7 +330,7 @@ class DSCard extends StatelessWidget { return DSRequestLocationBubble( label: 'Send location', - replyId: replyId, + replyContent: replyContent, type: type, value: value, align: align, diff --git a/lib/src/widgets/utils/ds_group_card.widget.dart b/lib/src/widgets/utils/ds_group_card.widget.dart index 7c8cc3fe..db26e6bd 100644 --- a/lib/src/widgets/utils/ds_group_card.widget.dart +++ b/lib/src/widgets/utils/ds_group_card.widget.dart @@ -1,4 +1,3 @@ -import 'package:blip_ds/src/controllers/chat/ds_reply.controller.dart'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; @@ -54,6 +53,7 @@ class DSGroupCard extends StatefulWidget { super.key, required this.documents, required this.isComposing, + this.ticketId, this.sortMessages = true, this.onSelected, this.onOpenLink, @@ -73,6 +73,7 @@ class DSGroupCard extends StatefulWidget { final bool Function(DSMessageItemModel, DSMessageItemModel) compareMessages; final bool isComposing; final bool sortMessages; + final String? ticketId; final void Function(String, Map)? onSelected; final void Function(Map)? onOpenLink; final bool hideOptions; @@ -90,7 +91,6 @@ class DSGroupCard extends StatefulWidget { class _DSGroupCardState extends State { final List widgets = []; final showScrollBottomButton = false.obs; - final DSReplyController replyController = Get.put(DSReplyController()); @override void initState() { @@ -214,11 +214,6 @@ class _DSGroupCardState extends State { } } - final listOfDSMessageItemModelList = groups.map((e) => e['msgs']).toList(); - replyController.messages.clear(); - for (List items in listOfDSMessageItemModelList) { - replyController.addMessages(items); - } groups.add(group); return groups; } @@ -268,6 +263,7 @@ class _DSGroupCardState extends State { onOpenLink: widget.onOpenLink, messageId: message.id, customer: message.customer, + replyContent: message.replyContent, ); final isLastMsg = msgCount == length;