[英]Two page on PageView widget in Flutter
Is there any way to show to Two Page at the same time in PageView widget?有没有办法在 PageView 小部件中同时显示两个页面? basically a number of pages need to be set dynamically like for portrait 1 for landscape 2, if not with PageView is there any alternative?基本上需要动态设置许多页面,例如横向 2 的纵向 1,如果不使用 PageView,还有其他选择吗?
It is possible to dynamically change the number of pages.可以动态更改页数。 This is likely best achieved using the PageView.builder
constructor of PageView
.这可能最好使用PageView
的PageView.builder
构造函数来实现。 Set the itemCount
to 2(or else the maximum number of pages that you'll have) and provide your pages in the builder
, returning null
on index 1 when you only want 1 page.将itemCount
设置为 2(或者您将拥有的最大页数)并在builder
中提供您的页面,当您只需要 1 页时,在索引 1 上返回null
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.