feat: add startup bulletin; switch to edit mode when click text on md preview.

This commit is contained in:
2022-02-21 14:42:18 +08:00
parent 49ec2a641e
commit 0c87b714c4
10 changed files with 86 additions and 20 deletions
+3
View File
@@ -19,6 +19,7 @@ class MarkdownBuilder implements md.NodeVisitor {
this.defaultTextStyle, {
this.tagTextStyle = defaultTagTextStyle,
required this.onCodeCopied,
this.richTap,
});
final _widgets = <Widget>[];
@@ -30,6 +31,7 @@ class MarkdownBuilder implements md.NodeVisitor {
final BuildContext context;
final LinkTap linkTap;
final VoidCallback? richTap;
final WidgetImage widgetImage;
final double maxWidth;
final Function onCodeCopied;
@@ -125,6 +127,7 @@ class MarkdownBuilder implements md.NodeVisitor {
children: last.textSpans,
style: last.textStyle,
),
onTap: richTap,
);
}
}
+4
View File
@@ -14,6 +14,7 @@ class Markdown extends StatefulWidget {
required this.onCodeCopied,
this.maxWidth,
this.textStyle,
this.richTap,
}) : super(key: key);
final String data;
@@ -28,6 +29,8 @@ class Markdown extends StatefulWidget {
final Function onCodeCopied;
final VoidCallback? richTap;
@override
MarkdownState createState() => MarkdownState();
}
@@ -62,6 +65,7 @@ class MarkdownState extends State<Markdown> {
widget.maxWidth ?? MediaQuery.of(context).size.width,
widget.textStyle ?? defaultTextStyle(context),
onCodeCopied: widget.onCodeCopied,
richTap: widget.richTap,
).build(nodes);
}
}
+4
View File
@@ -11,6 +11,7 @@ class MdPreview extends StatefulWidget {
required this.widgetImage,
required this.onCodeCopied,
this.textStyle,
this.richTap,
}) : super(key: key);
final String text;
@@ -24,6 +25,8 @@ class MdPreview extends StatefulWidget {
/// If [onTapLink] is null,it will open the link with your default browser.
final TapLinkCallback? onTapLink;
final VoidCallback? richTap;
@override
State<StatefulWidget> createState() => MdPreviewState();
}
@@ -50,6 +53,7 @@ class MdPreviewState extends State<MdPreview>
image: widget.widgetImage,
textStyle: widget.textStyle,
onCodeCopied: widget.onCodeCopied,
richTap: widget.richTap,
);
},
),