我试图在颤动的 web 上有一个浮动的 SliverAppBar,但是只有当我滚动到屏幕顶部时才会显示 SliverAppBar。它在 Android 上运行良好。我的代码是:
return Scaffold(
backgroundColor: Colors.grey[100],
body: CustomScrollView(slivers: <Widget>[
SliverAppBar(
automaticallyImplyLeading: false,
actions: <Widget>[Container()],
floating: true,
title: Text(('My Title')),
elevation: 0,
),
SliverList(
delegate: SliverChildListDelegate(
[
Container(color: Colors.red, height: 150.0),
Container(color: Colors.purple, height: 150.0),
Container(color: Colors.green, height: 150.0),
Container(color: Colors.red, height: 150.0),
Container(color: Colors.purple, height: 150.0),
Container(color: Colors.green, height: 150.0),
Container(color: Colors.red, height: 150.0),
Container(color: Colors.purple, height: 150.0),
Container(color: Colors.green, height: 150.0),
Container(color: Colors.red, height: 150.0),
Container(color: Colors.purple, height: 150.0),
Container(color: Colors.green, height: 150.0),
],
),
)
]));