Unverified Commit 49bf933b authored by Abhishek Ghaskata's avatar Abhishek Ghaskata Committed by GitHub

add margin to vertical stepper (#86067)

* add marging to vertical stepper

* Remove tralling spaces

* Update docstring
parent 1a5692b7
...@@ -186,6 +186,7 @@ class Stepper extends StatefulWidget { ...@@ -186,6 +186,7 @@ class Stepper extends StatefulWidget {
this.onStepCancel, this.onStepCancel,
this.controlsBuilder, this.controlsBuilder,
this.elevation, this.elevation,
this.margin,
}) : assert(steps != null), }) : assert(steps != null),
assert(type != null), assert(type != null),
assert(currentStep != null), assert(currentStep != null),
...@@ -284,6 +285,9 @@ class Stepper extends StatefulWidget { ...@@ -284,6 +285,9 @@ class Stepper extends StatefulWidget {
/// The elevation of this stepper's [Material] when [type] is [StepperType.horizontal]. /// The elevation of this stepper's [Material] when [type] is [StepperType.horizontal].
final double? elevation; final double? elevation;
/// custom margin on vertical stepper.
final EdgeInsetsGeometry? margin;
@override @override
State<Stepper> createState() => _StepperState(); State<Stepper> createState() => _StepperState();
} }
...@@ -611,7 +615,7 @@ class _StepperState extends State<Stepper> with TickerProviderStateMixin { ...@@ -611,7 +615,7 @@ class _StepperState extends State<Stepper> with TickerProviderStateMixin {
AnimatedCrossFade( AnimatedCrossFade(
firstChild: Container(height: 0.0), firstChild: Container(height: 0.0),
secondChild: Container( secondChild: Container(
margin: const EdgeInsetsDirectional.only( margin: widget.margin ?? const EdgeInsetsDirectional.only(
start: 60.0, start: 60.0,
end: 24.0, end: 24.0,
bottom: 24.0, bottom: 24.0,
......
...@@ -952,5 +952,43 @@ void main() { ...@@ -952,5 +952,43 @@ void main() {
); );
expect(material.elevation, 2.0); expect(material.elevation, 2.0);
});
testWidgets('Stepper custom margin', (WidgetTester tester) async {
const EdgeInsetsGeometry margin = EdgeInsetsDirectional.only(
bottom: 20,
top: 20,
);
await tester.pumpWidget(
MaterialApp(
home: Material(
child: SizedBox(
width: 200,
height: 75,
child: Stepper(
margin: margin,
type: StepperType.vertical,
steps: const <Step>[
Step(
title: Text('Regular title'),
content: Text('Text content')
),
],
),
),
),
),
);
final Stepper material = tester.firstWidget<Stepper>(
find.descendant(
of: find.byType(Material),
matching: find.byType(Stepper),
),
);
expect(material.margin, equals(margin));
}); });
} }
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