【发布时间】:2020-12-23 22:39:44
【问题描述】:
我想在左右滑动时停止 PageView 重建。 基本上我在这个 PageView 中有 1 个带水平轴的 PageView 我还有一个带垂直轴的 PageView。
在 1 个页面视图中我只有 2 个孩子,但在第二个页面视图中我有基于 http 请求的孩子。
问题:当用户将 1 PageView 向右然后向左滚动时,1 PageView 会重建第二个 Pageview 子项并将页面索引自动设置为 0。
期望:只是我想在用户从左到右滚动时停止重建 1 个 PageView,然后将 1 个 PageView 停止到正确的位置并忽略设置位置 0。
PageView 示例
return PageView(
scrollDirection: Axis.horizontal,
allowImplicitScrolling: false,
controller: _main_pageController,
children: [
PageView(
controller: _pageController,
scrollDirection: Axis.vertical,
children: [
for(int index = 0; index < complexTutorial.data.length;index++)
COntainer(color:Colors.yellow),
],),
// below is second child of 1 PageView.
Container(child:Text("USER SETTING")),
],);
请帮助解决这个问题,我是新来的,谢谢。
【问题讨论】:
标签: flutter dart flutter-layout