有没有一种方法可以禁用PageView裁剪效果? [英] Is there a way to disable PageView clipping effect?

查看:111
本文介绍了有没有一种方法可以禁用PageView裁剪效果?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我有一个大小为{100x100}的PageView,其中有4个孩子,因此,在我滚动到第二个孩子之前,只有一个孩子可见.我想要的是使所有4个孩子都在屏幕上可见.有没有办法做到这一点?

Let say I have a PageView sized {100x100} with 4 children, so there will be only 1 child visible at the time, until I scroll to the second child. What I want is to make all 4 children are visible on the screen. Is there a way to achieve this?

推荐答案

回答我自己的问题有点可笑,但无论如何我还是在做,以为有人可能需要这个.

Answering my own question is kind of funny, but I'm doing it anyway, thought that someone might need this.

感谢这篇文章:非viewportFraction<的PageView的中心对齐1.0

现在,我可以将PageScrollPhysics()应用于ListView以实现此效果. 像这样:

Now I can apply PageScrollPhysics() to a ListView to achieve this effect. Like this:

var _listView = ListView(physics: PageScrollPhysics());

正如@Ferdi所说,PageView不是为此设计的.因此,只需使用ListViewSingleChildScrollView()并应用PageScrollPhysics(),它就能解决问题!

As @Ferdi said, PageView is not designed for this. So just go with ListView or SingleChildScrollView() and apply the PageScrollPhysics(), it will do the trick!

这篇关于有没有一种方法可以禁用PageView裁剪效果?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆