import 'package:flutter/material.dart';
void main() =>
runApp(new MaterialApp(title: "Simple Material App", home: new MyHome()));
class MyHome extends StatefulWidget {
@override
State<StatefulWidget> createState() => MyHomeState();
}
class MyHomeState extends State<MyHome> {
int current_step = 0;
List<Step> my_steps = [
new Step(
title: new Text("Step 1"), content: new Text("Hello"), isActive: true),
new Step(
title: new Text("Step 2"), content: new Text("World"), isActive: true),
new Step(
title: new Text("Step 3"),
content: new Text("Hello World"),
isActive: true)
];
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar:
new AppBar(title: new Center(child: new Text("Simple Material App"))),
body: new Container(
child: new Stepper(
currentStep: this.current_step,
steps: my_steps,
type: StepperType.vertical,
onStepTapped: (step) {
setState(() {
current_step = step;
});
},
onStepCancel: () {
setState(() {
if (current_step > 0) {
current_step = current_step - 1;
} else {
current_step = 0;
}
});
},
onStepContinue: () {
setState(() {
if (current_step < my_steps.length - 1) {
current_step = current_step + 1;
} else {
current_step = 0;
}
});
},
),
),
);
}
}
Flutter Stepper
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
推荐阅读更多精彩内容
- 不知不觉已经到了第7篇,然而很多萌新玩家可能还是不知道如何堆砌控件,像用CSS一样搭出漂亮的APP界面,我也一样,...
- flutter插件编译报错: CocoaPods 1.5.2环境 运行app时报Flutter/Flutter.h...
- Flutter快速上手 开发环境配置 Windows: https://flutter.io/setup-wind...
- 本文主要尝试解决如下几个问题: 如何在在已经项目加入Flutter混合跳转混合栈问题混合栈数据问题 跳转黑屏是因为...
- 前一阵子,flutter beta版本的发布,应该是又要引起前端的技术的大洗牌了,按照技术达人狐神大哥的话来说:"...