This commit is contained in:
parent
254e83af9d
commit
f789acae41
@ -305,11 +305,7 @@ class _FlexibleSpaceBarState extends State<FlexibleSpaceBar> {
|
|||||||
final double fadeStart = math.max(0.0, 1.0 - kToolbarHeight / deltaExtent);
|
final double fadeStart = math.max(0.0, 1.0 - kToolbarHeight / deltaExtent);
|
||||||
const double fadeEnd = 1.0;
|
const double fadeEnd = 1.0;
|
||||||
assert(fadeStart <= fadeEnd);
|
assert(fadeStart <= fadeEnd);
|
||||||
// If the min and max extent are the same, the app bar cannot collapse
|
final double opacity = 1.0 - Interval(fadeStart, fadeEnd).transform(t);
|
||||||
// and the content should be visible, so opacity = 1.
|
|
||||||
final double opacity = settings.maxExtent == settings.minExtent
|
|
||||||
? 1.0
|
|
||||||
: 1.0 - Interval(fadeStart, fadeEnd).transform(t);
|
|
||||||
double height = settings.maxExtent;
|
double height = settings.maxExtent;
|
||||||
|
|
||||||
// StretchMode.zoomBackground
|
// StretchMode.zoomBackground
|
||||||
|
@ -121,39 +121,7 @@ void main() {
|
|||||||
expect(clipRect.size.height, minExtent);
|
expect(clipRect.size.height, minExtent);
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('FlexibleSpaceBar.background is visible when using height other than kToolbarHeight', (WidgetTester tester) async {
|
testWidgets('Collpased FlexibleSpaceBar has correct semantics', (WidgetTester tester) async {
|
||||||
// Regression test for https://github.com/flutter/flutter/issues/80451
|
|
||||||
await tester.pumpWidget(
|
|
||||||
MaterialApp(
|
|
||||||
home: Scaffold(
|
|
||||||
appBar: AppBar(
|
|
||||||
toolbarHeight: 300,
|
|
||||||
flexibleSpace: const FlexibleSpaceBar(
|
|
||||||
title: Text('Title'),
|
|
||||||
background: Text('Background'),
|
|
||||||
collapseMode: CollapseMode.pin,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
body: CustomScrollView(
|
|
||||||
primary: true,
|
|
||||||
slivers: <Widget>[
|
|
||||||
SliverToBoxAdapter(
|
|
||||||
child: Container(
|
|
||||||
height: 1200.0,
|
|
||||||
color: Colors.orange[400],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
final Opacity backgroundOpacity = tester.firstWidget(find.byType(Opacity));
|
|
||||||
expect(backgroundOpacity.opacity, 1.0);
|
|
||||||
});
|
|
||||||
|
|
||||||
testWidgets('Collapsed FlexibleSpaceBar has correct semantics', (WidgetTester tester) async {
|
|
||||||
final SemanticsTester semantics = SemanticsTester(tester);
|
final SemanticsTester semantics = SemanticsTester(tester);
|
||||||
const double expandedHeight = 200;
|
const double expandedHeight = 200;
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user