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(); }); }),

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:
DropdownButtonHideUnderline( child: DropdownButton() )

Custom Flutter Dropdown Design Source Code
import 'package:flutter/material.dart'; void main() { runApp(MyApp()); } class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( debugShowCheckedModeBanner: false, home: Homepage(), ); } } class Homepage extends StatefulWidget { @override State<Homepage> createState() => _HomepageState(); } class _HomepageState extends State<Homepage> { String? categoryValue; @override Widget build(BuildContext context) { return SafeArea( child: Scaffold( body: Center( child: Padding( padding: EdgeInsets.symmetric(horizontal: 40), child: Container( width: double.infinity, height: 55, padding: EdgeInsets.symmetric(horizontal: 10), decoration: BoxDecoration( color: Colors.blue.shade100, borderRadius: BorderRadius.only( topLeft: Radius.circular(30), bottomRight: Radius.circular(30))), child: DropdownButtonHideUnderline( child: DropdownButton( isExpanded: true, hint: Text('Select sports category', style: TextStyle(fontSize: 15, color: Colors.white)), 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(); }); }), ), ), )), )); } }
Conclusion
In conclusion, now you have a detailed understanding of how to implemented Flutter dropdown remove underline. I would love to hear your thoughts on this post. I would also encourage you to visit my other amazing posts on Flutter app development, Flutter widgets, Flutter animations, beautiful Flutter templates and many more, links to some of these posts are listed below. Thanks for reading this post.