@@ -787,6 +787,101 @@ void main() {
787787
788788 expect (tester.getBottomRight (find.byType (Container )), target.bottomRight (tester.getTopLeft (find.byType (Container ))));
789789 });
790+
791+ testWidgets (
792+ 'Transform.flip does flip child correctly' ,
793+ (WidgetTester tester) async {
794+ const Offset topRight = Offset (60 , 20 );
795+ const Offset bottomLeft = Offset (20 , 60 );
796+ const Offset bottomRight = Offset (60 , 60 );
797+
798+ bool tappedRed = false ;
799+
800+ const Widget square = SizedBox .square (dimension: 40 );
801+ final Widget child = Column (
802+ mainAxisSize: MainAxisSize .min,
803+ children: < Widget > [
804+ Row (mainAxisSize: MainAxisSize .min, children: < Widget > [
805+ GestureDetector (
806+ onTap: () => tappedRed = true ,
807+ child: const ColoredBox (color: Color (0xffff0000 ), child: square),
808+ ),
809+ const ColoredBox (color: Color (0xff00ff00 ), child: square),
810+ ]),
811+ Row (mainAxisSize: MainAxisSize .min, children: const < Widget > [
812+ ColoredBox (color: Color (0xff0000ff ), child: square),
813+ ColoredBox (color: Color (0xffeeff00 ), child: square),
814+ ]),
815+ ],
816+ );
817+
818+ await tester.pumpWidget (
819+ Directionality (
820+ textDirection: TextDirection .ltr,
821+ child: Align (
822+ alignment: Alignment .topLeft,
823+ child: Transform .flip (
824+ flipX: true ,
825+ child: child,
826+ ),
827+ ),
828+ ),
829+ );
830+
831+ await tester.pumpAndSettle ();
832+
833+ await tester.tapAt (topRight);
834+
835+ expect (tappedRed, isTrue, reason: 'Transform.flip cannot flipX' );
836+
837+ tappedRed = false ;
838+
839+ await tester.pumpWidget (
840+ Directionality (
841+ textDirection: TextDirection .ltr,
842+ child: Align (
843+ alignment: Alignment .topLeft,
844+ child: Transform .flip (
845+ flipY: true ,
846+ child: child,
847+ ),
848+ ),
849+ ),
850+ );
851+
852+ await tester.pumpAndSettle ();
853+
854+ await tester.tapAt (bottomLeft);
855+
856+ expect (tappedRed, isTrue, reason: 'Transform.flip cannot flipY' );
857+
858+ tappedRed = false ;
859+
860+ await tester.pumpWidget (
861+ Directionality (
862+ textDirection: TextDirection .ltr,
863+ child: Align (
864+ alignment: Alignment .topLeft,
865+ child: Transform .flip (
866+ flipX: true ,
867+ flipY: true ,
868+ child: child,
869+ ),
870+ ),
871+ ),
872+ );
873+
874+ await tester.pumpAndSettle ();
875+
876+ await tester.tapAt (bottomRight);
877+
878+ expect (
879+ tappedRed,
880+ isTrue,
881+ reason: 'Transform.flip cannot flipX and flipY together' ,
882+ );
883+ },
884+ );
790885}
791886
792887class TestRectPainter extends CustomPainter {
0 commit comments