Flutter MaterialButton implements rounded border buttons

The effect diagram is as follows

insert image description here

  MaterialButton buildMaterialButton() {
    
    
    return MaterialButton(
      //背景颜色
      color: Colors.white,
      //边框样式
      shape: const RoundedRectangleBorder(
        //边框颜色
        side: BorderSide(
          color: Colors.deepPurple,
          width: 1,
        ),
        //边框圆角
        borderRadius: BorderRadius.all(
          Radius.circular(8),
        ),
      ),
      //按钮高度
      height: 32,
      //按钮最小宽度
      minWidth: 60,
      //点击事件
      onPressed: () {
    
    },
      child: const Text(
        "查找",
        style: TextStyle(fontSize: 12, color: Colors.deepPurple),
      ),
    );
  }

Guess you like

Origin blog.csdn.net/zl18603543572/article/details/122689984