I want to remove the topBorder and keep the rest of the borders (leftBorder, rightBorder, bottomBorder) for a Textfield
. Is there any way to do this? If it’s not possible for Textfield
then is it possible for TextFormField
or any other similar widget?
TextField used :-
TextField(
decoration: InputDecoration(
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor)),
border: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor))),
)
2
Answers
One of the way to solve your problem is that,
You can wrap your textField with Container and assign the border to the container.
You can refer to below code
I recommend checking out this package https://pub.dev/packages/assorted_layout_widgets. The author answered a similar question to yours here How to hide one side of the border of a TextField, in Flutter?. Scroll to the bottom and you will see his answer.