I have implemented a DatePicker to my Flutter application. I am trying to limit the picker to only allow the users to choose weekdays. However, I am not sure how to do this. I believe it has got to do with the SelectableDayPredicate. Below is a snippet of my code:
Future<Null> _selectDate(BuildContext context) async {
final DateTime picked = await showDatePicker(
context: context,
initialDate: _date,
firstDate: new DateTime(DateTime.now().year),
lastDate: new DateTime(DateTime.now().year+1),
// to do: I am pretty sure the SelectableDayPredicate should go somewhere here.
);
if (picked != null && picked != _date) {
setState(() {
_date = picked;
});
}
}
The _selectDate function is called when the user taps on the listTile.