Display a few words in different colors in Flutter

前端 未结 3 1864
感情败类
感情败类 2021-01-04 04:41

I am writing an application which shows a few words in different colors in flutter.

I tried to load HTML files using the plugin flutter_html_view but that one doesn

3条回答
  •  独厮守ぢ
    2021-01-04 04:43

    You can achieve this by using a RichText class class with TextStyle class

    RichText widget helps to answer and achieve the above cases

    RichText(
      textAlign: TextAlign.center,
      text: TextSpan(children: [
         TextSpan(
           text: "I agree to the ",
           style: TextStyle(color: Colors.black87)),
         TextSpan(
           text: "Terms and Conditions",
           style: TextStyle(
              color: Colors.deepPurple,
               fontWeight: FontWeight.bold)),
       ]),
    )
    

提交回复
热议问题