Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter: flutter_markdown fontSize

Is there any way to change the font size of text when using flutter_markdown? Something like supplying a TextStyle to a Text widget. Thanks!

like image 782
nypogi Avatar asked Sep 05 '18 01:09

nypogi


2 Answers

Markdown(
    data: html2md.convert(article.content),
    styleSheet: MarkdownStyleSheet.fromTheme(Theme.of(context))
                    .copyWith(
                       p: Theme.of(context).textTheme.body1.copyWith(fontSize: 12.0)
                    ),
)

you can overide text style of spesific element in markdown, code above example to overide p element from markdown (<p> element in html)

like image 183
Wibi Cahyo Hastono Avatar answered Oct 06 '22 20:10

Wibi Cahyo Hastono


In 2021 the way to style your main text is:

Markdown(
    data: "This is the *way*",
    styleSheet: MarkdownStyleSheet.fromTheme(ThemeData(
      textTheme: TextTheme(
          bodyText2: TextStyle(
              fontSize: 20.0, color: Colors.green)))))),
like image 34
Christian Avatar answered Oct 06 '22 18:10

Christian