AdoptAWidget: Stepper (#70092)

* interactive dartpad sample added

* cleaner code

* removed extra spaces

* minor spaces added

* removed null returns
This commit is contained in:
Harsh Mehta 2020-11-11 23:33:06 +05:30 committed by GitHub
parent 6f70a29c36
commit 600c99213a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

51
packages/flutter/lib/src/material/stepper.dart Normal file → Executable file
View 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]