Unverified Commit 6204eb64 authored by Tom Robinson's avatar Tom Robinson Committed by GitHub

Change SliverGeometry.maxScrollObstructionExtent for...

Change SliverGeometry.maxScrollObstructionExtent for RenderSliverFloatingPersistentHeader to match docs (#39263)


RenderSliverFloatingPersistentHeader does not pin to the leading edge of the viewport so the value of maxScrollObstructionExtent in it's SliverGeometry should be 0 per the docs at https://api.flutter.dev/flutter/rendering/SliverGeometry/maxScrollObstructionExtent.html.
parent a3ba62dc
......@@ -415,7 +415,6 @@ abstract class RenderSliverFloatingPersistentHeader extends RenderSliverPersiste
paintExtent: paintExtent.clamp(0.0, constraints.remainingPaintExtent),
layoutExtent: layoutExtent.clamp(0.0, constraints.remainingPaintExtent),
maxPaintExtent: maxExtent,
maxScrollObstructionExtent: maxExtent,
hasVisualOverflow: true, // Conservatively say we do have overflow to avoid complexity.
);
return math.min(0.0, paintExtent - childExtent);
......
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter/rendering.dart';
import '../flutter_test_alternative.dart';
import 'rendering_tester.dart';
void main() {
// Regression test for https://github.com/flutter/flutter/issues/35426.
test('RenderSliverFloatingPersistentHeader maxScrollObstructionExtent is 0', () {
final TestRenderSliverFloatingPersistentHeader header = TestRenderSliverFloatingPersistentHeader(child: RenderSizedBox(const Size(400.0, 100.0)));
final RenderViewport root = RenderViewport(
axisDirection: AxisDirection.down,
crossAxisDirection: AxisDirection.right,
offset: ViewportOffset.zero(),
cacheExtent: 0,
children: <RenderSliver>[
header,
],
);
layout(root);
expect(header.geometry.maxScrollObstructionExtent, 0);
});
}
class TestRenderSliverFloatingPersistentHeader extends RenderSliverFloatingPersistentHeader {
TestRenderSliverFloatingPersistentHeader({
RenderBox child,
}) : super(child: child);
@override
double get maxExtent => 200;
@override
double get minExtent => 100;
}
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