flutter 多个Text会导致出线的解决方法

参考:https://blog.csdn.net/zgcqflqinhao/article/details/85048090

可以复制后,进行更改文字

new Text.rich(
          //富文本文本框构造方法,可以显示多种样式的text,第一个参数为 TextSpan
          new TextSpan(
              text: "我是一段测试文本", 
              //文字样式,如果后面的子 TextSpan 没有覆盖该 TextStyle 中的属性,则使用该 TextStyle 指定的样式
              style: new TextStyle(
                  //文字颜色,整体的文字颜色,如果后面的子 TextSpan 没有覆盖该属性,则使用该文字颜色
                  color: new Color(0xFF000000),
                  //同上
                  fontSize: 20.0,
                  //同上
                  decoration: Textdecoration.underline),
              //应该是手势识别监听器,后面用到手势监听再详细学习该类用法
//          recognizer: ,
              //子 TextSpan,可以指定多个
              children: <TextSpan>[
                new TextSpan(
                    text: "Hello",
                    style: new TextStyle(
                        color: new Color(0xFFFF0000),
                        fontSize: 30.0,
                        fontStyle: FontStyle.italic)),
                new TextSpan(
                    text: "World",
                    style: new TextStyle(
                        color: new Color(0xFFFFFF00),
                        fontSize: 40.0,
                        fontWeight: FontWeight.bold)),
              ]),
          textDirection: TextDirection.ltr,
        ),
      ),
    

 

相关文章

这篇文章主要讲解了“FlutterComponent动画的显和隐怎么实现...
这篇文章主要讲解了“flutter微信聊天输入框功能如何实现”,...
本篇内容介绍了“Flutter之Navigator的高级用法有哪些”的有...
这篇文章主要介绍“Flutter怎么使用Android原生播放器”,在...
Flutter开发的android端如何修改APP名称,logo,版本号,具体...
Flutter路由管理初识路由概念一.路由管理1.1.Route1.2.Mater...