Make sure that a Stepper doesn't crash in 0x0 environment (#178068)

This is my attempt to handle
https://github.com/flutter/flutter/issues/6537 for the Stepper widget.

---------

Co-authored-by: Victor Sanni <victorsanniay@gmail.com>
Co-authored-by: Tong Mu <dkwingsmt@users.noreply.github.com>
This commit is contained in:
Ahmed Mohamed Sameh 2025-11-22 03:10:00 +02:00 committed by GitHub
parent 554dfee06f
commit f64ddb8cb8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1683,6 +1683,29 @@ void main() {
expect(colors.first, equals(activeColor));
expect(colors.last, equals(activeColor));
});
testWidgets('Stepper does not crash at zero area', (WidgetTester tester) async {
for (final StepperType type in StepperType.values) {
await tester.pumpWidget(
MaterialApp(
home: Scaffold(
body: Center(
child: SizedBox.shrink(
child: Stepper(
type: type,
steps: const <Step>[
Step(title: Text('X'), content: Text('X')),
Step(title: Text('Y'), content: Text('Y')),
],
),
),
),
),
),
);
expect(tester.getSize(find.byType(Stepper)), Size.zero);
}
});
}
class _TappableColorWidget extends StatefulWidget {