Flutter 页面浏览指示器点在持续的底部纸张抖动中不工作
我正在创建一个页面视图,页面底部有点指示器。 底页显示页面视图和点指示器。但当我水平滚动时,它在点视图中没有效果 我的代码层次结构如下所示:Flutter 页面浏览指示器点在持续的底部纸张抖动中不工作,flutter,pageviews,Flutter,Pageviews,我正在创建一个页面视图,页面底部有点指示器。 底页显示页面视图和点指示器。但当我水平滚动时,它在点视图中没有效果 我的代码层次结构如下所示: class zzz extends StatefulWidget with ccc { @override State createState() => new xxxState(); } class xxxState extends State< zzz > with qqq { .. ... Stac
class zzz extends StatefulWidget with ccc {
@override
State createState() => new xxxState();
}
class xxxState extends State< zzz > with qqq {
..
...
Stack(
pageview(
onPageChanged: (index) {
setState(() {
this.bottomSheetCurrentIndex = index;
});
},
)
dotsView()
)
为什么??有什么解决办法吗?像往常一样,我的大多数问题都不会从这个平台上得到答案。 不管怎样,以上问题的答案都是使用
Scopped模型或继承的小部件。
谢谢
Widget dotsview(double pages) {
return Container(
width: MediaQuery.of(context).size.width,
height: 40,
child: ListView.builder(
scrollDirection: Axis.horizontal,
padding: const EdgeInsets.only(left: 180),
itemCount: pages.toInt(),
itemBuilder: (BuildContext context, int index) {
return Container(
height: 10,
width: 10,
child: dotcontainer(pages, index),
);
}
)
);
}
//indicator style
Container dotcontainer(double pages, int index) {
return Container(
margin: EdgeInsets.symmetric(vertical: 10.0, horizontal: 2.0),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: this.bottomSheetCurrentIndex == index
? Colors.blue
: Colors.grey),
);
}