Flutter 如何向大纲按钮添加边框颜色

Flutter 如何向大纲按钮添加边框颜色,flutter,border,flutter-layout,Flutter,Border,Flutter Layout,如何向大纲按钮添加边框颜色?我尝试设置一个高亮显示的边框颜色,但它不起作用。我如何解决这个问题 这是我的代码: OutlineButton( shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)), onPressed:(){},child: Padding( padding: const EdgeInsets.all(12), child: Text("add to cart",st

如何向大纲按钮添加边框颜色?我尝试设置一个
高亮显示的边框颜色
,但它不起作用。我如何解决这个问题

这是我的代码:

 OutlineButton(
   shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)),
   onPressed:(){},child: Padding(
   padding: const EdgeInsets.all(12),
   child: Text("add to cart",style: TextStyle(color: Colors.red,fontSize: 20),),
    ),highlightedBorderColor: Colors.red,
 ),

在代码中添加以下行:

borderSide: BorderSide(width: 2.0, color: Colors.red),

这会将按钮的边框颜色更改为红色,并在代码中添加以下行:

borderSide: BorderSide(width: 2.0, color: Colors.red),
这会将按钮的边框颜色更改为红色

试试看:

      OutlineButton(
          shape: RoundedRectangleBorder(
            borderRadius: BorderRadius.circular(20),
          ),
          borderSide: BorderSide(color: Colors.pink, width: 1),
          onPressed: () {},
          child: Padding(
            padding: const EdgeInsets.all(12),
            child: Text(
              "add to cart",
              style: TextStyle(color: Colors.red, fontSize: 20),
            ),
          ),
        )
试一试:

      OutlineButton(
          shape: RoundedRectangleBorder(
            borderRadius: BorderRadius.circular(20),
          ),
          borderSide: BorderSide(color: Colors.pink, width: 1),
          onPressed: () {},
          child: Padding(
            padding: const EdgeInsets.all(12),
            child: Text(
              "add to cart",
              style: TextStyle(color: Colors.red, fontSize: 20),
            ),
          ),
        )