简体   繁体   English

使用平滑页面指示器在颤动中的页面之间切换

[英]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, ), ); }
the name of my page to which I want to go Page2, and this Page1 我要转到的页面的名称 Page2,以及这个 Page1

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传递给PageViewSmoothPageIndicator小部件,您应该能够左右滑动并看到点移动。 That simple.就那么简单。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Flutter 在使用 BottomNavigationBar 加载的页面之间切换 - Flutter switch between pages loaded using BottomNavigationBar 颤动:bottomNavigationBar 无法使用 WebView 在 html 页面之间切换 - flutter: bottomNavigationBar cannot switch between html pages using WebView Flutter 在gridveiw builder中设置smooth_page_indicator - Flutter set smooth_page_indicator in gridveiw builder 平滑页面指示器 - Smooth Page Indicator 如何计算点指示器的横幅/页面数? 我正在使用 pub.dev 上提供的 smooth_page_indicator 包 - How to count the number of banners/pages for dot indicators? I'm using smooth_page_indicator package available on pub.dev 动画平滑指示器不起作用? 扑 - Animated Smooth Indicator not Working ? FLUTTER Flutter 中的滚动页面指示器 - Scrolling page indicator in Flutter Flutter 曲面导航栏不切换页面 - Flutter curved navigation bar does not switch between pages 如何在 flutter 中以编程方式切换 BottomNavigationBar 选项卡(以及在页面之间导航) - How to switch BottomNavigationBar tabs Programmatically in flutter (and Navigate between pages) 无法在我的 flutter 项目中使用刷新指示器重新加载页面 - Not able to reload page by using Refresh Indicator in my flutter project
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM