flutter-quill
flutter-quill copied to clipboard
How to append text to the end of a document
Is there an existing issue for this?
- [X] I have searched the existing issues
The question
Thanks for a great product.
How do I append text to the end of the document, without changing the position of the current scroll position?
Many Thanks Garth
//move cursor to end controller.moveCursorToEnd(); //get the offset int offset = getCursorOffset(controller); //create a delta from text final doc = Document.fromHtml("normal text also works"); // create the delta from document block = doc.toDelta();
//add at the position (which is end) (replace text with zero size adds the content) controller.replaceText( offset, 0, block, TextSelection.collapsed(offset: offset));