@@ -844,5 +844,72 @@ void main() {
844
844
845
845
expect (find.text ('Page 1' ), findsOneWidget);
846
846
});
847
+
848
+ testWidgets ('Sheet should not block nested scroll' , (WidgetTester tester) async {
849
+ final GlobalKey homeKey = GlobalKey ();
850
+
851
+ Widget sheetScaffoldContent (BuildContext context) {
852
+ return ListView (
853
+ children: const < Widget > [
854
+ Text ('Top of Scroll' ),
855
+ SizedBox (width: double .infinity, height: 100 ),
856
+ Text ('Middle of Scroll' ),
857
+ SizedBox (width: double .infinity, height: 100 ),
858
+ ],
859
+ );
860
+ }
861
+
862
+ await tester.pumpWidget (
863
+ CupertinoApp (
864
+ home: CupertinoPageScaffold (
865
+ key: homeKey,
866
+ child: Center (
867
+ child: Column (
868
+ children: < Widget > [
869
+ const Text ('Page 1' ),
870
+ CupertinoButton (
871
+ onPressed: () {
872
+ showCupertinoSheet <void >(
873
+ context: homeKey.currentContext! ,
874
+ pageBuilder: (BuildContext context) {
875
+ return CupertinoPageScaffold (child: sheetScaffoldContent (context));
876
+ },
877
+ );
878
+ },
879
+ child: const Text ('Push Page 2' ),
880
+ ),
881
+ ],
882
+ ),
883
+ ),
884
+ ),
885
+ ),
886
+ );
887
+
888
+ await tester.tap (find.text ('Push Page 2' ));
889
+ await tester.pumpAndSettle ();
890
+
891
+ expect (find.text ('Top of Scroll' ), findsOneWidget);
892
+ final double startPosition = tester.getTopLeft (find.text ('Middle of Scroll' )).dy;
893
+
894
+ final TestGesture gesture = await tester.createGesture ();
895
+
896
+ await gesture.down (const Offset (100 , 100 ));
897
+
898
+ // Need 2 events to form a valid drag.
899
+ await tester.pump (const Duration (milliseconds: 100 ));
900
+ await gesture.moveTo (const Offset (100 , 80 ), timeStamp: const Duration (milliseconds: 100 ));
901
+ await tester.pump (const Duration (milliseconds: 200 ));
902
+ await gesture.moveTo (const Offset (100 , 50 ), timeStamp: const Duration (milliseconds: 200 ));
903
+
904
+ await tester.pumpAndSettle ();
905
+
906
+ final double endPosition = tester.getTopLeft (find.text ('Middle of Scroll' )).dy;
907
+
908
+ // Final position should be higher.
909
+ expect (endPosition, lessThan (startPosition));
910
+
911
+ await gesture.up ();
912
+ await tester.pumpAndSettle ();
913
+ });
847
914
});
848
915
}
0 commit comments