美文网首页
2019-10-24

2019-10-24

作者: summer_ful | 来源:发表于2019-10-24 16:05 被阅读0次
    
    TextStyle blackStyle = TextStyle(fontWeight: FontWeight.normal, fontSize: 20, color: Colors.black); //黑色样式
    
    TextStyle redStyle = TextStyle(fontWeight: FontWeight.bold, fontSize: 20, color: Colors.red); //红色样式
    
    Text.rich(
        TextSpan(
            children: <TextSpan>[
              TextSpan(text:'文本是视图系统中常见的控件,它用来显示一段特定样式的字符串,类似', style: redStyle), //第1个片段,红色样式 
              TextSpan(text:'Android', style: blackStyle), //第1个片段,黑色样式 
              TextSpan(text:'中的', style:redStyle), //第1个片段,红色样式 
              TextSpan(text:'TextView', style: blackStyle) //第1个片段,黑色样式 
            ]),
      textAlign: TextAlign.center,
    );
    

    相关文章

      网友评论

          本文标题:2019-10-24

          本文链接:https://www.haomeiwen.com/subject/ltcdvctx.html