首页 文章

如何在Flutter中翻阅文本?

提问于
浏览
2

在Flutter中使用 TextStyle() 类,我如何通过旧价格进行攻击?

2 回答

  • 3

    您可以使用RichText widget设置段落的单独 Span 的样式 .

    根据this example code,显示折扣价:

    new RichText(
      text: new TextSpan(
        text: 'This item costs ',
        children: <TextSpan>[
          new TextSpan(
            text: '$8.99',
            style: new TextStyle(
              color: Colors.gray,
              decoration: TextDecoration.lineThrough,
            ),
          ),
          new TextSpan(
            text: ' $3.99',
          ),
        ],
      ),
    )
    
  • 8
    style: TextStyle(decoration: TextDecoration.lineThrough),
    

相关问题