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

问题描述

对于文本小部件,我们可能会使用 strikeunderline 的文本修饰

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

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

解决方法

使用 combine instade

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

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

输出:

enter image description here

,

您需要添加

装饰

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

decoration: TextDecoration.combine(
    [TextDecoration.underline,

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...