|
2 | 2 | // Use of this source code is governed by a BSD-style license that can be
|
3 | 3 | // found in the LICENSE file.
|
4 | 4 |
|
| 5 | +// This file is run as part of a reduced test set in CI on Mac and Windows |
| 6 | +// machines. |
| 7 | +@Tags(<String>['reduced-test-set']) |
| 8 | +library; |
| 9 | + |
5 | 10 | import 'package:flutter/material.dart';
|
6 | 11 | import 'package:flutter/rendering.dart';
|
7 | 12 | import 'package:flutter_test/flutter_test.dart';
|
@@ -861,4 +866,43 @@ void main() {
|
861 | 866 | });
|
862 | 867 | },
|
863 | 868 | );
|
| 869 | + |
| 870 | + testWidgets('TreeSliver and PinnedHeaderSliver can render correctly when used together.', ( |
| 871 | + WidgetTester tester, |
| 872 | + ) async { |
| 873 | + const ValueKey<String> key = ValueKey<String>('sliver_tree_pined_header'); |
| 874 | + await tester.pumpWidget( |
| 875 | + Directionality( |
| 876 | + textDirection: TextDirection.ltr, |
| 877 | + child: Align( |
| 878 | + alignment: Alignment.topLeft, |
| 879 | + child: RepaintBoundary( |
| 880 | + key: key, |
| 881 | + child: SizedBox( |
| 882 | + height: 20, |
| 883 | + width: 20, |
| 884 | + child: CustomScrollView( |
| 885 | + slivers: <Widget>[ |
| 886 | + const PinnedHeaderSliver(child: SizedBox(height: 10)), |
| 887 | + TreeSliver<Object>( |
| 888 | + tree: <TreeSliverNode<Object>>[TreeSliverNode<Object>(Object())], |
| 889 | + treeRowExtentBuilder: (_, _) => 10, |
| 890 | + treeNodeBuilder: ( |
| 891 | + BuildContext context, |
| 892 | + TreeSliverNode<Object?> node, |
| 893 | + AnimationStyle animationStyle, |
| 894 | + ) { |
| 895 | + return const ColoredBox(color: Colors.red); |
| 896 | + }, |
| 897 | + ), |
| 898 | + ], |
| 899 | + ), |
| 900 | + ), |
| 901 | + ), |
| 902 | + ), |
| 903 | + ), |
| 904 | + ); |
| 905 | + await expectLater(find.byKey(key), matchesGoldenFile('sliver_tree.pined_header.0.png')); |
| 906 | + expect(tester.getTopLeft(find.byType(ColoredBox)), const Offset(0, 10)); |
| 907 | + }); |
864 | 908 | }
|
0 commit comments