Flutter 颤振我的文本文件下拉按钮选项未选择

Flutter 颤振我的文本文件下拉按钮选项未选择,flutter,drop-down-menu,Flutter,Drop Down Menu,[]1]这是我的代码。。 我有两个选择出生日期和月份的文本文件。。。。!并且用户已存在,则值将自动显示在TextField上!用户可以从下拉选择中添加新的选定值。。。。!在我的情况下,我可以从下拉列表中选择项目,但无法在tetxfild上显示所选项目/值。它正在删除,文本字段显示为空白!请帮我做这个 String _Dob; String _Anniversary; Future<UserUpdate> _futureDateeupdate; final Global

[]1]这是我的代码。。 我有两个选择出生日期和月份的文本文件。。。。!并且用户已存在,则值将自动显示在TextField上!用户可以从下拉选择中添加新的选定值。。。。!在我的情况下,我可以从下拉列表中选择项目,但无法在tetxfild上显示所选项目/值。它正在删除,文本字段显示为空白!请帮我做这个

  String _Dob;
  String _Anniversary;
  Future<UserUpdate> _futureDateeupdate;
  final GlobalKey<FormState> _formKey = GlobalKey<FormState>();
  var month = [
  "JANUARY", "FEBRUARY", "MARCH", "APRIL", "MAY", "JUNE", "JULY", "AUGUEST", "SEPTEMBER", "OCTOBER", 
  "NOVEMBER", "DECEMBER"];
   var date = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 
   25, 26, 27, 28, 29, 30, 31];

  @override
  void initState() {
  super.initState();
 _futureDateeupdate = DateUpadte();
  }

  void nextField({String value, FocusNode focusNode}) {
   if (value.isNotEmpty) {
    focusNode.requestFocus();
  }
  }

 FocusNode Anniversary;

 @override
 Widget build(BuildContext context) {
 return Scaffold(
  resizeToAvoidBottomPadding: false,
  resizeToAvoidBottomInset: false,
  body: (_isLoading)
      ? Center(child: CircularProgressIndicator())
      : FutureBuilder<UserUpdate>(
      future: _futureDateeupdate,
      // ignore: missing_return
      builder: (context, snapshot) {
        if (snapshot.hasData) {
          TextEditingController _textEditingControllerDOBb = TextEditingController(
              text: snapshot.data.birthDate);
          TextEditingController _textEditingControllerDate = TextEditingController(
              text: snapshot.data.birthMonth);
          TextEditingController _textEditingControllerAnniversaryy = TextEditingController(
              text: snapshot.data.anniversaryDate);
          return Form(
            key: _formKey,
            child: Stack(
              children: <Widget>[              
                Positioned(
                    top: 330,
                    left: 30,
                    right: 30,
                    child: Row(
                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
                        children: <Widget>[
                          SizedBox(
                            height: 70,
                            width: MediaQuery
                                .of(context)
                                .size
                                .width / 2.6,
                            child: TextFormField(
                              textInputAction: TextInputAction.next,
                              onTap: () {
                                FocusScope.of(context).requestFocus(
                                    new FocusNode());
                              },
                              onFieldSubmitted: (value) {
                                nextField(
                                    value: value, focusNode: Anniversary);
                              },
                              keyboardType: TextInputType.datetime,
                              controller: _textEditingControllerDOBb,
                              decoration: InputDecoration(
                                enabledBorder: OutlineInputBorder(
                                    borderRadius: BorderRadius.circular(
                                        5.0),
                                    borderSide: BorderSide(
                                        color: const Color(0x3df58634)
                                    )
                                ),
                                border: OutlineInputBorder(
                                    borderRadius: BorderRadius.circular(
                                        5.0)
                                ),
                                labelText: 'Date Of Birth',
                                labelStyle: GoogleFonts.nunito(
                                    color: const Color(0xfff58634)),
                                hintText: "Date Of Birth",
                                hintStyle: GoogleFonts.nunito(
                                    color: const Color(0xfff58634)),
                                focusedBorder: OutlineInputBorder(
                                    borderRadius: BorderRadius.circular(
                                        5.0),
                                    borderSide: BorderSide(
                                      color: const Color(0x3df58634),
                                    )
                                ),
                                suffixIcon: PopupMenuButton<String>(
                                  icon: const Icon(Icons.arrow_drop_down),
                                  onSelected: (String value) {
                                    _textEditingControllerDOBb.text = value;
                                  },
                                  itemBuilder: (BuildContext context) {
                                    return month
                                        .map<PopupMenuItem<String>>((
                                        String value) {
                                      return new PopupMenuItem(
                                          child: new Text(value),
                                          value: value);
                                    }).toList();
                                  },
                                ),
                              ),

                              validator: (String value) {
                                if (value.isEmpty) {
                                  return 'DOB is Missing';
                                }
                                return null;
                              },
                              onSaved: (String value) {
                                _Dob = value;
                              },
                            ),
                          ),
                          SizedBox(
                            height: 70,
                            width: MediaQuery
                                .of(context)
                                .size
                                .width / 2.6,
                            child: TextFormField(
                              onTap: () {
                                FocusScope.of(context).requestFocus(
                                    new FocusNode());
                              },
                              onFieldSubmitted: (value) {
                                nextField(
                                    value: value, focusNode: Anniversary);
                              },
                              controller: _textEditingControllerDate,
                              decoration: InputDecoration(
                                enabledBorder: OutlineInputBorder(
                                    borderRadius: BorderRadius.circular(
                                        5.0),
                                    borderSide: BorderSide(
                                        color: const Color(0x3df58634)
                                    )
                                ),
                                border: OutlineInputBorder(
                                    borderRadius: BorderRadius.circular(
                                        5.0)
                                ),
                                labelText: 'Date Of Birth',
                                labelStyle: GoogleFonts.nunito(
                                    color: const Color(0xfff58634)),
                                hintText: "Date Of Birth",
                                hintStyle: GoogleFonts.nunito(
                                    color: const Color(0xfff58634)),
                                focusedBorder: OutlineInputBorder(
                                    borderRadius: BorderRadius.circular(
                                        5.0),
                                    borderSide: BorderSide(
                                      color: const Color(0x3df58634),
                                    )
                                ),
                                suffixIcon: PopupMenuButton<int>(
                                  icon: const Icon(Icons.arrow_drop_down),
                                  onSelected: (int value) {
                                    _textEditingControllerDate.text =
                                    "$value";
                                  },
                                  itemBuilder: (BuildContext context) {
                                    return date
                                        .map<PopupMenuItem<int>>((
                                        int value) {
                                      return new PopupMenuItem(
                                          child: new Text("$value"),
                                          value: value);
                                    }).toList();
                                  },
                                ),
                              ),

                              validator: (String value) {
                                if (value.isEmpty) {
                                  return 'DOB is Missing';
                                }
                                return null;
                              },
                              onSaved: (String value) {
                                _Dob = value;
                              },
                            ),
                          ),


                        ]
                    )
                ),
String\u-Dob;
字符串(u)周年纪念;;
未来-未来数据更新;
最终的GlobalKey _formKey=GlobalKey();
var月=[
“一月”、“二月”、“三月”、“四月”、“五月”、“六月”、“七月”、“八月”、“九月”、“十月”,
“11月”、“12月”];
风险值日期=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,
25, 26, 27, 28, 29, 30, 31];
@凌驾
void initState(){
super.initState();
_futuredateupdate=DateUpadte();
}
void nextField({String value,FocusNode FocusNode}){
if(value.isNotEmpty){
focusNode.requestFocus();
}
}
焦点节点周年纪念;
@凌驾
小部件构建(构建上下文){
返回脚手架(
resizeToAvoidBottomPadding:false,
resizeToAvoidBottomInset:false,
正文:(_isLoading)
?中心(子项:循环压缩机指示器())
:未来建设者(
未来:_futuredate更新,
//忽略:缺少返回
生成器:(上下文,快照){
if(snapshot.hasData){
TextEditingController\u textEditingControllerDB=TextEditingController(
文本:快照。数据。出生日期);
TextEditingController\u textEditingControllerDate=TextEditingController(
文本:snapshot.data.birthMonth);
TextEditingController\u textEditingControllerAnyVersary=TextEditingController(
文本:snapshot.data.anniversaryDate);
报税表(
键:_formKey,
子:堆栈(
儿童:[
定位(
top:330,
左:30,,
右:30,,
孩子:排(
mainAxisAlignment:mainAxisAlignment.spaceBetween,
儿童:[
大小盒子(
身高:70,
宽度:MediaQuery
.of(上下文)
.尺寸
.宽度/2.6,
子项:TextFormField(
textInputAction:textInputAction.next,
onTap:(){
FocusScope.of(上下文).requestFocus(
新的FocusNode());
},
onFieldSubmitted:(值){
nextField(
值:值,焦点节点:周年);
},
键盘类型:TextInputType.datetime,
控制器:_text编辑控制器对象,
装饰:输入装饰(
enabledBorder:OutlineInputBorder(
borderRadius:borderRadius.circular(
5.0),
边界边(
颜色:常量颜色(0x3df58634)
)
),
边框:大纲输入边框(
borderRadius:borderRadius.circular(
5.0)
),
labelText:“出生日期”,
标签样式:GoogleFonts.nunito(
颜色:常量颜色(0xfff58634)),
hintText:“出生日期”,
hintStyle:GoogleFonts.nunito(
颜色:常量颜色(0xfff58634)),
聚焦顺序:大纲输入边框(
borderRadius:borderRadius.circular(
5.0),
边界边(
颜色:常量颜色(0x3df58634),
)
),
后缀:弹出菜单按钮(
图标:常量图标(图标。箭头下拉),
onSelected:(字符串值){
_textEditingControllerDB.text=值;
},
itemBuilder:(构建上下文){
回归月
.地图((
字符串值){
返回新的PopupMenuItem(
子项:新文本(值),
价值:价值);
}).toList();
},
),
),
验证器:(字符串值){
if(value.isEmpty){
返回“DOB丢失”;
}
返回null;
},
onSaved:(字符串值){
_Dob=数值;
},
),
),
大小盒子(