【问题标题】:The named parameter ' ' isnt defined命名参数\'\'未定义
【发布时间】:2022-11-01 13:17:32
【问题描述】:

升级到颤振 3.3.6 后,我的颤振应用程序出现错误。将错误抛出为“未定义”的命名参数:高程、颜色、形状

下面列出了我得到错误的 sn-p:

return ButtonTheme(
  minWidth: 110,
  child: RaisedButton(
      elevation: 0,
      child: isLoading
          ? _buildLoadingIndicatorWithColor(textColor)
          : Text(
              text,
              style: TextStyle(
                  color: textColor,
                  fontWeight: FontWeight.bold,
                  fontSize: 16),
            ),
      color: communityColor,
      onPressed: onPressed,
      shape: new RoundedRectangleBorder(
          borderRadius: BorderRadius.circular(borderRadius))),
);

}

根据我阅读https://docs.flutter.dev/release/breaking-changes/buttons 的以下文档,需要进行一些更改才能使其正常工作。感谢您的帮助,因为我是 Flutter 的新手,也是编程的初学者

【问题讨论】:

    标签: flutter dart


    【解决方案1】:

    RaisedButton 已弃用。您可以使用 ElevatedButton()。请检查以下代码。

    ButtonTheme(
          minWidth: 110,
          child: ElevatedButton(
            style: ElevatedButton.styleFrom(
              elevation: 0,
              backgroundColor: communityColor,
              shape: new RoundedRectangleBorder(),
            ),
            child: isLoading
                ? _buildLoadingIndicatorWithColor(textColor)
                : Text(
                    text,
                    style: TextStyle(color: textColor, fontWeight: FontWeight.bold, fontSize: 16),
                  ),
            onPressed: onPressed,
          ),
        );
    

    【讨论】:

      猜你喜欢
      • 2022-01-04
      • 2020-02-13
      • 2020-06-24
      • 2018-05-14
      • 2020-02-16
      • 2021-06-12
      • 2021-06-15
      • 2020-12-03
      相关资源
      最近更新 更多