Flutter 在flatter中,如何添加一个看起来像带下划线的文本字段的大纲按钮?

Flutter 在flatter中,如何添加一个看起来像带下划线的文本字段的大纲按钮?,flutter,dart,flutter-layout,Flutter,Dart,Flutter Layout,在flatter中,如何添加一个看起来像带下划线的文本字段的大纲按钮?我只需要一条底线 OutlineButton( color: Theme.of(context).buttonColor, textColor: Theme.of(context).textTheme.bodyText1.color, // disabledColor: Colors.grey,

在flatter中,如何添加一个看起来像带下划线的文本字段的大纲按钮?我只需要一条底线

           OutlineButton(
              color: Theme.of(context).buttonColor,
              textColor: Theme.of(context).textTheme.bodyText1.color,
              // disabledColor: Colors.grey,
              disabledTextColor: Colors.black,
              borderSide: (),
              onPressed: () {

              },
          child: Center(
            child: Text(
              "No Reminder",
              textAlign: TextAlign.center,
              style: TextStyle(fontSize: 18.0),
            ),
          ),
            )

我不知道结果如何,但我希望它能帮助您了解如何满足您的需求

如果我正确理解您的问题,您只需添加文本的
装饰
属性,并将
文本装饰.下划线
传递给它,即可获得底部下划线。工作示例代码如下:

body: Center(
        child: OutlineButton(
              color: Theme.of(context).buttonColor,
              textColor: Theme.of(context).textTheme.bodyText1.color,
              // disabledColor: Colors.grey,
              disabledTextColor: Colors.black,
            //  borderSide: (),
              onPressed: () {

              },
          child: Center(
            child: Text(
              "No Reminder",
              textAlign: TextAlign.center,
              style: TextStyle(fontSize: 18.0, decoration: TextDecoration.underline),
            ),
          ),
            )
      ),


希望这能回答您的问题。

您可以使用BoxDecoration作为按钮的父级。OutlineButton可勾勒所有4条边,也可不勾勒任何边。 请在此处查看他们的文档

body: Center(
        child: OutlineButton(
              color: Theme.of(context).buttonColor,
              textColor: Theme.of(context).textTheme.bodyText1.color,
              // disabledColor: Colors.grey,
              disabledTextColor: Colors.black,
            //  borderSide: (),
              onPressed: () {

              },
          child: Center(
            child: Text(
              "No Reminder",
              textAlign: TextAlign.center,
              style: TextStyle(fontSize: 18.0, decoration: TextDecoration.underline),
            ),
          ),
            )
      ),