我尝试使用 NestedScrollView 创建带有浮动 SliverAppBar 的滚动视图,并在 CustomScrollView 中添加内容,我需要将其分开,因为我还使用了 pull_to_refresh 插件来处理 api 请求。
但是,如果我向上滚动以显示浮动 SliverAppBar,它不会像我预期的那样工作,它仅在用户停止滚动后显示
有没有办法用 NestedScrollView 来实现这一点?或者也许是其他小部件,我需要将其与 CustomScrollView 分开,因为如果我在 CustomScrollView 中使用浮动 SliverAppBar,我的加载指示器将与浮动 SliverAppBar 重叠
这是我尝试过的代码
Scaffold(
body: SafeArea(
child: Scrollbar(
child: NestedScrollView(
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
// These are the slivers that show up in the "outer" scroll view.
return <Widget>[
SliverAppBar(
title: const Text('Books Nested'), // This is the title in the app b
forceElevated: innerBoxIsScrolled,
floating: true,
snap: true,
),
];
},
body: CustomScrollView(
slivers: <Widget>[
SliverList( …Run Code Online (Sandbox Code Playgroud)