Search code examples
flutterflutter-text

Obtain a text with underline and strikethrough at the same time


For text widget, we may use the text decoration for strike or underline

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

Is there any way can obtain both in the text decoration? Or is there any solution to do with the Boxdecoration? I have tried but not that succeed.


Solution

  • use combine instade

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