feat: add startup bulletin; switch to edit mode when click text on md preview.
This commit is contained in:
@@ -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,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user