Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR DART

select date from datepicker in textfield flutter

void _selectDate(){
    showDatePicker(
      context: context,
      initialDate: selectedDate,
      firstDate: DateTime(1950),
      lastDate: DateTime.now(),
    ).then((pickedDate) {
      if (pickedDate == null) {
        return;
      }

      setState(() {
        selectedDate = pickedDate;
        dateValue.text = "${selectedDate.toLocal()}".split(' ')[0];
      });
    });
  }
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #select #date #datepicker #textfield #flutter
ADD COMMENT
Topic
Name
7+3 =