dropdown_below 0.0.1

Flutter Android iOS web

flutter custom dropdown box.

Flutter Dropdown_Below #

A Flutter Dropdown library which is customize flutter dropdownbutton widget.

Options #

itemWidthdropdown item's box widthX
itemTextstyledropdown item's text styleX
boxTextstyleseletced box text styleX
boxPaddingseletced box inner paddingX
boxHeightseletced box heightX
hinttext before you choose itemX
valueselected itemX
onChangechange item functionO

How to make it Work? #

Description for example. #

1. datas #

_testList's type is always be a list.

If you want to use map or other type, you can customize this package.

  List _testList = [{'no': 1, 'keyword': 'blue'},{'no': 2, 'keyword': 'black'},{'no': 3, 'keyword': 'red'}];
  List<DropdownMenuItem> _dropdownTestItems;
  var _selectedTest;

2. initState & build items to correct type #

If you want to customize item's child widget ex) Text -> Container, You can change any widget you want.

  void initState() {
    _dropdownTestItems = buildDropdownTestItems(_testList);

  List<DropdownMenuItem> buildDropdownTestItems(List _testList) {
    List<DropdownMenuItem> items = List();
    for (var i in _testList) {
          value: i,
          child: Text(i['keyword']),
    return items;

3. change function #

  onChangeDropdownTests(selectedTest) {
    setState(() {
      _selectedTest = selectedTest;

4. UI #

Dropdown Widget.

      itemWidth: 200,
      itemTextstyle: TextStyle(fontSize: 14, fontWeight: FontWeight.w400, color: Colors.black),
      boxTextstyle: TextStyle(fontSize: 14, fontWeight: FontWeight.w400, color: Color(0XFFbbbbbb)),
      boxPadding: EdgeInsets.fromLTRB(13, 12, 0, 12),
      boxHeight: 45,
      hint: Text('choose item'),
      value: _selectedTest,
      items: _dropdownTestItems,
      onChanged: onChangeDropdownTests,