Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Full width DropdownButton with adjust dropdown arrow icon in Flutter

People also ask

How do you make a dropdown button full width on a flutter?

Setting the Width for a Dropdown Button You can set the width for a DropdownButton by setting its isExpanded parameter to true and wrapping it inside a fixed-size Container or SIzedBox.

How do you change the dropdown arrow icon in flutter?

To change dropdown arrow color in Flutter, you can add the same arrow icon inside the icon property and change the color using the color property. Here are the steps: Inside the DropdownButton widget, add the icon parameter and assign the Icon widget. Inside the Icon widget, add the Icons.

How do I style a dropdown button in flutter?

If we want to display some other text instead of the selected option on the button we will use selectedItemBuilder. DropdownButton( value: _value, selectedItemBuilder: (BuildContext context) { return list_items. map<Widget>((int item) { return Text('item $item'); }). toList(); }, items: list_items.


Just adding isExpanded:true to the DropdownButton

  Widget example() {
    return new DropdownButton(
          isExpanded: true,
            items: [
              new DropdownMenuItem(child: new Text("Abc")),
              new DropdownMenuItem(child: new Text("Xyz")),
            ],
            hint: new Text("Select City"),
            onChanged: null
        );
  }

Try to add the following in the Column you have...

Column(
  crossAxisAlignment: CrossAxisAlignment.stretch,
  ...
)

You should not need the Expanded widget as that would try to fill the vertical space and not the horizontal (width) space.