简体   繁体   English

如何通过 flutter 和类似此 ui 创建水平列表视图?

[英]how to create horizontal list view by flutter and similar this ui?

I need a horizontal list view in the flutter, that according to the image below, the first item is empty and the image is visible in the background, when the second item starts scrolling, the background image disappears and when the item returns to its place, The image also returns to the original state.我需要 flutter 中的水平列表视图,根据下图,第一个项目是空的并且图像在背景中可见,当第二个项目开始滚动时,背景图像消失并且当项目返回到它的位置时,图像也变回原来的state。

在此处输入图像描述

You will need some code here.您将需要一些代码。 The vertical listview you can get with the SingleChildScroolView changing the axis to vertical and placing a Column inside.您可以通过SingleChildScroolView将轴更改为垂直并在其中放置一个 Column 来获得垂直listview To the empty space on last item, place a Sizedbox as last widget inside Column.在最后一个项目的空白处,放置一个Sizedbox作为 Column 中的最后一个小部件。 Place a ScrollController on the SingleChildScroolView with a listener, and when the controller reach the maximum just fade in the background image.在带有侦听器的SingleChildScroolView上放置一个ScrollController ,当 controller 达到最大值时,背景图像就会淡出。 Its not hard, just need some code.这并不难,只需要一些代码。

Finally, I published Package (flutter_faded_list) for designing this UI on the pub.dev website.最后,我在 pub.dev 网站上发布了用于设计此 UI 的 Package (flutter_faded_list)

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM