gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-03 02:53:08 32 4
gpt4 key购买 nike

Flutter 小部件,我尝试使用 BorderSide(color : Colors.blue) 更改 OutlineButton 边框颜色。无论设置哪种颜色,OutlineButton 始终带有灰色边框,但宽度更改适用。如何更改 OutlineButton 边框线条颜色?

class OutlineButtonWidget extends StatelessWidget {

@override
Widget build(BuildContext context) {
return Center(
child: OutlineButton(
onPressed: null,
borderSide: BorderSide(
width: 5.0,
color: Colors.blue,
style: BorderStyle.solid,
),
child: Text('outline button')
),
),
);
}
}

最佳答案

使用 style属性(property)

OutlinedButton(
onPressed: () {},
child: Text('Outlined button'),
style: OutlinedButton.styleFrom(
side: BorderSide(width: 5.0, color: Colors.blue),
),
)

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

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com