Unverified Commit 8ca8dbf0 authored by Michael Goderbauer's avatar Michael Goderbauer Committed by GitHub

Do not fade out text for pinned & floating AppBar (#25051)

parent 390ded93
......@@ -646,7 +646,7 @@ class _SliverAppBarDelegate extends SliverPersistentHeaderDelegate {
@override
Widget build(BuildContext context, double shrinkOffset, bool overlapsContent) {
final double visibleMainHeight = maxExtent - shrinkOffset - topPadding;
final double toolbarOpacity = pinned && !floating ? 1.0
final double toolbarOpacity = pinned ? 1.0
: ((visibleMainHeight - _bottomHeight) / kToolbarHeight).clamp(0.0, 1.0);
final Widget appBar = FlexibleSpaceBar.createSettings(
minExtent: minExtent,
......
......@@ -112,4 +112,40 @@ void main() {
expect(render.geometry.paintExtent, availableHeight);
expect(render.geometry.layoutExtent, 0.0);
});
testWidgets('Text does not dissapear when scrolled up', (WidgetTester tester) async {
// Regression test for https://github.com/flutter/flutter/issues/25000.
final ScrollController controller = ScrollController();
await tester.pumpWidget(
MaterialApp(
home: CustomScrollView(
controller: controller,
slivers: <Widget>[
const SliverAppBar(
pinned: true,
floating: true,
expandedHeight: 120.0,
title: Text('Hallo Welt!!1'),
),
SliverList(
delegate: SliverChildListDelegate(List<Widget>.generate(20, (int i) {
return Container(
child: Text('Tile $i'),
height: 100.0,
);
})),
)
],
),
),
);
final RenderParagraph render = tester.renderObject(find.text('Hallo Welt!!1'));
expect(render.text.style.color.opacity, 1.0);
controller.jumpTo(200.0);
await tester.pumpAndSettle();
expect(render.text.style.color.opacity, 1.0);
});
}
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