在我的应用程序中,我正在创建需要添加 DOB 的注册页面。我想在其中添加日期选择器,但我没有得到正确的方法来做到这一点。
原文由 Code Hunter 发布,翻译遵循 CC BY-SA 4.0 许可协议
在我的应用程序中,我正在创建需要添加 DOB 的注册页面。我想在其中添加日期选择器,但我没有得到正确的方法来做到这一点。
原文由 Code Hunter 发布,翻译遵循 CC BY-SA 4.0 许可协议
DateTime _chosenDateTime;
// Show the modal that contains the CupertinoDatePicker
void _showDatePicker(context) {
// showCupertinoModalPopup is a built-in function of the cupertino library
showCupertinoModalPopup(
context: context,
builder: (_) => Container(
height: 500,
color: Color.fromARGB(255, 255, 255, 255),
child: Column(
children: [
Container(
height: 400,
child: CupertinoDatePicker(
initialDateTime: DateTime.now(),
onDateTimeChanged: (val) {
setState(() {
_chosenDateTime = val;
});
}),
),
],
),
));
原文由 user15374793 发布,翻译遵循 CC BY-SA 4.0 许可协议
2 回答2k 阅读✓ 已解决
2 回答1.3k 阅读✓ 已解决
2 回答1k 阅读
2 回答2.6k 阅读
1 回答1.1k 阅读✓ 已解决
1 回答2.7k 阅读
2 回答767 阅读✓ 已解决
一个展示其用途的简单应用程序:
还有一个飞镖盘:
https://dartpad.dev/e5a99a851ae747e517b75ac221b73529