@@ -1720,6 +1720,91 @@ testWidgets('Stepper custom indexed controls test', (WidgetTester tester) async
17201720 ));
17211721 expect (lastConnector.width, equals (0.0 ));
17221722 });
1723+
1724+ // This is a regression test for https://github.com/flutter/flutter/issues/66007.
1725+ testWidgets ('Default Stepper clipBehavior' , (WidgetTester tester) async {
1726+ Widget buildStepper ({ required StepperType type }) {
1727+ return MaterialApp (
1728+ home: Scaffold (
1729+ body: Center (
1730+ child: Stepper (
1731+ type: type,
1732+ steps: const < Step > [
1733+ Step (
1734+ title: Text ('step1' ),
1735+ content: Text ('step1 content' ),
1736+ ),
1737+ Step (
1738+ title: Text ('step2' ),
1739+ content: Text ('step2 content' ),
1740+ ),
1741+ ],
1742+ ),
1743+ ),
1744+ ),
1745+ );
1746+ }
1747+
1748+ ClipRect getContentClipRect () {
1749+ return tester.widget <ClipRect >(find.ancestor (
1750+ of: find.text ('step1 content' ),
1751+ matching: find.byType (ClipRect ),
1752+ ).first);
1753+ }
1754+
1755+ // Test vertical stepper with default clipBehavior.
1756+ await tester.pumpWidget (buildStepper (type: StepperType .vertical));
1757+
1758+ expect (getContentClipRect ().clipBehavior, equals (Clip .none));
1759+
1760+ // Test horizontal stepper with default clipBehavior.
1761+ await tester.pumpWidget (buildStepper (type: StepperType .horizontal));
1762+
1763+ expect (getContentClipRect ().clipBehavior, equals (Clip .none));
1764+ });
1765+
1766+ // This is a regression test for https://github.com/flutter/flutter/issues/66007.
1767+ testWidgets ('Stepper steps can be clipped' , (WidgetTester tester) async {
1768+ Widget buildStepper ({ required StepperType type, required Clip clipBehavior }) {
1769+ return MaterialApp (
1770+ home: Scaffold (
1771+ body: Center (
1772+ child: Stepper (
1773+ clipBehavior: clipBehavior,
1774+ type: type,
1775+ steps: const < Step > [
1776+ Step (
1777+ title: Text ('step1' ),
1778+ content: Text ('step1 content' ),
1779+ ),
1780+ Step (
1781+ title: Text ('step2' ),
1782+ content: Text ('step2 content' ),
1783+ ),
1784+ ],
1785+ ),
1786+ ),
1787+ ),
1788+ );
1789+ }
1790+
1791+ ClipRect getContentClipRect () {
1792+ return tester.widget <ClipRect >(find.ancestor (
1793+ of: find.text ('step1 content' ),
1794+ matching: find.byType (ClipRect ),
1795+ ).first);
1796+ }
1797+
1798+ // Test vertical stepper with clipBehavior set to Clip.hardEdge.
1799+ await tester.pumpWidget (buildStepper (type: StepperType .vertical, clipBehavior: Clip .hardEdge));
1800+
1801+ expect (getContentClipRect ().clipBehavior, equals (Clip .hardEdge));
1802+
1803+ // Test horizontal stepper with clipBehavior set to Clip.hardEdge.
1804+ await tester.pumpWidget (buildStepper (type: StepperType .horizontal, clipBehavior: Clip .hardEdge));
1805+
1806+ expect (getContentClipRect ().clipBehavior, equals (Clip .hardEdge));
1807+ });
17231808}
17241809
17251810class _TappableColorWidget extends StatefulWidget {
0 commit comments