【问题标题】:no named parameter with the name home [closed]没有名为 home 的命名参数 [关闭]
【发布时间】:2021-04-18 04:24:58
【问题描述】:

   bodyText1: TextStyle(
                color: Color.fromRGBO(20, 51, 51, 1)
              ),
         bodyText2: TextStyle(
          color: Color.fromRGBO(20, 51, 51, 1)
            ),
    title: TextStyle(
    fontSize: 24,
    fontFamily: 'Roboto',
    )

      ),
    home:   Categories(),
    ),
      );

【问题讨论】:

  • 如果您正确缩进代码(Ctrl-Alt-L 或 Cmd-Opt-L),就很容易看出哪里出了问题。
  • homeMaterialApp 的参数。你将它传递给ThemeData。将该参数移出到MaterialApp
  • 将 home 参数移到括号外,您将其写入主题数据
  • 请添加完整的源代码

标签: flutter


【解决方案1】:

ThemeData 没有 home 参数。您可能打算将该行放在下一个右括号下方,因此它适用于 MaterialApp

【讨论】:

    猜你喜欢
    • 2021-07-02
    • 1970-01-01
    • 2021-12-11
    • 1970-01-01
    • 2023-01-03
    • 2019-03-24
    • 2020-12-02
    • 2019-03-22
    • 2021-03-24
    相关资源
    最近更新 更多