Widget 背景 App Bar
背景应用栏插件,如果您想在滚动时保留 sliver 应用栏的背景,请使用此插件。
灵感来自 GradientAppBar GitHub
截图
别忘了点击 + 按钮 5 次
入门
-
通过在您的 pubspec.yaml 文件中添加以下内容来依赖它:
background_app_bar: ^1.0.0 -
导入它:
import 'package:background_app_bar/background_app_bar.dart' -
用 BackgroundFlexibleSpaceBar 替换您当前的 FlexibleSpaceBar(在 AppBar 或 SliverAppBar 中)。
new SliverAppBar(
expandedHeight: _APP_BAR_SIZE,
floating: false,
pinned: true,
snap: false,
elevation: 0.0,
backgroundColor: Colors.transparent,
flexibleSpace: new BackgroundFlexibleSpaceBar(
title: new Text( widget.title ),
centerTitle: false,
titlePadding: const EdgeInsets.only(left: 20.0, bottom: 20.0),
background: new ClipRect(
child: new Container(
child: new BackdropFilter(
filter: new ImageFilter.blur(sigmaX: 5.0, sigmaY: 5.0),
child: new Container(
decoration: new BoxDecoration(
color: Colors.black.withOpacity(0.5),
),
),
),
decoration: new BoxDecoration(
image: DecorationImage(
image: AssetImage(
"images/bg.jpg",
),
fit: BoxFit.fitWidth
)
),
),
),
),
)



