无需滚动的弹力listView和刷新器
我有以下带有
,我想使用一个拉动到换句手势,但没有滚动列表的滚动(即元素留在原处。在正常状态下,Appbar将触摸系统行)。listView
的刷新
这是代码
RefreshIndicator(
key: _refreshIndicatorKey,
onRefresh: () => widget.refreshState(),
color: Palette.primary,
child: Container(child:
ListView.builder(
itemBuilder: (c, i) {
var core = (widget.tabContent[selected] == null)
? waitingWidget()
: widget.tabContent[selected];
var list = List<Widget>.from([
top,
core,
SizedBox(
height:
max(16.0, MediaQuery.of(context).padding.bottom))
]);
return list[i];
},
itemCount: 3
)
),
);
I have the following RefreshIndicator
with ListView
and I would like to use a pull-to-refresh gesture but without the scrolling of the list (i.e. the elements stay where they are. In a normal state the appbar will touch the system row).
This is the code
RefreshIndicator(
key: _refreshIndicatorKey,
onRefresh: () => widget.refreshState(),
color: Palette.primary,
child: Container(child:
ListView.builder(
itemBuilder: (c, i) {
var core = (widget.tabContent[selected] == null)
? waitingWidget()
: widget.tabContent[selected];
var list = List<Widget>.from([
top,
core,
SizedBox(
height:
max(16.0, MediaQuery.of(context).padding.bottom))
]);
return list[i];
},
itemCount: 3
)
),
);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Alex,
我要做的是创建一个包含您的标题/
顶部
和您的ListView/core> core
的列。基本上,将标题从listView中移出,这将使其不可滚动,而ListView可以保持滚动和刷新。我假设您的图片中所有紫色的东西都在
top
中。我还为您的listView打开了sharinkwrap
,因为根据内容的不同,可能是这种情况。如果您遇到错误,则可以将其关闭。最后,您有一个包含标头和内容的不可滚动列,并且只有内容部分才能滚动为listView(包括刷新指标)。这是大多数应用程序所遵循的设计,并且将对您的用户熟悉,
因此类似的内容:
Alex,
What I would do is create a Column that contains your header/
top
and your listview/core
. Basically move your header out of the listview, which would make it non scrollable, while the listview can remain scrollable and refreshable.I'm assuming all the purple-blueish stuff in your picture is in
top
. I've also turnedshrinkWrap
on for your listview as that might have to be the case depending on the content. If you are getting errors, you can turn it off.In the end you have a non-scrollable column that contains the header and content, and only the content portion is scrollable as a listview (including the refresh indicator). This is the design most apps follow and will be familiar to your users
So something like this: