Flutter upgrade

This commit is contained in:
Hillel Coren 2023-12-07 13:26:02 +02:00
parent c6d5cd1d67
commit 02dd22238e
2 changed files with 19 additions and 19 deletions

View File

@ -1,4 +1,3 @@
/*
// DELETE THIS FILE ONCE SUPER EDITOR IS UPDATED
// Note: using the standard function crashes with h1 tags
@ -232,7 +231,7 @@ class _MarkdownToDocument implements md.NodeVisitor {
_content.add(
ParagraphNode(
id: DocumentEditor.createNodeId(),
id: Editor.createNodeId(),
text: _parseInlineText(element),
metadata: <String, dynamic>{
'blockType': headerAttribution,
@ -244,7 +243,7 @@ class _MarkdownToDocument implements md.NodeVisitor {
void _addParagraph(AttributedText attributedText) {
_content.add(
ParagraphNode(
id: DocumentEditor.createNodeId(),
id: Editor.createNodeId(),
text: attributedText,
),
);
@ -253,7 +252,7 @@ class _MarkdownToDocument implements md.NodeVisitor {
void _addBlockquote(md.Element element) {
_content.add(
ParagraphNode(
id: DocumentEditor.createNodeId(),
id: Editor.createNodeId(),
text: _parseInlineText(element),
metadata: <String, dynamic>{
'blockType': blockquoteAttribution,
@ -273,9 +272,9 @@ class _MarkdownToDocument implements md.NodeVisitor {
_content.add(
ParagraphNode(
id: DocumentEditor.createNodeId(),
id: Editor.createNodeId(),
text: AttributedText(
text: element.textContent,
element.textContent,
),
metadata: <String, dynamic>{
'blockType': codeAttribution,
@ -290,7 +289,7 @@ class _MarkdownToDocument implements md.NodeVisitor {
}) {
_content.add(
ImageNode(
id: DocumentEditor.createNodeId(),
id: Editor.createNodeId(),
imageUrl: imageUrl,
altText: altText,
),
@ -299,7 +298,7 @@ class _MarkdownToDocument implements md.NodeVisitor {
void _addHorizontalRule() {
_content.add(HorizontalRuleNode(
id: DocumentEditor.createNodeId(),
id: Editor.createNodeId(),
));
}
@ -310,7 +309,7 @@ class _MarkdownToDocument implements md.NodeVisitor {
}) {
_content.add(
ListItemNode(
id: DocumentEditor.createNodeId(),
id: Editor.createNodeId(),
itemType: listItemType,
indent: indent,
text: _parseInlineText(element),
@ -382,8 +381,7 @@ class _InlineMarkdownToDocument implements md.NodeVisitor {
@override
void visitText(md.Text text) {
final attributedText = _textStack.removeLast();
_textStack
.add(attributedText.copyAndAppend(AttributedText(text: text.text)));
_textStack.add(attributedText.copyAndAppend(AttributedText(text.text)));
}
@override
@ -396,24 +394,24 @@ class _InlineMarkdownToDocument implements md.NodeVisitor {
styledText.addAttribution(
boldAttribution,
SpanRange(
start: 0,
end: styledText.text.length - 1,
0,
styledText.text.length - 1,
),
);
} else if (element.tag == 'em') {
styledText.addAttribution(
italicsAttribution,
SpanRange(
start: 0,
end: styledText.text.length - 1,
0,
styledText.text.length - 1,
),
);
} else if (element.tag == 'a') {
styledText.addAttribution(
LinkAttribution(url: Uri.parse(element.attributes['href']!)),
SpanRange(
start: 0,
end: styledText.text.length - 1,
0,
styledText.text.length - 1,
),
);
}
@ -589,4 +587,3 @@ class _EmptyParagraphSyntax extends md.BlockSyntax {
return md.Element('p', []);
}
}
*/

View File

@ -1,8 +1,9 @@
//import 'package:example/logging.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:invoiceninja_flutter/utils/markdown.dart';
import 'package:super_editor/super_editor.dart';
import 'package:super_editor_markdown/super_editor_markdown.dart';
//import 'package:super_editor_markdown/super_editor_markdown.dart';
import 'package:invoiceninja_flutter/utils/super_editor/toolbar.dart';
//import '_toolbar.dart';
@ -313,6 +314,7 @@ class _ExampleEditorState extends State<ExampleEditor> {
_buildMountedToolbar(),
],
),
/*
Align(
alignment: Alignment.bottomRight,
child: ListenableBuilder(
@ -329,6 +331,7 @@ class _ExampleEditorState extends State<ExampleEditor> {
child: _buildCornerFabs(),
),
),
*/
],
),
),