From de7758102bbd785e41b48ce19a0ba8ce79339987 Mon Sep 17 00:00:00 2001 From: juan Date: Thu, 21 Aug 2025 14:02:06 -0400 Subject: [PATCH] fixed slight yank --- lib/Compose.dart | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/lib/Compose.dart b/lib/Compose.dart index 43076f9..331bed7 100644 --- a/lib/Compose.dart +++ b/lib/Compose.dart @@ -29,6 +29,7 @@ class _ComposeEmailState extends State { TextEditingController _emailRecipientController = TextEditingController(); TextEditingController _emailSubjectController = TextEditingController(); List? contentOfDraft; + bool isInitialized = false; @override void initState() { @@ -53,22 +54,43 @@ class _ComposeEmailState extends State { _composer = MutableDocumentComposer(); _editor = createDefaultDocumentEditor( document: _document, composer: _composer); - _emailRecipientController.text = - widget.emailDraftID!.to[0].address; + _emailRecipientController.text = widget.emailDraftID!.to[0].address; _emailSubjectController.text = widget.emailDraftID!.subject; + isInitialized = true; + }); } + } else { + setState(() { + _document = MutableDocument(nodes: [ + ParagraphNode( + id: Editor.createNodeId(), + text: AttributedText(""), + ), + ]); + _composer = MutableDocumentComposer(); + _editor = createDefaultDocumentEditor( + document: _document, composer: _composer); + isInitialized = true; + }); } } @override void dispose() { _editor.dispose(); + _emailRecipientController.dispose(); + _emailSubjectController.dispose(); super.dispose(); } @override Widget build(BuildContext context) { + if (!isInitialized) { + return Center( + child: CircularProgressIndicator(), + ); + } return Positioned( bottom: 10.0, right: 10.0, @@ -146,7 +168,7 @@ class _ComposeEmailState extends State { //here the widget goes child: SuperEditor( //make this its own - editor: _editor!, + editor: _editor, plugins: {MarkdownInlineUpstreamSyntaxPlugin()}, // stylesheet: Stylesheet(