Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/dart/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Flutter 如何解决“问题”;位置论元;尝试实现行时出错_Flutter_Dart - Fatal编程技术网

Flutter 如何解决“问题”;位置论元;尝试实现行时出错

Flutter 如何解决“问题”;位置论元;尝试实现行时出错,flutter,dart,Flutter,Dart,我是dart编程的新手,来自一种更基本的语言,在尝试实现一行时遇到了这个错误。错误:将位置参数放在命名参数之前。请尝试将位置参数移动到命名参数之前,或为参数添加名称。如果您有任何帮助,我们将不胜感激,代码如下所示 Row( children: [ TextButton( onPressed: tempoRandomise, child: Icon(Icons.add), ), TextButton( onPress

我是dart编程的新手,来自一种更基本的语言,在尝试实现一行时遇到了这个错误。错误:将位置参数放在命名参数之前。请尝试将位置参数移动到命名参数之前,或为参数添加名称。如果您有任何帮助,我们将不胜感激,代码如下所示

Row( 
    children: [

     TextButton(
       onPressed: tempoRandomise,
       child: Icon(Icons.add),
     ),
    TextButton(
       onPressed: keyRandomise,
       child: Icon(Icons.add),
     ),
     TextButton(
       onPressed: styleRandomise,
       child: Icon(Icons.add),
     ),
   ],
  )

根据您发送的内容,它可能来自按下的
on
。您似乎正在将一些参数传递给,例如,
styleRandomise
。请尝试使用以下代码:

TextButton(
    child: Icon(Icons.add),
    onPressed: ( ) {
          print('Pressed');
     }
)
或者您可以像下面那样声明您的
样式随机化
函数并使用现有代码:

void styleRandomise ( ) {
    print('Do something here...');
}
不要忘了检查您在按下
按钮前所述的其他功能。它们都必须没有参数和void


希望有帮助。

您确定这些行中存在错误吗?这就是terminal说它提供了一个更大的代码示例的地方,可能您还没有编写
子代码:
在Rowterminal显示文件的哪一行,并发布该代码之前的行中定义了所有函数,所以我不确定为什么它会这样做。我试试看,谢谢