Answers for "how to dropdown button item how in a container in flutter"

5

flutter dropdownbutton

String dropdownValue = 'One';
DropdownButton<String>(
            value: dropdownValue,
            onChanged: (String? newValue) {
              setState(() {
                dropdownValue = newValue!;
              });
            },
            items: <String>['One', 'Two', 'Free', 'Four']
                .map<DropdownMenuItem<String>>((String value) {
              return DropdownMenuItem<String>(
                value: value,
                child: Text(value),
              );
            }).toList(),
          ),
Posted by: Guest on September-11-2021
1

dropdown item from the list flutter

List<DropdownMenuItem<String>> getDropdownItems() {
    List<DropdownMenuItem<String>> dropDownItems = [];

    for (String currency in currenciesList) {
      var newDropdown = DropdownMenuItem(
        child: Text(currency),
        value: currency,
      );

      dropDownItems.add(newDropdown);
    }
    return dropDownItems;
  }
Posted by: Guest on September-27-2021

Code answers related to "how to dropdown button item how in a container in flutter"

Code answers related to "Dart"

Browse Popular Code Answers by Language