码迷,mamicode.com
首页 > 其他好文 > 详细

调用 flutter 第三方时间组件

时间:2020-02-24 15:01:35      阅读:149      评论:0      收藏:0      [点我收藏+]

标签:creat   creates   create   theme   三方   The   oca   xtend   取消   

https://pub.flutter-io.cn/packages/flutter_cupertino_date_picker

 

flutter_cupertino_date_picker: ^1.0.12

 

import ‘package:flutter/material.dart‘;
import ‘package:flutter_cupertino_date_picker/flutter_cupertino_date_picker.dart‘;

class DatePage extends StatefulWidget{
DatePage({Key key});
_DatePage createState() => _DatePage();
}

class _DatePage extends State {
_showDatePicker() {
DatePicker.showDatePicker(
context,
pickerTheme: DateTimePickerTheme(
showTitle: true,
confirm: Text(‘确定‘),
cancel: Text(‘取消‘)
),
minDateTime: DateTime.parse(‘2020-00-00‘),
maxDateTime: DateTime.parse(‘2030-00-00‘),
initialDateTime: DateTime.now(),
dateFormat: ‘yyyy-MM-dd HH:mm:ss‘,
locale: DateTimePickerLocale.zh_cn,
pickerMode: DateTimePickerMode.datetime,
onClose: () {
print(‘onClose‘);
},
onCancel: () {
print(‘onCancel‘);
},
onChange: (val, List<int> index) {
print(val);
print(index);
},
onConfirm: (val, List<int> index) {
print(val);
print(index);
},
);
}
@override
Widget build(BuildContext context) {
// TODO: implement build
return Scaffold(
appBar: AppBar(
title: Text(‘Date‘)
),
body: ListView(
children: <Widget>[
InkWell(
child: Column(
children: <Widget>[
SizedBox(height: 50,),
InkWell(
child: Text(‘${DateTime.now()}‘),
onTap: () {
_showDatePicker();
},
)
],
)
)
],
)
);
}
}

调用 flutter 第三方时间组件

标签:creat   creates   create   theme   三方   The   oca   xtend   取消   

原文地址:https://www.cnblogs.com/zhaofeis/p/12356789.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!