I'm using flutter_markdown library for displaying markdown text, for me hyperlink every time is displaying with the default flutter blue color, I have tried to change ThemeData App colors, but it didn't help, basically what I need is to change color of hyperlink from blue to green and make it underlined.
Is that possible? If not, please advice with some alternative way how to achieve it
I'm using this code:
_showMarkdownTestModal() {
var testMarkdown = '[flutter_markdown](https://github.com/DavBfr/flutter_markdown)';
showModalBottomSheet(
context: context,
backgroundColor: Colors.transparent,
isScrollControlled: true,
builder: (builder) {
return FractionallySizedBox(
heightFactor: 0.1,
child: Center(
child: MarkdownBody(
data: testMarkdown,
onTapLink: (text, url, title) {
if (url != null) {
_launchURL(Uri.parse(url));
}
},
)));
});
}
Thanks in advance for any help
CodePudding user response:
Just like this:
MarkdownBody(
styleSheet: MarkdownStyleSheet(
a: const TextStyle(
color: Colors.red,
decoration: TextDecoration.underline,
),
// ...
),
// ...
);