Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR DART

How to Style DropdownButton in Flutter

Container(
  padding: EdgeInsets.symmetric(horizontal: 10, vertical: 5),
  decoration: BoxDecoration(
      color: Colors.white, borderRadius: BorderRadius.circular(10)),

  // dropdown below..
  child: DropdownButton<String>(
      value: selectedValue,
      onChanged: (String newValue) =>
        setState(() => selectedValue = newValue),
      items: items
          .map<DropdownMenuItem<String>>(
              (String value) => DropdownMenuItem<String>(
                    value: value,
                    child: Text(value),
                  ))
          .toList(),

      // add extra sugar..
      icon: Icon(Icons.arrow_drop_down),
      iconSize: 42,
      underline: SizedBox(),
  ),
);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #How #Style #DropdownButton #Flutter
ADD COMMENT
Topic
Name
8+2 =