How to Add Rounded Rectangle Border? Below Code didn't result in any border on screen.
Container(margin: EdgeInsets.only(top: 10.0, right: 10.0, left: 10.0), width: double.infinity, // decoration: ShapeDecoration( // shape: RoundedRectangleBorder( // borderRadius:BorderRadius.all(Radius.circular(5.0)), // ), child: DropdownButtonHideUnderline( child: Container( margin: EdgeInsets.only( left: 10.0, right: 10.0), child: new DropdownButton<UserTest>(...), ), ), ),
If you want border for all the corners you can use like bellow. Container( decoration: BoxDecoration( color: Colors. white, borderRadius: BorderRadius.
To change the dropdown Button color in Flutter, simply wrap your DropdownButton widget inside the Container and provide the styling instructions inside the decoration property using the BoxDecoration widget. Using the color property (insideBoxDecoration) you can assign the color.
You can use DecoratedBox() to apply decoration on DropdownButton() widget. DecoratedBox provides all necessary parameters to customize the style of any kind of widget.
With the form field variant, you can use the OutlineInputBorder
InputBorder
, used normally for input text fields:
DropdownButtonFormField( ... decoration: const InputDecoration( border: OutlineInputBorder(), ), ),
The way the form field does this can be replicated and used with the regular DropdownButton
:
InputDecorator( decoration: const InputDecoration(border: OutlineInputBorder()), child: DropdownButtonHideUnderline( child: DropdownButton( ... ), ), ),
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With