27flutter日期 时间组件flutter_cupertino_date_picker的使用

pubspec.yaml
flutter_cupertino_date_picker: ^1.0.
DatePicker.dart
import 'package:date_format/date_format.dart';
import 'package:flutter/material.dart';
import 'package:flutter_cupertino_date_picker/flutter_cupertino_date_picker.dart';
class DatePickerPubDemo extends StatefulWidget {
DatePickerPubDemo({Key key}) : super(key: key);
_DatePickerPubDemoState createState() => _DatePickerPubDemoState();
} class _DatePickerPubDemoState extends State<DatePickerPubDemo> {
DateTime _dateTime=DateTime.now();
_showDatePicker(){
DatePicker.showDatePicker(
context,
pickerTheme: DateTimePickerTheme(
showTitle: true,
confirm: Text('确定',style:TextStyle(color:Colors.red)),
cancel: Text('取消',style: TextStyle(color: Colors.cyan)),
),
minDateTime: DateTime.parse("1980-05-21"),
maxDateTime: DateTime.parse("2019-05-21"),
initialDateTime: _dateTime,
// dateFormat: "yyyy-MMMM-dd", //只包含年、月、日
dateFormat: 'yyyy年M月d日 EEE,H时:m分',
pickerMode: DateTimePickerMode.datetime,
locale: DateTimePickerLocale.zh_cn,
onCancel: (){
debugPrint("onCancel");
},
onConfirm: (dateTime,List<int> index){
setState(() {
_dateTime=dateTime;
});
}
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('日期选中'),
),
body: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
InkWell(
child: Row(
children: <Widget>[
// Text("${formatDate(_dateTime,[yyyy,'年',mm,'月',dd])}"), //只获取年月日
Text("${formatDate(_dateTime,[yyyy,'年',mm,'月',dd,' ',HH,':',nn])}"),
Icon(Icons.arrow_drop_down)
],
),
onTap:_showDatePicker,
)
],
)
],
),
);
}
}
27flutter日期 时间组件flutter_cupertino_date_picker的使用的更多相关文章
- 日期时间组件 - layui.laydate
全部参数 一.核心方法:laydate(options); options是一个对象,它包含了以下key: '默认值' { elem: '#id', //需显示日期的元素选择器 event: 'cli ...
- 如何在Rails6内通过Webpacker使用JavaScript; flatpicker日期时间组件选择器
如何在Rails6内通过Webpacker使用JavaScript; Rails6默认不再使用asset pipeline,改用Webpacker. 文件结构变化: 配置文件: webpacker.y ...
- yii2超好用的日期组件和时间组件
作者:白狼 出处:http://www.manks.top/yii2_datetimepicker.html 本文版权归作者,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接 ...
- 【Android 应用开发】Android - 时间 日期相关组件
源码下载地址 : -- CSDN : http://download.csdn.net/detail/han1202012/6856737 -- GitHub : https://github.co ...
- Android - 时间 日期相关组件
源码下载地址 : -- CSDN : http://download.csdn.net/detail/han1202012/6856737 -- GitHub : https://github.co ...
- 第二百一十九节,jQuery EasyUI,DateTimeBox(日期时间输入框)组件
jQuery EasyUI,DateTimeBox(日期时间输入框)组件 学习要点: 1.加载方式 2.属性列表 3.方法列表 本节课重点了解 EasyUI 中 DateTimeBox(日期时间输入框 ...
- POCO库——Foundation组件之日期时间DateTime
日期时间DateTime:内部提供多个设计计时器.日期.时区.时间戳等: Clock.h :Clock时钟计时类,_clock:Int64类型时钟值,CLOCKVAL_MIN.CLOCKVAL_MAX ...
- react-native DatePicker日期选择组件的实现
本教程的实现效果如下: 为了实现其淡入/淡出的覆盖效果, 还有取消按钮, 在此用了一个三方的组件, 大家可以先安装一下: 三方组件的地址:https://github.com/eyaleizenber ...
- javascript学习之时间组件
写了一个时间组件,哪里需要哪里调(菜鸟级别,大牛路过就Ok了): 先有一个HTML文件: <!doctype> <html> <head> <title> ...
随机推荐
- 面向对象中特殊方法的补充、isinstance/issubclass/type、方法和函数、反射
一.面向对象中特殊方法的补充 1.__str__ 能将对象名改成你想要的字符串,但是类型还是类 class Foo(object): def __init__(self): pass def func ...
- Selenium(十二)嵌套frame定位
第一种:iframe有id.name属性 网页上有3个frame:header.menu.main,分别代码顶部.左侧.右侧(其中menu.main在另外一个frameset中) 如何定位到“head ...
- 集成百度编辑器 ueditor 后端配置项没有正常加载,上传插件不能正常使用!
项目要用到编辑器,于是集成了ueditor,集成ok,但一直显示 ‘’后端配置项没有正常加载,上传插件不能正常使用!‘’ 各种查: 网上说的无非就是那么集中情况 1. 因为百度官方的问题,php/co ...
- 常见的HTML5语义化标签
<title>:页面主体内容.<hn>:h1~h6,分级标题,<h1> 与 <title> 协调有利于搜索引擎优化.<ul>:无序列表. ...
- js插件讲解_javascript原生日历插件讲解
效果图如下: html代码 <div class="date-control" id="date-control"> <span id=&qu ...
- vue-resouce设置请求头
- springMvc--接受请求参数
作者:liuconglin 接收基本类型 表单: <h1>接受基本类型参数到Controller</h1> <form action="/param/test& ...
- SVN工作区同步
单击“团队同步”菜单项或“团队同步”视角的“团队”工具栏上的“同步”按钮后,“同步视图”中将显示SVN工作区同步.它提供了从远程检查本地副本的更改类型的概率. 这是“同步视图”中的 “SVN工作空间同 ...
- Connecting Graph
Given n nodes in a graph labeled from 1 to n. There is no edges in the graph at beginning. You need ...
- 16 | “order by”是怎么工作的?
在你开发应用的时候,一定会经常碰到需要根据指定的字段排序来显示结果的需求.还是以我们前面举例用过的市民表为例,假设你要查询城市是“杭州”的所有人名字,并且按照姓名排序返回前1000个人的姓名.年龄. ...