AdoptAWidget: Stepper (#70092)
* interactive dartpad sample added * cleaner code * removed extra spaces * minor spaces added * removed null returns
This commit is contained in:
parent
6f70a29c36
commit
600c99213a
51
packages/flutter/lib/src/material/stepper.dart
Normal file → Executable file
51
packages/flutter/lib/src/material/stepper.dart
Normal file → Executable file
@ -122,6 +122,57 @@ class Step {
|
|||||||
/// to this widget based on some logic triggered by the three callbacks that it
|
/// to this widget based on some logic triggered by the three callbacks that it
|
||||||
/// provides.
|
/// provides.
|
||||||
///
|
///
|
||||||
|
/// {@tool sample --template=stateful_widget_scaffold_center}
|
||||||
|
///
|
||||||
|
/// ```dart
|
||||||
|
/// int _index = 0;
|
||||||
|
/// Widget build(BuildContext context) {
|
||||||
|
/// return Container(
|
||||||
|
/// height: 300,
|
||||||
|
/// width: 300,
|
||||||
|
/// child: Stepper(
|
||||||
|
/// currentStep: _index,
|
||||||
|
/// onStepCancel: () {
|
||||||
|
/// if (_index <= 0) {
|
||||||
|
/// return;
|
||||||
|
/// }
|
||||||
|
/// setState(() {
|
||||||
|
/// _index--;
|
||||||
|
/// });
|
||||||
|
/// },
|
||||||
|
/// onStepContinue: () {
|
||||||
|
/// if (_index >= 1) {
|
||||||
|
/// return;
|
||||||
|
/// }
|
||||||
|
/// setState(() {
|
||||||
|
/// _index++;
|
||||||
|
/// });
|
||||||
|
/// },
|
||||||
|
/// onStepTapped: (index) {
|
||||||
|
/// setState(() {
|
||||||
|
/// _index = index;
|
||||||
|
/// });
|
||||||
|
/// },
|
||||||
|
/// steps: [
|
||||||
|
/// Step(
|
||||||
|
/// title: Text("Step 1 title"),
|
||||||
|
/// content: Container(
|
||||||
|
/// alignment: Alignment.centerLeft,
|
||||||
|
/// child: Text("Content for Step 1")
|
||||||
|
/// ),
|
||||||
|
/// ),
|
||||||
|
/// Step(
|
||||||
|
/// title: Text("Step 2 title"),
|
||||||
|
/// content: Text("Content for Step 2"),
|
||||||
|
/// ),
|
||||||
|
/// ],
|
||||||
|
/// ),
|
||||||
|
/// );
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
///
|
||||||
|
/// {@end-tool}
|
||||||
|
///
|
||||||
/// See also:
|
/// See also:
|
||||||
///
|
///
|
||||||
/// * [Step]
|
/// * [Step]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user