How to underline text in flutter

后端 未结 5 803
再見小時候
再見小時候 2020-12-23 08:32

How to underline text in flutter inside Text widget?

I cannot seem to find underline inside fontStyle property of TextStyle

5条回答
  •  萌比男神i
    2020-12-23 09:32

    You do it by applying decoration: TextDecoration.underline to TextStyle of a Text.

    With Theme example:

              Text(
                "text",
                style: Theme
                    .of(context)
                    .accentTextTheme
                    .subhead
                    .copyWith(decoration: TextDecoration.underline),
              )
    

    Basic example:

              Text(
                "text",
                style: TextStyle(decoration: TextDecoration.underline),
              )
    

提交回复
热议问题