flutter - 如何更改 OutlinedButton 的边框颜色

标签 flutter button

我想更改 OutlinedButton 的边框颜色。你能告诉我怎么做吗?

OutlinedButton(
              onPressed: null,
              style: ButtonStyle(
                shape: MaterialStateProperty.all(
                  RoundedRectangleBorder(
                    borderRadius: BorderRadius.circular(25.0),
                  ),
                ),
              ),
              child: const Text("Kontynuuj jako gość",
                  style: TextStyle(fontSize: 20, color: Color(0xffffffff)),
                  textAlign: TextAlign.center),
            ),

我试过Cannot change border color in OutlinedButton但它不起作用。

最佳答案

指定 ButtonStyle 的侧面参数

ButtonStyle(
  side: MaterialStateProperty.all(BorderSide(color: Colors.deepOrange)),
  shape: MaterialStateProperty.all(
    RoundedRectangleBorder(
      side: BorderSide(color: Colors.deepOrange),
      borderRadius: BorderRadius.circular(25.0),
    ),
  ),
)

enter image description here

关于flutter - 如何更改 OutlinedButton 的边框颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67280589/

相关文章:

jquery - 灰色提交按钮直到表格填写完毕

flutter - 我们可以使用 apache kafka 作为后端来构建 flutter 移动聊天应用程序吗?

flutter - 如何在 Flutter 中重置 Hive 数据库

python - 如何使 python tkinter 匹配按钮到操作系统

android - 如何检测虚拟按钮(Android 4)?

android - 按下时按钮背景更改布局

list - 在flutter中没有从json中获取用户名的所有记录

dart - 为 http POST 请求从 TextFormField 中捕获数据

flutter - Dart:如何在不调用函数的情况下引用带有参数的函数?

javascript - Angular ng-click 事件不会触发对话框按钮