简体   繁体   中英

Selected items not displayed the DropdownButton in Flutter

i am a beginner of flutter.iam creating a DropdownButton to list the items.item was loading well on DropdownButton .but loading item selected not displayed at the DropdownButton i don't know. what i tried so far i attached below. what is the wrong here onChanged: (value) => setState(() => this.valueschoose = value,

DropdownButton<String>(
                    items: <String>['A', 'B', 'C', 'D'].map((String value) {
                      return DropdownMenuItem<String>(
                        value: value,
                        child: Text(value),
                      );
                    }).toList(),
                    onChanged: (value) => setState(() => this.valueschoose = value,
    
                  )),

you are missing this value of dropdown button

DropdownButton<String>(
                    value: this.valueschoose,
                    items: <String>['A', 'B', 'C', 'D'].map((String value) {
                      return DropdownMenuItem<String>(
                        value: value,
                        child: Text(value),
                      );
                    }).toList(),
                    onChanged: (value) => setState(() => this.valueschoose = value,
    
                  )),

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM