datetime_picker_formfield icon indicating copy to clipboard operation
datetime_picker_formfield copied to clipboard

DateTimeField doesn't update automatically, I have to click on it again for date to change.

Open PearlBajaj opened this issue 5 years ago • 2 comments

 DateTimeField(
                decoration: InputDecoration(
                  labelText: 'Date',
                ),
                initialValue: newSubDate,
                format: dateFormat,
                onShowPicker: (context, currentValue) async {
                  showModalBottomSheet(
                      context: context,
                      builder: (BuildContext builder) {
                        return Column(
                          children: <Widget>[
                            Container(
                              height: MediaQuery.of(context)
                                      .copyWith()
                                      .size
                                      .height /
                                  4,
                              child: CupertinoDatePicker(
                                initialDateTime: DateTime.now(),
                                onDateTimeChanged: (DateTime newdate) {
                                  newSubDate = newdate;
                                  print('1-$newdate');
                                },
                                maximumDate: new DateTime(2080, 12, 30),
                                minimumYear: 2020,
                                maximumYear: 2080,
                                mode: CupertinoDatePickerMode.date,
                              ),
                            ),
                            FlatButton(
                              child: Text(
                                'Done',
                                style: TextStyle(
                                  color: Colors.pink[100],
                                ),
                              ),
                              color: Colors.blueGrey,
                              onPressed: () {
                                print(newSubDate);
                                Navigator.pop(context);
                              },
                            ),
                          ],
                        );
                      });
                  setState(() {
                  });
                  return newSubDate;
                },
                onSaved: (value){
                  setState(() {
                    newSubDate = value;
                  });
                },
                onChanged: (value){
                  setState(() {
                    newSubDate = value;
                  });
                },
              ),

PearlBajaj avatar Aug 18 '20 12:08 PearlBajaj

Im also facing the same issue. any workaround for this?

Rajbca00 avatar May 18 '21 15:05 Rajbca00

i only hav this issue on ios

martipello avatar Jul 05 '21 18:07 martipello