Unverified Commit fdc3fb3f authored by Abhishek Ghaskata's avatar Abhishek Ghaskata Committed by GitHub

Elevation for Stepper(horizontally) (#83177)

parent ec5cfc00
...@@ -185,6 +185,7 @@ class Stepper extends StatefulWidget { ...@@ -185,6 +185,7 @@ class Stepper extends StatefulWidget {
this.onStepContinue, this.onStepContinue,
this.onStepCancel, this.onStepCancel,
this.controlsBuilder, this.controlsBuilder,
this.elevation,
}) : assert(steps != null), }) : assert(steps != null),
assert(type != null), assert(type != null),
assert(currentStep != null), assert(currentStep != null),
...@@ -280,6 +281,9 @@ class Stepper extends StatefulWidget { ...@@ -280,6 +281,9 @@ class Stepper extends StatefulWidget {
/// {@end-tool} /// {@end-tool}
final ControlsWidgetBuilder? controlsBuilder; final ControlsWidgetBuilder? controlsBuilder;
/// The elevation of this stepper's [Material] when [type] is [StepperType.horizontal].
final double? elevation;
@override @override
State<Stepper> createState() => _StepperState(); State<Stepper> createState() => _StepperState();
} }
...@@ -697,7 +701,7 @@ class _StepperState extends State<Stepper> with TickerProviderStateMixin { ...@@ -697,7 +701,7 @@ class _StepperState extends State<Stepper> with TickerProviderStateMixin {
return Column( return Column(
children: <Widget>[ children: <Widget>[
Material( Material(
elevation: 2.0, elevation: widget.elevation ?? 2,
child: Container( child: Container(
margin: const EdgeInsets.symmetric(horizontal: 24.0), margin: const EdgeInsets.symmetric(horizontal: 24.0),
child: Row( child: Row(
......
...@@ -887,4 +887,70 @@ void main() { ...@@ -887,4 +887,70 @@ void main() {
await tester.pumpAndSettle(); await tester.pumpAndSettle();
expect(circleFillColor(), dark.background); 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);
});
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment