【问题标题】:I'm getting a strange error when using "color:"使用“颜色:”时出现一个奇怪的错误
【发布时间】:2021-11-16 16:28:17
【问题描述】:

使用color:时出现此错误

未定义命名参数“颜色”。

代码是:

body: Center(
  child: ElevatedButton(
    child: Text('click'),
    onPressed: () {}  ,
    color: Colors.green[300],
  ),
),

【问题讨论】:

    标签: flutter button colors styles


    【解决方案1】:

    输入样式然后下一个是这个

      ElevatedButton(
       style: ElevatedButton.styleFrom(
         primary: Colors.green[300],
            ),
          onPressed: () {},
          child: Text("click"),
       ),
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-08-30
      • 2013-05-05
      • 1970-01-01
      • 2012-05-05
      • 2011-06-16
      • 1970-01-01
      • 1970-01-01
      • 2011-01-08
      相关资源
      最近更新 更多