flutter cupertino date picker
flutter cupertino date picker.
usage
1. depend
add this to you package’s pubspec.yaml
file:
dependencies:
flutter_cupertino_date_picker: ^0.0.7
2. install
run command:
$ flutter packages get
3. import
import in dart code:
import 'packages:flutter_cupertino_date_picker/flutter_cupertino_date_picker.dart';
4. display datepicker
///
/// context: buildcontext.
/// showtitleactions: display confirm and cancel button in title bar or not.
/// local: i18n, 'zh' for chinese, default is english.
/// minyear: min value of year's selection range. default is 1900.
/// maxyear: max value of year's selection range. default is 2100.
/// initialyear: initial value of year.
/// initialmonth: initial value of month.
/// initialdate: initial value of date.
/// dateformat: format english months.
/// onchange: an option callback when the currently selected datetime changes.
/// onconfirm: an option callback when tap the confirm button in title bar.
datepicker.showdatepicker(
context,
showtitleactions: true,
locale: 'zh',
minyear: 1970,
maxyear: 2020,
initialyear: 2018,
initialmonth: 6,
initialdate: 21,
dateformat: 'yyyy-mm-dd'
onchanged: (year, month, date) { },
onconfirm: (year, month, date) { },
);
showtitleactions: false
locale: ‘zh’
i18n, default is english
dateformat: ‘yyyy-mmm-dd’
just support english months.
it will also put the pickers in the same order. the date string output does not change
dd-mm-yyyy -> 1-10-2018
dd-mmm-yyyy -> 1-oct-2018
dd-mmmm-yyyy -> 1-october-2018
futures
- format datetime display.
license
copyright 2018 wuzhen
licensed under the apache license, version 2.0 (the "license");
you may not use this file except in compliance with the license.
you may obtain a copy of the license at
http://www.apache.org/licenses/license-2.0
unless required by applicable law or agreed to in writing, software
distributed under the license is distributed on an "as is" basis,
without warranties or conditions of any kind, either express or implied.
see the license for the specific language governing permissions and
limitations under the license.
Comments are closed.