Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove underline below TextField?

Here is the code. I want to remove the black underline just below text, and currently the TextField is in edit mode:

TextField(       autofocus: true,       decoration: InputDecoration.collapsed(         hintText: "Search",         border: InputBorder.none,       ),       maxLines: 1,     ) 

like image 226
Rahul Lohra Avatar asked May 26 '19 16:05

Rahul Lohra


People also ask

How do I remove the underline from TextField material UI?

To remove underline from input component with React Material UI, we can set the disableUnderline prop to true . to add the disableUnderline to the Input component. As a result, we wouldn't see the underline of the input now.

How do I remove an underline in typography?

The underline can be easily remove by using text-decoration property. The text-decoration property of CSS allows to decorate the text according to requirement. By setting the text-decoration to none to remove the underline from anchor tag.


2 Answers

Try to give a TextStyle to your TextField widget. Your TextField is getting your default Theme's TextStyle.

TextField(       autofocus: true,       style: TextStyle(color: Colors.white, fontSize: 30),       decoration: InputDecoration.collapsed(         hintText: "Search",         border: InputBorder.none,       ),       maxLines: 1,     ) 

In TextField widgets source code it states:

  /// If null, defaults to the `subhead` text style from the current [Theme].   final TextStyle style; 
like image 123
Ali Türkay Avci Avatar answered Sep 20 '22 00:09

Ali Türkay Avci


You should use TextDecoration.none in decoration property.

Text(   'your txt',   style: TextStyle( decoration: TextDecoration.none), ) 
like image 25
Hossein Azem Avatar answered Sep 23 '22 00:09

Hossein Azem