Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
PearlBajaj opened this issue Aug 18, 2020 · 2 comments

Comments

@PearlBajaj
Copy link

PearlBajaj commented Aug 18, 2020

 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;
                  });
                },
              ),
@Rajbca00
Copy link

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

@martipello
Copy link

i only hav this issue on ios

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants