Sitemap
Zeeshan Ali

Zeeshan Ali

Flutter app developer having 6 years of experience.

Flutter Dropdown Remove Underline

2 min readJul 22, 2023

--

Press enter or click to view image in full size
Flutter Dropdown Remove Underline

Flutter dropdown remove underline implementation. In this post, I will be implementing Flutter dropdown remove underline using an easy example so you can also implement and remove the underline from your Flutter dropdown easily. I will be using a proper Flutter example code for demonstration. Let’s jump directly into implementing Flutter dropdown remove underline.

What is Flutter Dropdown Remove Underline?

Flutter dropdown remove underline, as the names suggests, it is removing the underline border from the Flutter dropdown button. Flutter dropdown is used to select from a list of items like we have a list of categories in our Flutter dropdown and we can select anyone of those categories. Let’s now implement Flutter dropdown remove underline using a proper Flutter example.

Simple Flutter Dropdown

Let’s see the default style of Flutter dropdown button. For that we have to define our simple Flutter dropdown. See the below steps:

DropdownButton(
isExpanded: true,
hint: Text('Select sports category',
style: TextStyle(fontSize: 15, color: Colors.black45)),
value: categoryValue,
items: [
DropdownMenuItem(
value: 'Football',
child: Text('Football',
style: TextStyle(fontSize: 15, color: Colors.black45))),
DropdownMenuItem(
value: 'Volleyball',
child: Text('Volleyball',
style: TextStyle(fontSize: 15, color: Colors.black45))),
DropdownMenuItem(
value: 'Basketball',
child: Text('Basketball',
style: TextStyle(fontSize: 15, color: Colors.black45))),
],
onChanged: (val) {
setState(() {
categoryValue = val.toString();
});
}),

In the above code, you can see that I have used a simple Flutter dropdown. I have used hint text to show a default text when no option is selected. I have used a string variable to store the value of selected option using the on changed constructor. I have used three Flutter dropdown menu items and have given them above mentioned values. The value constructor will show the selected option value in Flutter dropdown so I have passed the string variable to that constructor in which the selected option value will be stored.

Get Zeeshan Ali’s stories in your inbox

Join Medium for free to get updates from this writer.

Now as you can see that the default Flutter dropdown underline is shown. Let’s now see how to remove that underline from our dropdown.

Removing Flutter Dropdown Underline

To remove the underline from Flutter dropdown, we have to wrap the Flutter dropdown widget with drop down button hide underline widget class. Let’s see the below code: Continue reading…

--

--

Zeeshan Ali
Zeeshan Ali

Written by Zeeshan Ali

Flutter app developer having 6 years of experience.