Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

remove dropdown bottom line in flutter

Tags:

flutter

How to remove dropdown bottom line?

enter image description here

My Code

            Container(
              padding: EdgeInsets.fromLTRB(15, 5, 10, 5),
              child: Row(
                children: <Widget>[
                  dropdownButton,
                  Expanded(child: phoneField),
                ],
              ),
              decoration: BoxDecoration(
                  color: Colors.white,
                  border: Border.all(color: Colors.grey, width: 1),
                  borderRadius: BorderRadius.circular(32.0)),
            )

And this is Dropdown

 var dropdownButton = DropdownButton(
      value: dropdownValue,
      onChanged: (String newValue) {
        setState(() {
          dropdownValue = newValue;
        });
      },
      items: <String>['99451', '99450', '99455', '99470 ']
          .map<DropdownMenuItem<String>>((String value) {
        return DropdownMenuItem<String>(
          value: value,
          child: Text(value),
        );
      }).toList(),
    );
like image 797
Kamil Ibadov Avatar asked Oct 20 '25 04:10

Kamil Ibadov


2 Answers

You have to wrap your DropdownButton inside  DropdownButtonHideUnderline like this 

var dropdownButton = DropdownButtonHideUnderline( 
  child: DropdownButton(
  value: dropdownValue,
  onChanged: (String newValue) { 
    setState(() { 
      dropdownValue = newValue; 
    });
 }, 
  items: <String>['99451', '99450', '99455', '99470 '].map<DropdownMenuItem<String>>
    ((String value) {
          return DropdownMenuItem<String>( 
            value: value, 
            child: Text(value), 
      ); 
      }).toList(), 
    )
 );
like image 100
Darshan Prajapati Avatar answered Oct 22 '25 18:10

Darshan Prajapati


you can use like that

underline: SizedBox()
like image 20
Cenk YAGMUR Avatar answered Oct 22 '25 18:10

Cenk YAGMUR



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!