【发布时间】:2021-12-31 10:59:48
【问题描述】:
【问题讨论】:
-
任何机构有解决方案?
标签: flutter dialog flutter-getx
【问题讨论】:
标签: flutter dialog flutter-getx
您可以使用 PageView.builder 和 PageController 来实现您的预期结果。我分享了一个参考example,您可以根据需要对其进行修改。
class WelcomeScreen extends StatefulWidget {
@override
_WelcomeScreenState createState() => _WelcomeScreenState();
}
class _WelcomeScreenState extends State<WelcomeScreen> {
PageController _controller = PageController();
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Pagination Example"),
),
body: Padding(
padding: EdgeInsets.all(24.0),
child: Center(
child: PageView.builder(
controller: _controller,
itemCount: 2,
itemBuilder: (context, index) => Scaffold(
appBar: AppBar(
title: Text("Page $index"),
leading: index == 1
? IconButton(
onPressed: () {
_controller.previousPage(
duration: Duration(milliseconds: 100),
curve: Curves.ease);
},
icon: Icon(Icons.arrow_back),
)
: null,
),
body: Column(
children: [
Text("Content of Page $index"),
Visibility(
visible: index == 1 ? false : true,
child: ElevatedButton(
onPressed: () {
_controller.nextPage(
duration: Duration(milliseconds: 100),
curve: Curves.ease);
},
child: Text("Next Page")),
)
],
),
)),
),
),
);
}
}
【讨论】:
您是否尝试过更改对话框的内容而不是使用路由器?就像使用当你点击重复更新对话框内容时改变的状态变量,然后当你点击保存时恢复它
【讨论】: