【发布时间】:2021-11-13 07:47:53
【问题描述】:
Widget _buildItems() {
return id == 0
? Column(Text("PAGE 1"))
: Center(
Text("PAGE 2"),
);
}
你好,上面是我的颤振代码的一部分,我一直在出错。你能调查一下吗?看起来我的语法是错误的,但我无法确定我错在哪里。
谢谢。
? Column(Text("PAGE 1"))
^
packages/flutter/lib/src/widgets/basic.dart:4930:3: Context: Found this candidate, but the arguments don't match.
Column({
^^^^^^
/lib/components/challenge_menu.dart:32:17: Error: Too many positional arguments: 0 allowed, but 1 found.
Try removing the extra positional arguments.
: Center(
^
packages/flutter/lib/src/widgets/basic.dart:1984:9: Context: Found this candidate, but the arguments don't match.
const Center({ Key? key, double? widthFactor, double? heightFactor, Widget? child })
^^^^^^
/lib/components/challenge_menu.dart:30:12: Error: The getter 'id' isn't defined for the class '_ChallengeMenuState'.
- '_ChallengeMenuState' is from 'package:osam2021/components/challenge_menu.dart' ('/lib/components/challenge_menu.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'id'.
return id == 0
^^
【问题讨论】: