Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/flutter/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Flutter 为什么SliverFill仍在过度扩张?_Flutter_Flutter Sliver_Flutter Sliverappbar - Fatal编程技术网

Flutter 为什么SliverFill仍在过度扩张?

Flutter 为什么SliverFill仍在过度扩张?,flutter,flutter-sliver,flutter-sliverappbar,Flutter,Flutter Sliver,Flutter Sliverappbar,我试着做一个滑动条,它对高度有反应,根据是否展开显示不同的东西 我是基于,但我有个问题: 列表末尾的空白太长了 如果项目数量较多,则无需删除SliverFillRemainding,但将numberOfItems更改为例如3个项目(而不是30个),则需要SliverFillRemainding 查看此省道板以获取代码: CustomScrollView( 物理:AlwaysScrollableScrollPhysics(), 控制器:_控制器, 条子:[ 滑杆( 对,, 背景颜色:颜色。灰色[1

我试着做一个滑动条,它对高度有反应,根据是否展开显示不同的东西

我是基于,但我有个问题:

列表末尾的空白太长了

如果项目数量较多,则无需删除SliverFillRemainding,但将
numberOfItems
更改为例如3个项目(而不是30个),则需要SliverFillRemainding

查看此省道板以获取代码:

CustomScrollView(
物理:AlwaysScrollableScrollPhysics(),
控制器:_控制器,
条子:[
滑杆(
对,,
背景颜色:颜色。灰色[100],
是的,
自动嵌入:false,
flexibleSpace:标题(
maxHeight:maxHeight,
最小高度:最小高度,
),
折叠高度:最小高度,
expandedHeight:maxHeight-MediaQuery.of(context).padding.top,
),
银表(
代表:SliverChildBuilderDelegate(
(上下文、索引){
返回构建卡(索引);
},
childCount:numberOfItems,
),
),
剩余碎片(

hasScrollBody:true),//**如果您只是添加了一定高度的空间,我建议您使用SliveToboxAdapter:

SliverToBoxAdapter(
  child: SizedBox(
    height: 50,
  ),
),

谢谢,我最终使用了这个解决方案,因为我无法让它与SliverFill一起工作
SliverToBoxAdapter(
  child: SizedBox(
    height: 50,
  ),
),