Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Create DropDown List in Flutter: DropdownButton Widget

Center(
  child: Column(
    mainAxisAlignment: MainAxisAlignment.spaceEvenly,
    children: [
      DropdownButton(
        value: currentItem,
        items: items
            .map<DropdownMenuItem<String>>(
              (e) => DropdownMenuItem(
                value: e,
                child: Text(e),
              ),
            )
            .toList(),
        onChanged: (String? value) => setState(
          () {
            if (value != null) currentItem = value;
          },
        ),
      ),
      Text(currentItem),
    ],
  ),
)
Source by www.allaboutflutter.com #
 
PREVIOUS NEXT
Tagged: #Create #DropDown #List #DropdownButton #Widget
ADD COMMENT
Topic
Name
7+9 =