Add editing Listener to flutter

Hey, I am using pdftron in my flutter project and I am new to programming. I am adding a save button in the UI to save the opened document if the user has made some editing like annotation or something else. I was wondering that is there any listener, which I can use to make the save button enable or disable. Like if the user opened the document in the Viewer widget, the save button at the start will be disabled, but if he draws something or he edits the document then, I want to enable the save button. is it possible?

Hello, I’m Ron, an automated tech support bot :robot:

While you wait for one of our customer support representatives to get back to you, please check out some of these documentation pages:

Guides:APIs:Forums:

Hi there,

It is possible to see when the annotations are added/edited.
You can do this by adding the AnnotationChangedListener and listening to the change events, please see here for more details.

Sample code

var annotChangedCancel = startAnnotationChangedListener((action, annotations) {
  //Todo: change your save button to enabled
});

Best Regards,
Eamon

1 Like

hey there,
Thank you, it is working perfectly. One more question is there any way to override the undo button, so that way I can check if the user has deleted all annotations and I’ll again disable the save button?

Hi there,

This approach would not work for your scenario.
Performing an Undo action does not delete the annotation but rather add a new change-set indicating removal of the annotation meaning the document has changed.
Adding a new change-set allows us to perform redo actions to add the removed annotations back to their original place on the document.

I hope this helps clear things up.

Best Regards,
Eamon

thank you @emallon .
got it

1 Like