[英]How to change the background color of ElevatedButton in Flutter?
I tried to change the background color of ElevatedButton but it gave me an error.我试图更改 ElevatedButton 的背景颜色,但它给了我一个错误。 How can I change it?我该如何改变它?
ElevatedButton(
onPressed: null,
style: ButtonStyle(backgroundColor: Colors.red), // Error
}
Try This way尝试这种方式
ElevatedButton(
onPressed: () {},
style: ElevatedButton.styleFrom(
primary: Colors.red,
),)
I tried to change the background color of ElevatedButton but it gave me an error.我试图更改 ElevatedButton 的背景颜色,但它给了我一个错误。 How can I change it?我怎样才能改变它?
ElevatedButton(
onPressed: null,
style: ButtonStyle(backgroundColor: Colors.red), // Error
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.