默认情况下,flutter会在ListView/ GridView/ ...上为Android手机上的过度滚动添加一个发光效果
我想完全或在一个特定的可滚动上删除此效果.我知道我可以改变ScrollPhysicsBounce/Clamp之间的变化.但这实际上并没有消除发光效果.
我能做什么 ?
默认情况下,flutter在 iosoverscroll上添加了一个效果ListView/GridView/...
我想完全或在一个特定的滚动条上删除此效果。
我能做什么 ?
我想PageView使用 custom创建一个进度ScrollPhysics,以便用户只能滚动到已完成的选项卡。请参阅下图以供参考,右上角是进度(绿色=可访问,红色=不可访问页面):
![1]](https://i.stack.imgur.com/n88m9.png)
在屏幕截图中,我完成了第 1 页和第 2 页,但我不想让用户滑动到当前正在发生的第 3 页。scroll_physics.dart我阅读了iOS 和 Android 实现的示例。但我还是被困住了。
我在这里尝试过这个尝试过,但它有问题。您可以阻止用户向右移动,但如果最后一个可访问的页面不完全可见(如屏幕截图所示),则滚动已被阻止,您无法进一步向右滚动。
\n\n这是我现在的代码:
\n\n电话来自:
\n\nPageView(\n controller: PageController(\n initialPage: model.initallPage,\n ),\n children: pages,\n physics: model.currentPage >= model.lastAccessiblePage ? CustomScrollPhysics(CustomScrollStatus()..rightEnd = true) : ScrollPhysics(),\n onPageChanged: (value) {\n model.currentPage = value;\n },\n ),\nRun Code Online (Sandbox Code Playgroud)\n\n自定义滚动物理:
\n\nclass CustomScrollStatus {\n bool leftEnd = false;\n bool rightEnd = false;\n bool isGoingLeft = false;\n bool isGoingRight = false;\n}\n\nclass CustomScrollPhysics extends ScrollPhysics …Run Code Online (Sandbox Code Playgroud)