如何在Flutter中创建计时器选择器? [英] How to create timer picker in flutter?
本文介绍了如何在Flutter中创建计时器选择器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以像在iOS中那样创建持续时间计时器?
Is it possible to create duration timer, like in iOS in flutter?
示例
推荐答案
有一个 CupertinoTimePicker 小部件可以做到这一点
There is a CupertinoTimePicker widget that does just this
检查一下
class Cupert extends StatefulWidget {
@override
_CupertState createState() => _CupertState();
}
class _CupertState extends State<Cupert> {
var value = "";
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
body: SafeArea(
child: Column(
children: <Widget>[
Expanded(
child: Center(
child: Text(
"$value"
),
),
),
CupertinoTimerPicker(
mode: CupertinoTimerPickerMode.hm,
onTimerDurationChanged: (value){
setState(() {
this.value = value.toString();
});
},
),
],
),
),
);
}
}
这篇关于如何在Flutter中创建计时器选择器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文