Commit 2e4aa795 authored by Hans Muller's avatar Hans Muller

FlexibleSpaceBar should not include transparent widgets (#3527)

parent b1e684ea
......@@ -80,12 +80,14 @@ class _FlexibleSpaceBarState extends State<FlexibleSpaceBar> {
curve: new Interval(math.max(0.0, fadeStart), math.min(fadeEnd, 1.0))
);
final double parallax = new Tween<double>(begin: 0.0, end: appBarHeight / 4.0).evaluate(_scaffoldAnimation);
final double opacity = new Tween<double>(begin: 1.0, end: 0.0).evaluate(opacityCurve);
if (opacity > 0.0) {
children.add(new Positioned(
top: -parallax,
left: 0.0,
right: 0.0,
child: new Opacity(
opacity: new Tween<double>(begin: 1.0, end: 0.0).evaluate(opacityCurve),
opacity: opacity,
child: new SizedBox(
height: appBarHeight + statusBarHeight,
child: config.background
......@@ -93,6 +95,7 @@ class _FlexibleSpaceBarState extends State<FlexibleSpaceBar> {
)
));
}
}
// title
if (config.title != null) {
......@@ -102,9 +105,11 @@ class _FlexibleSpaceBarState extends State<FlexibleSpaceBar> {
parent: _scaffoldAnimation,
curve: new Interval(fadeStart, fadeEnd)
);
final int alpha = new Tween<double>(begin: 255.0, end: 0.0).evaluate(opacityCurve).toInt();
if (alpha > 0) {
TextStyle titleStyle = Theme.of(context).primaryTextTheme.title;
titleStyle = titleStyle.copyWith(
color: titleStyle.color.withAlpha(new Tween<double>(begin: 255.0, end: 0.0).evaluate(opacityCurve).toInt())
color: titleStyle.color.withAlpha(alpha)
);
final double yAlignStart = 1.0;
final double yAlignEnd = (statusBarHeight + kToolBarHeight / 2.0) / toolBarHeight;
......@@ -131,6 +136,7 @@ class _FlexibleSpaceBarState extends State<FlexibleSpaceBar> {
)
));
}
}
return new ClipRect(child: new Stack(children: children));
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment