flutter列表无法滚动到底部_Flutter: 页面上半部分固定 下半部分不定长度列表

针对Flutter中列表无法滚动到底部的问题,使用NestedScrollView进行解决。代码示例展示了如何在页面上半部分设置固定内容,下半部分创建不定长度的列表。修复方法包括在AppBar下使用Stack和Positioned,并在body中配置NestedScrollView与CustomScrollView。
摘要由CSDN通过智能技术生成

用 NestedScrollView 解决的。可能是 CustomScrollView 太原始了……

Git 上更新的这个问题解决的代码。

下面是这次修改的片段。

class Home extends StatefulWidget {

@override

_HomeState createState() => _HomeState();

}

class _HomeState extends State {

@override

Widget build(BuildContext context) {

return Scaffold(

backgroundColor: AppColor.bColor,

appBar: PreferredSize(

child: AppBar(

backgroundColor: AppColor.red,

flexibleSpace: Stack(

children: [

Positioned(

child: Image.asset(

'assets/images/logo.png',

width: ScreenUtil().setWidth(100),

),

left: ScreenUtil().setWidth(324),

right: ScreenUtil().setWidth(324),

bottom: ScreenUtil().setWidth(36),

),

],

),

),

preferredSize: Size.fromHeight(ScreenUtil().setWidth(180)),

),

body: NestedScrollView(

headerSliverBuilder: (context, boxIsScrolled) {

return [

SliverToBoxAdapter(

child: Column(

children: [

Search(),

Banner(),

Msg(),

],

),

),

];

},

body: CustomScrollView(slivers: [

SliverPersistentHeader(

pinned: true,

delegate: _SliverAppBarDelegate(

minHeight: ScreenUtil().setWidth(90),

maxHeight: ScreenUtil().setWidth(90),

child: FilterBar(),

),

),

SliverList(

delegate: SliverChildBuilderDelegate(

(BuildContext context, int index) {

return PropertyListItem(

id: index,

);

},

childCount: 1,

),

)

]),

),

);

}

}

这个群里问的,还是得有个群哪……

群号:181398081

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值