@@ -921,6 +921,36 @@ void main() {
921921 mainAxisPositions.clear ();
922922 crossAxisPositions.clear ();
923923 });
924+
925+ test ('addWithAxisOffset with non zero paintOffset' , () {
926+ final SliverHitTestResult result = SliverHitTestResult ();
927+ double recordedMainAxisPosition;
928+ double recordedCrossAxisPosition;
929+ final HitTestEntry entry = HitTestEntry (_DummyHitTestTarget ());
930+ const Offset paintOffset = Offset (7 , 11 );
931+
932+ final bool isHit = result.addWithAxisOffset (
933+ paintOffset: paintOffset,
934+ mainAxisOffset: 5.0 ,
935+ crossAxisOffset: 6.0 ,
936+ mainAxisPosition: 10.0 ,
937+ crossAxisPosition: 20.0 ,
938+ hitTest: (SliverHitTestResult result, { double mainAxisPosition, double crossAxisPosition }) {
939+ expect (result, isNotNull);
940+ recordedMainAxisPosition = mainAxisPosition;
941+ recordedCrossAxisPosition = crossAxisPosition;
942+ result.add (entry);
943+ return true ;
944+ },
945+ );
946+ expect (isHit, isTrue);
947+ expect (recordedMainAxisPosition, 10.0 - 5.0 );
948+ expect (recordedCrossAxisPosition, 20.0 - 6.0 );
949+ expect (
950+ entry.transform..translate (paintOffset.dx, paintOffset.dy),
951+ Matrix4 .identity (),
952+ );
953+ });
924954 });
925955
926956 test ('SliverConstraints check for NaN on all double properties' , () {
0 commit comments