首页 > 解决方案 > 在我的一个 SpanText 中应用填充比另一个 spanText 或富文本的填充有什么技巧吗?

问题描述

RichText(
  textAlign:TextAlign.center,
  text:TextSpan(
    children:[
      TextSpan(
        text:'Create an Account to Continue \n \n',
        style:TextStyle(
          fontSize:17.0,
          fontWeight:FontWeight.bold,
          color:Colors.black,
        ),
      ),
      TextSpan(
        text:'By continuing You Agreed to Our ',
        style:TextStyle(
          fontSize:17.0,
          color:Colors.black45,
        ),
      ),
      TextSpan(
        text:'terms of services',
        style:TextStyle(
          fontSize:17.0,
          color:Colors.blue,
        ),
      ),
      TextSpan(
        text:'.',
        style:TextStyle(
          color:Colors.black,
        ),
      ),

    ],),
),

标签: flutterrichtexttextspan

解决方案


我不这么认为,这不是 TextSpan 小部件的作用,Padding 是图形元素,TextPan 是文本元素。你最好做两个 RichText 并对它们应用填充,你的代码会更清晰。


推荐阅读