@@ -846,14 +846,14 @@ ChatView(
846846ChatView(
847847 // ...
848848 featureActiveConfig: FeatureActiveConfig(
849- enableSwipeToReply: true,
850- enableSwipeToSeeTime: false,
851- enablePagination: true,
852- enableOtherUserName: false,
853- lastSeenAgoBuilderVisibility: false,
854- receiptsBuilderVisibility: false,
855- enableTextSelection: true,
856- enableEditMessage : true, // Enable the Edit Message feature (default: true )
849+ enableSwipeToReply: true, // Enable swipe to reply (default: true)
850+ enableSwipeToSeeTime: false, // Enable swipe to see message time (default: true)
851+ enablePagination: true, // Enable pagination (default: false)
852+ enableOtherUserName: false, // Show other user's name above bubble (default: true)
853+ lastSeenAgoBuilderVisibility: false, // Show last seen ago label (default: true)
854+ receiptsBuilderVisibility: false, // Show message receipts (default: true)
855+ enableTextSelection: true, // Enable text selection in bubbles (default: false)
856+ enableMessageEditing : true, // Enable the edit message feature (default: false )
857857 ),
858858 // ...
859859)
@@ -869,43 +869,29 @@ ChatView supports editing previously sent text messages, similar to WhatsApp and
8698692 . Tap ** Edit** in the reply pop-up.
8708703 . The original text is pre-filled into the input field with an * Editing* indicator above it.
8718714 . Modify the text and press Send.
872- 5 . Your ` onEditTap ` callback is called with the ** original ` Message ` ** and the ** new text ** .
873- 6 . Messages that have been edited display a subtle * Edited * label below the bubble.
872+ 5 . Your ` onEditTap ` callback is called with the ** original ` Message ` ** ( ` oldMessage ` ) and the ** updated ` Message ` ** ( ` newMessage ` ) .
873+ 6 . Messages that have been edited display a subtle _ Edited _ label below the bubble.
874874
875875### Basic Integration
876876
877877``` dart
878878ChatView(
879879 // ...
880- onEditTap: (Message originalMessage, String newText) {
881- // Update the message in your data source / backend.
882- // Set `updateAt` on the message to trigger the "Edited" label in the UI.
883- final updatedMessage = Message(
884- id: originalMessage.id,
885- message: newText,
886- createdAt: originalMessage.createdAt,
887- sentBy: originalMessage.sentBy,
888- updateAt: DateTime.now(), // marks the message as edited
889- replyMessage: originalMessage.replyMessage,
890- messageType: originalMessage.messageType,
891- );
892-
893- chatController.updateMessage(updatedMessage); // depends on your controller API
894- },
895- replyPopupConfig: ReplyPopupConfiguration(
896- // Optional: react to the edit tap in the popup before the editing UI opens.
897- onEditTap: (message) => debugPrint('Editing: ${message.id}'),
898- ),
880+ // updatedMessage is a copy of oldMessage with the new text already applied.
881+ // You have access to both objects so you can do further transformations —
882+ // for example, update the timestamp, change the message type, or sync with a backend.
883+ onEditTap: (message, updatedMessage) =>
884+ _chatController.updateMessage(messageId: message.id, newMessage: updatedMessage),
899885 // ...
900886)
901887```
902888
903- ### Disabling the Feature
889+ ### Enabeling the Feature
904890
905891``` dart
906892ChatView(
907893 featureActiveConfig: const FeatureActiveConfig(
908- enableEditMessage: false, // hides the Edit button entirely
894+ enableEditMessage: true,
909895 ),
910896)
911897```
@@ -927,18 +913,6 @@ PackageStrings.addLocaleObject(
927913PackageStrings.setLocale('es');
928914```
929915
930- ### Static Helper
931-
932- Use ` ChatView.getEditingMessage(context) ` to read the message currently being edited
933- from a widget that is a descendant of ` ChatView ` :
934-
935- ``` dart
936- final editingMsg = ChatView.getEditingMessage(context);
937- if (editingMsg != null) {
938- // User is in edit mode for editingMsg.
939- }
940- ```
941-
942916### Customizing the Edit Indicator Label
943917
944918When a user enters edit mode, an indicator bar is displayed above the text field showing a label
0 commit comments