Flutter組件之一行多種顏色文字組件(RichText)

RichText(
            text: TextSpan(
              children: <TextSpan>[
                TextSpan(
                  text: '你好啊',
                  style: TextStyle(
                    color: Color(0xffff0000),
                    fontSize: 20.0,
                  ),
                ),
                TextSpan(
                  text: '我是很牛逼的人物哦!',
                  style: TextStyle(
                    color: Color(0xff00ff00),
                    fontSize: 20.0,
                  ),
                  recognizer: TapGestureRecognizer()
                    ..onTap = () async {
                      print('點擊事件');
                      //這裏做點擊事件
//                        String url = 'http://www.baidu.com';
//                        if (await canlaunch(url)){
//                          await launch(url);
//                        }
                    },
                ),
              ],
            ),
          ),

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章