我正在尝试使用Flutter在可伸缩空间中重现具有重叠内容的App栏滚动行为。
该行为在此处演示:
http://karthikraj.net/2016/12/24/scrolling-behavior-for-appbars-in-android/
我已经使用SliverAppBar创建了可折叠式App栏,但是我想要创建这种
由于我找不到任何onScroll回调,所以我无法使用Stack,目前我已创建带有flexibleSpace的应用栏,应用栏可以在滚动时折叠:
Scaffold(
body: NestedScrollView(
headerSliverBuilder:
(BuildContext context, bool innerBoxIsScrolled) => <Widget>[
SliverAppBar(
forceElevated: innerBoxIsScrolled,
pinned: true,
expandedHeight: 180.0,
),
],
body: ListView.builder(
itemCount: 30,
itemBuilder: (context, index) => Text(
"Item $index",
style: Theme.of(context).textTheme.display1,
),
),
),
);
编辑:我想要创建的示例