[英]switch between pages in the flutter using the Smooth Page Indicator
I want to make a steamer to the next page using the Smooth Page Indicator widget.我想使用平滑页面指示器小部件制作下一页的蒸笼。 I added this widget to the page but I don't know how to add the pages I want to go to.我在页面上添加了这个小部件,但我不知道如何添加我想要去的页面。 I will be grateful for your help My code :我将不胜感激您的帮助我的代码:
final controller = PageController(viewportFraction: 0.8, keepPage: true); @override Widget build(BuildContext context) { return Scaffold( body: Column( mainAxisSize: MainAxisSize.min, children: <Widget>[ SizedBox(height: 35.0), Container( child: SmoothPageIndicator( controller: controller, count: 2, effect: JumpingDotEffect( dotHeight: 16, dotWidth: 16, jumpScale: .7, verticalOffset: 15, ), ), ), ]), floatingActionButton: FloatingActionButton( onPressed: () { setState(() { _scanQR(); }); }, child: const Icon(Icons.qr_code), backgroundColor: Colors.pink, ), ); }
I think you might be looking for the PageView
widget : https://api.flutter.dev/flutter/widgets/PageView-class.html我想您可能正在寻找PageView
小部件: https : PageView
By passing the same PageController
to both, the PageView
and the SmoothPageIndicator
widgets you should be able to swipe left and right AND see the dots move along.通过将相同的PageController
传递给PageView
和SmoothPageIndicator
小部件,您应该能够左右滑动并看到点移动。 That simple.就那么简单。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.