Skip to content

Instantly share code, notes, and snippets.

@horgag
Last active March 30, 2020 19:12
Show Gist options
  • Select an option

  • Save horgag/8ed4c8308a43078168565fff4e6298fa to your computer and use it in GitHub Desktop.

Select an option

Save horgag/8ed4c8308a43078168565fff4e6298fa to your computer and use it in GitHub Desktop.
import 'package:flutter/material.dart';
void main(){
runApp(MyApp());
}
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => new _MyAppState();
}
class _MyAppState extends State<MyApp> {
int _currentStep = 0;
@override
Widget build(BuildContext context) {
return new MaterialApp(
title: 'App',
home: new Scaffold(
appBar: new AppBar(title: new Text('App')),
body: new Stepper(
currentStep: _currentStep,
onStepTapped: (int step) => setState(() => _currentStep = step),
onStepContinue: _currentStep < 6 ? () => setState(() => _currentStep += 1) : null,
onStepCancel: _currentStep > 0 ? () => setState(() => _currentStep -= 1) : null,
steps: <Step>[
new Step(
title: new Text('Gender'),
content: new Text('This is the first step.'),
isActive: _currentStep >= 0,
state: _currentStep >= 0 ? StepState.complete : StepState.disabled,
),
new Step(
title: new Text('Year of birth'),
content: new Text('This is the second step.'),
isActive: _currentStep >= 0,
state: _currentStep >= 1 ? StepState.complete : StepState.disabled,
),
new Step(
title: new Text('Education'),
content: new Text('This is the third step.'),
isActive: _currentStep >= 0,
state: _currentStep >= 2 ? StepState.complete : StepState.disabled,
),
new Step(
title: new Text('Marital Status'),
content: new Text('This is the third step.'),
isActive: _currentStep >= 0,
state: _currentStep >= 3 ? StepState.complete : StepState.disabled,
),
new Step(
title: new Text('Living situation'),
content: new Text('This is the third step.'),
isActive: _currentStep >= 0,
state: _currentStep >= 4 ? StepState.complete : StepState.disabled,
),
new Step(
title: new Text('Employment status'),
content: new Text('This is the last step.'),
isActive: _currentStep >= 0,
state: _currentStep >= 5 ? StepState.complete : StepState.disabled,
),
],
),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment