簡體   English   中英

如何在 Flutter 中顯示 DropDownButton?

[英]How to show DropDownButton in Flutter?

我想以編程方式顯示下拉列表/下拉按鈕,但不顯示任何內容。 我不知道為什么不顯示它。 在我的代碼下方。

           Container(
                height: 200.0,
                child: ListView.builder(
                    scrollDirection: Axis.vertical,
                    shrinkWrap: true,
                  itemCount: _mEmployeeList==null?0:_mEmployeeList.Length,
                    itemBuilder: (context,index)
                        {
                          print(_mEmployeeList[index].EMP_NAME);
                          DropdownButton(
                              items: [
                                DropdownMenuItem(
                                     value:_mEmployeeList[index].EMP_NAME,
                                     child: Text(_mEmployeeList[index].EMP_NAME)
                              ,
                                ),
                              ],
                            // value: _mEmployeeList[index].EMP_NAME,
                            onChanged: (sal){
                                setState(() {
                                  Fhelper.showToast(sal);
                                });
                            },
                          );
                        }
                ),
              ),

是的,我會解決我的問題。 謝謝

中心(子:行(子:[下拉按鈕(值:_mEmployeeList[0].EMP_OID,項目:_mEmployeeList.map((索引){返回DropdownMenuItem(子:新文本(索引.EMP_NAME),值:索引.EMP_OID,) ; }).toList(), onChanged: (sal){ setState(() { Fhelper.showToast(sal); }); }, ), ], ), ),

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM