【发布时间】:2020-04-07 16:29:22
【问题描述】:
我想在 PageView 中制作一个 4 步表单。有 4 个小部件,每个小部件对应一个阶段。每个小部件都有一个 TextField 和一个用于转到下一页的按钮。在最后一个小部件上,按钮必须检索 Textfields 的 4 个值才能保存它们。我该怎么办?
Widget build(BuildContext context) {
super.build(context);
Size _screenSize = MediaQuery.of(context).size;
return Scaffold(
key: _scaffoldKey,
body: PageView(
controller: controller,
scrollDirection: scrollDirection,
pageSnapping: true,
children: <Widget>[
TitleInput(pcontainer: widget.pcontainer, controller: controller),
DescriptionInput(pcontainer: widget.pcontainer, controller: controller),
EstimationPage(pcontainer: widget.pcontainer, controller: controller),
ImageCapture()
],
),
);
}```
//Button to go to next page:
Widget showNextPage(PageController controller, String topicTitle) {
return new Padding(
padding: EdgeInsets.fromLTRB(12.0, 45.0, 12.0, 0.0),
child: SizedBox(
height: 60.0,
width: 70,
child: new RaisedButton(
elevation: 5.0,
shape: new RoundedRectangleBorder(
borderRadius: new BorderRadius.circular(30.0)),
color: Colors.blue,
child: new Text('Suivant',
style: new TextStyle(fontSize: 20.0, color: Colors.white)),
onPressed: () => controller.nextPage(curve: Curves.ease, duration: Duration(milliseconds: 300)),
),
)
);
}
【问题讨论】:
标签: flutter