在用于抖动的datetime_picker_formfield插件中,formfield dent更新

问题描述

我正在尝试使用datetime_picker_formfield插件进行拍击,但是我面临的问题是,使用拾取器更改日期后,除非再次单击表单字段,否则它不会在表单字段上更新。我已经附上了下面的代码,我认为问题出在onChnaged函数上。

https://pub.dev/packages/datetime_picker_formfield-这是我正在使用的插件

任何帮助将不胜感激。

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;
                  });
                },

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)