1

对于文本小部件,我们可以将文本装饰用于strikeunderline

style: TextStyle(decoration: TextDecoration.lineThrough),
style: TextStyle(decoration: TextDecoration.underline),

有没有什么办法可以在文字装饰中同时获得?或者 Boxdecoration 有什么解决方案吗?我已经尝试过,但没有成功。

4

3 回答 3

1

使用 combine instade

Text(
  "Hello world!",
  style: TextStyle(
    decoration: TextDecoration.combine(
        [TextDecoration.underline, TextDecoration.lineThrough]),
  ),
)
于 2021-02-09T05:48:29.820 回答
1

您需要添加

装饰

在您的文本小部件中执行此操作:这是示例:

decoration: TextDecoration.combine(
    [TextDecoration.underline, TextDecoration.lineThrough]),
于 2021-02-09T05:51:16.227 回答
0

一种可能的解决方案是Container像这样使用:

       Container(
          child: Text(
            'This text has underline as well as linethrough',
            style: TextStyle(decoration: TextDecoration.lineThrough),
          ),
          decoration: BoxDecoration(
            border: Border(
              bottom: BorderSide(
                color: const Color(0xFF000000),
              ),
            ),
          ),
        ),
             

输出 :

在此处输入图像描述

于 2021-02-09T04:16:08.797 回答