How to disable future dates in FormBuilderDateRangePicker

Just Ad  lastDate parameter disable future dates:

 

     


code  is : 

DateTimeFormField(
decoration: const InputDecoration(
hintStyle: TextStyle(color: Colors.black45),
errorStyle: TextStyle(color: Colors.redAccent),
border: OutlineInputBorder(),
contentPadding: EdgeInsets.symmetric(
horizontal: 5, vertical: 0),
suffixIcon: Icon(Icons.event_note,size: 20,),
labelText: 'From Date',
),
mode: DateTimeFieldPickerMode.date,
dateTextStyle: const TextStyle(fontSize: 9),
lastDate: DateTime.now(),
initialValue: DateTime.now(),
autovalidateMode: AutovalidateMode.always,
onDateSelected: (DateTime date) {
appSettingController.fromDate.value= date;
},
),

Post a Comment

Thank you

Previous Post Next Post