fixed slight yank

This commit is contained in:
Juan Marulanda De Los Rios 2025-08-21 14:02:06 -04:00
parent 51c772a2a1
commit de7758102b

View File

@ -29,6 +29,7 @@ class _ComposeEmailState extends State<ComposeEmail> {
TextEditingController _emailRecipientController = TextEditingController(); TextEditingController _emailRecipientController = TextEditingController();
TextEditingController _emailSubjectController = TextEditingController(); TextEditingController _emailSubjectController = TextEditingController();
List<String>? contentOfDraft; List<String>? contentOfDraft;
bool isInitialized = false;
@override @override
void initState() { void initState() {
@ -53,22 +54,43 @@ class _ComposeEmailState extends State<ComposeEmail> {
_composer = MutableDocumentComposer(); _composer = MutableDocumentComposer();
_editor = createDefaultDocumentEditor( _editor = createDefaultDocumentEditor(
document: _document, composer: _composer); document: _document, composer: _composer);
_emailRecipientController.text = _emailRecipientController.text = widget.emailDraftID!.to[0].address;
widget.emailDraftID!.to[0].address;
_emailSubjectController.text = widget.emailDraftID!.subject; _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 @override
void dispose() { void dispose() {
_editor.dispose(); _editor.dispose();
_emailRecipientController.dispose();
_emailSubjectController.dispose();
super.dispose(); super.dispose();
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
if (!isInitialized) {
return Center(
child: CircularProgressIndicator(),
);
}
return Positioned( return Positioned(
bottom: 10.0, bottom: 10.0,
right: 10.0, right: 10.0,
@ -146,7 +168,7 @@ class _ComposeEmailState extends State<ComposeEmail> {
//here the widget goes //here the widget goes
child: SuperEditor( child: SuperEditor(
//make this its own //make this its own
editor: _editor!, editor: _editor,
plugins: {MarkdownInlineUpstreamSyntaxPlugin()}, plugins: {MarkdownInlineUpstreamSyntaxPlugin()},
// stylesheet: Stylesheet( // stylesheet: Stylesheet(