Elevation for Stepper(horizontally) (#83177)
diff --git a/packages/flutter/lib/src/material/stepper.dart b/packages/flutter/lib/src/material/stepper.dart index d862bad..9f93232 100755 --- a/packages/flutter/lib/src/material/stepper.dart +++ b/packages/flutter/lib/src/material/stepper.dart
@@ -185,6 +185,7 @@ this.onStepContinue, this.onStepCancel, this.controlsBuilder, + this.elevation, }) : assert(steps != null), assert(type != null), assert(currentStep != null), @@ -280,6 +281,9 @@ /// {@end-tool} final ControlsWidgetBuilder? controlsBuilder; + /// The elevation of this stepper's [Material] when [type] is [StepperType.horizontal]. + final double? elevation; + @override State<Stepper> createState() => _StepperState(); } @@ -697,7 +701,7 @@ return Column( children: <Widget>[ Material( - elevation: 2.0, + elevation: widget.elevation ?? 2, child: Container( margin: const EdgeInsets.symmetric(horizontal: 24.0), child: Row(
diff --git a/packages/flutter/test/material/stepper_test.dart b/packages/flutter/test/material/stepper_test.dart index 4fc7236..8c0d537 100644 --- a/packages/flutter/test/material/stepper_test.dart +++ b/packages/flutter/test/material/stepper_test.dart
@@ -887,4 +887,70 @@ await tester.pumpAndSettle(); expect(circleFillColor(), dark.background); }); + + testWidgets('Stepper custom elevation', (WidgetTester tester) async { + const double elevation = 4.0; + + await tester.pumpWidget( + MaterialApp( + home: Material( + child: SizedBox( + width: 200, + height: 75, + child: Stepper( + type: StepperType.horizontal, + elevation: elevation, + steps: const <Step>[ + Step( + title: Text('Regular title'), + content: Text('Text content'), + ), + ], + ), + ), + ), + ), + ); + + final Material material = tester.firstWidget<Material>( + find.descendant( + of: find.byType(Stepper), + matching: find.byType(Material), + ), + ); + + expect(material.elevation, elevation); + }); + + testWidgets('Stepper with default elevation', (WidgetTester tester) async { + + await tester.pumpWidget( + MaterialApp( + home: Material( + child: SizedBox( + width: 200, + height: 75, + child: Stepper( + type: StepperType.horizontal, + steps: const <Step>[ + Step( + title: Text('Regular title'), + content: Text('Text content') + ), + ], + ), + ), + ), + ), + ); + + final Material material = tester.firstWidget<Material>( + find.descendant( + of: find.byType(Stepper), + matching: find.byType(Material), + ), + ); + + expect(material.elevation, 2.0); + }); }