[英]Flutter: I need to make the widgets scrollable so that whenever i'm scrolling with list view they will follow
I have 2 rows in my screen, the first row is consist of dropdown button and elevation button and the second row is where the stream builder located, I used flexible so that the stream builder is scrollable.我的屏幕上有 2 行,第一行由下拉按钮和高度按钮组成,第二行是流构建器所在的位置,我使用了flexible,以便流构建器可以滚动。 What I want is every time I scroll the stream builder I want the first row to follow the scroll not stay in the screen.我想要的是每次滚动流构建器时,我希望第一行跟随滚动而不是留在屏幕上。
This is how my widget set:这是我的小部件设置的方式:
Scaffold
-Column
-Row
-Dropdown button
-Elevated buton
-Flexible
-Streambuilder
-stack
-listview
Just like in facebook everytime you scroll down the "what's in your mind" controller disappers too, not floating like an app bar就像在 Facebook 中每次向下滚动时,“你在想什么”控制器也会消失,而不是像应用栏一样浮动
Inside Listview add physics: NeverScrollableScrollPhysics()在 Listview 中添加物理:NeverScrollableScrollPhysics()
Listview( physics: NeverScrollableScrollPhysics(), return .....; ) Listview(物理:NeverScrollableScrollPhysics(),返回.....;)
Follow this pattern.遵循这个模式。
If you want that widget to disappear when you scroll, you need to wrap your Column
in a SingleChildScrollView
which you will need to wrap in a Flxible如果您希望该小部件在滚动时消失,则需要将Column
包装在SingleChildScrollView
,您需要将其包装在 Flxible 中
Code:代码:
Flexible(
child: SingleChildScrollView(
child: Column(
//your normal code insode Column
Depending on your code, you may also need to make the ListView
not scroll (as suggested by Rafid):根据您的代码,您可能还需要使ListView
不滚动(如 Rafid 建议的那样):
Listview( physics: NeverScrollableScrollPhysics()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.