我想遍历对象3次,但是数组methor'reset'在对象上不起作用。
/
我只能重复一次。
答案 0 :(得分:-1)
这是您应该执行的操作:
class Header extends StatefulWidget {
String buttonTitle;
String title;
Header(String buttonTitle , String title) //the constructor I'm gonna
call
{
this.buttonTitle = buttonTitle;
this.title = title;
}
@override
HeaderState createState() => HeaderState(buttonTitle , title);
}
class HeaderState extends State<Header> {
String buttonTitle;
String title;
HeaderState(String buttonTitle , String title)
{
this.buttonTitle = buttonTitle;
this.title = title;
}
@override
Widget build(BuildContext context) {
//some code
Text("$title", //the first parameter passed dynamically),
RaisedButton(
child: Text(
"$buttonTitle", //the second parameter
),
}
class FirstScreen extends StatefulWidget {
@override
FirstScreenState createState() => FirstScreenState();
}
class FirstScreenState extends State<FirstScreen> {
@override
Widget build(BuildContext context) {
return Scaffold(
Header("OK", "Page1"),//constructor is called here
);
}
}
-> fetch()命令获取数据集的下一行。