flutter
date range picker
flutter date range pickers use a dialog window to select a range of date on mobile.
demo
![[2025] Flutter #1 Date Range Picker Dialog flutter date range picker dialog](https://i0.wp.com/flutterawesome.com/content/images/2018/11/date-range-picker.gif?w=770&ssl=1)
getting started
installation
add to pubspec.yaml
in dependencies
date_range_picker: ^1.0.3
usage
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")
)
Comments are closed.