Flutter “我怎样才能解决问题?”;命名参数';颜色';isn';定义为“t”;颤振问题?
当我对渐变颜色使用常量时,我得到了一个参数格式错误Flutter “我怎样才能解决问题?”;命名参数';颜色';isn';定义为“t”;颤振问题?,flutter,dart,constructor,Flutter,Dart,Constructor,当我对渐变颜色使用常量时,我得到了一个参数格式错误 Expanded( child: OpenContainer( closedElevation: 0, transitionType: ContainerTransitionType.fade, transitionDuration: const Duration(mill
Expanded(
child: OpenContainer(
closedElevation: 0,
transitionType: ContainerTransitionType.fade,
transitionDuration: const Duration(milliseconds: 1000),
closedColor: const Color(0xFFE9E9E9),
openBuilder: (context, _) {
return WorkoutScreen();
},
closedBuilder: (context, VoidCallback openContainer) {
return GestureDetector(
onTap: openContainer,
child: Container(
margin: const EdgeInsets.only(bottom: 10, left: 32, right: 32),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(30)),
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
**colors: [
const Color(0xFF20008B),
const Color(0xFF200087),
],**
),
),
这里有一条错误消息:未定义命名参数“colors”。
尝试将名称更正为现有命名参数的名称,或使用名称“colors”定义命名参数
您可以尝试通过在终端窗口中执行
颤振清理
来修复此问题,然后等待VSCode重新分析您的文件。这无助于修复此问题。但是对于tnx,除了***
,这是您的确切代码吗(即,您复制并粘贴了它,而没有进行任何其他更改)?您确定错误是指指示的行吗?你用的是什么版本的颤振?是的,颜色这个词给了我错误。[√] 颤振(通道稳定,1.22.6,在Microsoft Windows[Version 10.0.18363.1379]上,locale tr)[√] 安卓工具链-为安卓设备开发(安卓SDK版本30.0.2我用显示错误的图片编辑了我的问题。你能检查一下吗?回答你的问题吗?是的,在我写了所有东西之后,这个问题就消失了。非常感谢。@Vinet