获取同时带有下划线和删除线的文本

Obtain a text with underline and strikethrough at the same time

对于文本小部件,我们可以使用strikeunderline

的文本装饰
style: TextStyle(decoration: TextDecoration.lineThrough),
style: TextStyle(decoration: TextDecoration.underline),

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

一种可能的解决方案是像这样使用 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),
              ),
            ),
          ),
        ),
             

输出:

使用组合代替

Text(
  "Hello world!",
  style: TextStyle(
    decoration: TextDecoration.combine(
        [TextDecoration.underline, TextDecoration.lineThrough]),
  ),
)

您需要添加

Decoration

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

decoration: TextDecoration.combine(
    [TextDecoration.underline, TextDecoration.lineThrough]),