Unverified Commit b65a2351 authored by Nathan Walker's avatar Nathan Walker Committed by GitHub

SliverAppBar with ShrinkWrap Patch (#73195)

parent 84ddffb3
......@@ -2009,19 +2009,19 @@ class RenderShrinkWrappingViewport extends RenderViewportBase<SliverLogicalConta
@override
Iterable<RenderSliver> get childrenInPaintOrder sync* {
RenderSliver? child = firstChild;
RenderSliver? child = lastChild;
while (child != null) {
yield child;
child = childAfter(child);
child = childBefore(child);
}
}
@override
Iterable<RenderSliver> get childrenInHitTestOrder sync* {
RenderSliver? child = lastChild;
RenderSliver? child = firstChild;
while (child != null) {
yield child;
child = childBefore(child);
child = childAfter(child);
}
}
}
......@@ -1746,6 +1746,49 @@ void main() {
);
});
group('Viewport childrenInPaintOrder control test', () {
test('RenderViewport', () async {
final List<RenderSliver> children = <RenderSliver>[
RenderSliverToBoxAdapter(),
RenderSliverToBoxAdapter(),
RenderSliverToBoxAdapter(),
];
final RenderViewport renderViewport = RenderViewport(
crossAxisDirection: AxisDirection.right,
offset: ViewportOffset.zero(),
children: children,
);
// Children should be painted in reverse order to the list given
expect(renderViewport.childrenInPaintOrder, equals(children.reversed));
// childrenInPaintOrder should be reverse of childrenInHitTestOrder
expect(renderViewport.childrenInPaintOrder,
equals(renderViewport.childrenInHitTestOrder.toList().reversed));
});
test('RenderShrinkWrappingViewport', () async {
final List<RenderSliver> children = <RenderSliver>[
RenderSliverToBoxAdapter(),
RenderSliverToBoxAdapter(),
RenderSliverToBoxAdapter(),
];
final RenderShrinkWrappingViewport renderViewport =
RenderShrinkWrappingViewport(
crossAxisDirection: AxisDirection.right,
offset: ViewportOffset.zero(),
children: children,
);
// Children should be painted in reverse order to the list given
expect(renderViewport.childrenInPaintOrder, equals(children.reversed));
// childrenInPaintOrder should be reverse of childrenInHitTestOrder
expect(renderViewport.childrenInPaintOrder,
equals(renderViewport.childrenInHitTestOrder.toList().reversed));
});
});
testWidgets('Handles infinite constraints when TargetPlatform is iOS or macOS', (WidgetTester tester) async {
// regression test for https://github.com/flutter/flutter/issues/45866
await tester.pumpWidget(
......
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