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> { ...@@ -80,12 +80,14 @@ class _FlexibleSpaceBarState extends State<FlexibleSpaceBar> {
curve: new Interval(math.max(0.0, fadeStart), math.min(fadeEnd, 1.0)) 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 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( children.add(new Positioned(
top: -parallax, top: -parallax,
left: 0.0, left: 0.0,
right: 0.0, right: 0.0,
child: new Opacity( child: new Opacity(
opacity: new Tween<double>(begin: 1.0, end: 0.0).evaluate(opacityCurve), opacity: opacity,
child: new SizedBox( child: new SizedBox(
height: appBarHeight + statusBarHeight, height: appBarHeight + statusBarHeight,
child: config.background child: config.background
...@@ -93,6 +95,7 @@ class _FlexibleSpaceBarState extends State<FlexibleSpaceBar> { ...@@ -93,6 +95,7 @@ class _FlexibleSpaceBarState extends State<FlexibleSpaceBar> {
) )
)); ));
} }
}
// title // title
if (config.title != null) { if (config.title != null) {
...@@ -102,9 +105,11 @@ class _FlexibleSpaceBarState extends State<FlexibleSpaceBar> { ...@@ -102,9 +105,11 @@ class _FlexibleSpaceBarState extends State<FlexibleSpaceBar> {
parent: _scaffoldAnimation, parent: _scaffoldAnimation,
curve: new Interval(fadeStart, fadeEnd) 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; TextStyle titleStyle = Theme.of(context).primaryTextTheme.title;
titleStyle = titleStyle.copyWith( 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 yAlignStart = 1.0;
final double yAlignEnd = (statusBarHeight + kToolBarHeight / 2.0) / toolBarHeight; final double yAlignEnd = (statusBarHeight + kToolBarHeight / 2.0) / toolBarHeight;
...@@ -131,6 +136,7 @@ class _FlexibleSpaceBarState extends State<FlexibleSpaceBar> { ...@@ -131,6 +136,7 @@ class _FlexibleSpaceBarState extends State<FlexibleSpaceBar> {
) )
)); ));
} }
}
return new ClipRect(child: new Stack(children: children)); 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