我正在尝试使用Flutter重新创建在弹性空间中具有重叠内容的应用栏滚动。
该行为在此处演示:
http://karthikraj.net/2016/12/24/scrolling-behavior-for-appbars-in-android/
我已经使用SliverAppBar创建了折叠的AppBar,使用我在此处粘贴的代码,我正在尝试创建此
我无法使用Stack,因为我找不到任何onScroll回调,到目前为止,我已使用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,
),
),
),
);
Run Code Online (Sandbox Code Playgroud)
编辑:我要创建的示例