skip to Main Content

I am getting a message from the server like – THE ONLY MARATHON YOU’VE EVER DONE IS A MOVIE MARATHON. GET OFF THE COUCH CHUNKY BUTT AND DO SOME CARDIO. I have to make it bolder those character which is in asterisks. I am using flutter package "simple_text". It’s working but not as like expectation. So, could anyone please help me with sharing effective suggestions? Here you go with my code and output screenshot. Thanks in advance!

SimpleRichText(

                "THE ONLY MARATHON YOU'VE EVER DONE IS A MOVIE MARATHON. GET OFF THE COUCH *CHUNKY BUTT* AND DO SOME CARDIO.",

                  textAlign: TextAlign.center,
                  style: const TextStyle(
                    fontSize: 35.0,
                    fontFamily: 'SFPRO',
                    color: white,
                    letterSpacing: 1,
                    fontWeight: FontWeight.w100,
                  ),
                ),

enter image description here

2

Answers


  1. RichText widget

    enter image description here

    RichText(
      text: TextSpan(
        text: 'Hello ',
        style: DefaultTextStyle.of(context).style,
        children: const <TextSpan>[
          TextSpan(text: 'bold', style: TextStyle(fontWeight: FontWeight.bold)),
          TextSpan(text: ' world!'),
        ],
      ),
    )
    

    https://api.flutter.dev/flutter/widgets/RichText-class.html

    Login or Signup to reply.
  2. Seems like you receive some Markdown formatting from server (?)

    So you can use https://pub.dev/packages/flutter_markdown to parse it and render it

    Markdown(
        controller: controller,
        selectable: true,
        data: 'Hey *there*',
    )
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search