Android 如何保持“;SliverPersistentHeader&x201D;固定在顶部,直到项目之一“;SliverList”;向下滚动后是否到达?
我在CustomScrollView中将SliverPersistentHeader与SliverList一起使用。我不希望我的SliverPersistentHeader在到达SliverList的项目1(索引:0)之前停止运行。即使我在sliverlist的索引50处,当我向下滚动时,标题仍然会向下移动。有没有捷径可走 这是我得到的==>>Android 如何保持“;SliverPersistentHeader&x201D;固定在顶部,直到项目之一“;SliverList”;向下滚动后是否到达?,android,flutter,flutter-layout,flutter-animation,flutter-sliver,Android,Flutter,Flutter Layout,Flutter Animation,Flutter Sliver,我在CustomScrollView中将SliverPersistentHeader与SliverList一起使用。我不希望我的SliverPersistentHeader在到达SliverList的项目1(索引:0)之前停止运行。即使我在sliverlist的索引50处,当我向下滚动时,标题仍然会向下移动。有没有捷径可走 这是我得到的==>> 尝试将pinted设置为true,并将浮动设置为false。 下面是每个人的工作 浮动:标题是否应立即增长 如果用户反转滚动方向,则再次执行此操作 已锁
尝试将
pinted
设置为true
,并将浮动设置为false
。
下面是每个人的工作
浮动:标题是否应立即增长
如果用户反转滚动方向,则再次执行此操作
已锁定:是否将收割台粘贴到收割台的起点
视口一旦达到其最小大小 只需将float设置为false。否则请上载AppBar类
class Home extends StatelessWidget {
@override
Widget build(BuildContext context) {
return SafeArea(
child: Material(
child: CustomScrollView(
slivers: [
SliverPersistentHeader(
delegate: MySliverAppBar(expandedHeight: 250),
pinned: true,
floating: true,
),
SliverSafeArea(
sliver: SliverAppBar(
pinned: true,
backgroundColor: Color(0xffA2B8A1),
),
),
SliverList(
delegate: SliverChildBuilderDelegate(
(_, index) => ListTile(
title: Text("Index: $index"),
),
),
)
],
),
),
);
}
}