如何让 Silver App 不应该崩溃
how to make Silver App Should Not Collapse
我想让我的银色应用栏即使向上滚动也不会折叠。有没有办法让它不崩溃?
NestedScrollView(
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
return <Widget>[
SliverOverlapAbsorber(
handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context),
sliver: SliverAppBar(
pinned: true,
floating: false,
stretch: false,
expandedHeight: 300.0,
flexibleSpace: FlexibleSpaceBar(
centerTitle: true,
title: const Text('Weather Report'),
background: Image.asset(
'assets/newEvent.png',
fit: BoxFit.cover,
),
),
),
),
];
},
只要给你的 SliverAppBar
和 expandedHeight
一样的 collapsedHeight
SliverAppBar(
expandedHeight: 300,
collapsedHeight: 300,
...
)
试试这个@Gbenga B 我不害怕
NestedScrollView(
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
return <Widget>[
SliverOverlapAbsorber(
handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context),
sliver: SliverAppBar(
pinned: true,
floating: false,
stretch: false,
expandedHeight: 300,
collapsedHeight: 300,
flexibleSpace: FlexibleSpaceBar(
centerTitle: true,
title: const Text('Weather Report'),
background: Image.asset(
'assets/newEvent.png',
fit: BoxFit.cover,
),
),
),
),
];
},
我想让我的银色应用栏即使向上滚动也不会折叠。有没有办法让它不崩溃?
NestedScrollView(
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
return <Widget>[
SliverOverlapAbsorber(
handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context),
sliver: SliverAppBar(
pinned: true,
floating: false,
stretch: false,
expandedHeight: 300.0,
flexibleSpace: FlexibleSpaceBar(
centerTitle: true,
title: const Text('Weather Report'),
background: Image.asset(
'assets/newEvent.png',
fit: BoxFit.cover,
),
),
),
),
];
},
只要给你的 SliverAppBar
和 expandedHeight
collapsedHeight
SliverAppBar(
expandedHeight: 300,
collapsedHeight: 300,
...
)
试试这个@Gbenga B 我不害怕
NestedScrollView(
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
return <Widget>[
SliverOverlapAbsorber(
handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context),
sliver: SliverAppBar(
pinned: true,
floating: false,
stretch: false,
expandedHeight: 300,
collapsedHeight: 300,
flexibleSpace: FlexibleSpaceBar(
centerTitle: true,
title: const Text('Weather Report'),
background: Image.asset(
'assets/newEvent.png',
fit: BoxFit.cover,
),
),
),
),
];
},