日期范围选择器

Flutter 日期范围选择器使用对话框在手机上选择日期范围。

演示

Date-Range-Picker

入门

安装

添加到 pubspec.yamldependencies

  date_range_picker: ^1.0.3

用法

import 'package:date_range_picker/date_range_picker.dart' as DateRagePicker;
...
new MaterialButton(
    color: Colors.deepOrangeAccent,
    onPressed: () async {
      final List<DateTime> picked = await DateRagePicker.showDatePicker(
          context: context,
          initialFirstDate: new DateTime.now(),
          initialLastDate: (new DateTime.now()).add(new Duration(days: 7)),
          firstDate: new DateTime(2015),
          lastDate: new DateTime(2020)
      );
      if (picked != null && picked.length == 2) {
          print(picked);
      }
    },
    child: new Text("Pick date range")
)

GitHub

https://github.com/anicdh/date_range_picker