Unverified Commit 3af97d22 authored by chunhtai's avatar chunhtai Committed by GitHub

Fix the flexible space bar to still create a rendering object even if… (#62690)

parent 6ab558d8
...@@ -303,42 +303,42 @@ class _FlexibleSpaceBarState extends State<FlexibleSpaceBar> { ...@@ -303,42 +303,42 @@ class _FlexibleSpaceBarState extends State<FlexibleSpaceBar> {
const double fadeEnd = 1.0; const double fadeEnd = 1.0;
assert(fadeStart <= fadeEnd); assert(fadeStart <= fadeEnd);
final double opacity = 1.0 - Interval(fadeStart, fadeEnd).transform(t); final double opacity = 1.0 - Interval(fadeStart, fadeEnd).transform(t);
if (opacity > 0.0) { double height = settings.maxExtent;
double height = settings.maxExtent;
// StretchMode.zoomBackground
if (widget.stretchModes.contains(StretchMode.zoomBackground) &&
constraints.maxHeight > height) {
height = constraints.maxHeight;
}
children.add(Positioned(
top: _getCollapsePadding(t, settings),
left: 0.0,
right: 0.0,
height: height,
child: Opacity(
opacity: opacity,
child: widget.background,
),
));
// StretchMode.blurBackground // StretchMode.zoomBackground
if (widget.stretchModes.contains(StretchMode.blurBackground) && if (widget.stretchModes.contains(StretchMode.zoomBackground) &&
constraints.maxHeight > settings.maxExtent) { constraints.maxHeight > height) {
final double blurAmount = (constraints.maxHeight - settings.maxExtent) / 10; height = constraints.maxHeight;
children.add(Positioned.fill( }
child: BackdropFilter( children.add(Positioned(
child: Container( top: _getCollapsePadding(t, settings),
color: Colors.transparent, left: 0.0,
), right: 0.0,
filter: ui.ImageFilter.blur( height: height,
sigmaX: blurAmount, child: Opacity(
sigmaY: blurAmount, // IOS is relying on this semantics node to correctly traverse
) // through the app bar when it is collapsed.
alwaysIncludeSemantics: true,
opacity: opacity,
child: widget.background,
),
));
// StretchMode.blurBackground
if (widget.stretchModes.contains(StretchMode.blurBackground) &&
constraints.maxHeight > settings.maxExtent) {
final double blurAmount = (constraints.maxHeight - settings.maxExtent) / 10;
children.add(Positioned.fill(
child: BackdropFilter(
child: Container(
color: Colors.transparent,
),
filter: ui.ImageFilter.blur(
sigmaX: blurAmount,
sigmaY: blurAmount,
) )
)); )
} ));
} }
} }
......
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