How to remove error space under TextFormField Flutter? - flutter

I created TextFormField inside a Container and tried to hide an error line from TextFormField, but it's not working. Is there any way to delete it?
My TextFormField
Code

This is what you need:
the border color for errorBorder & focusedErrorBorder could be changed.
TextField(
keyboardType: TextInputType.emailAddress,
textAlign: TextAlign.center,
onChanged: (value) {
//Do something with the user input.
},
decoration: InputDecoration(
errorBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.white, width: 0.0),
),
focusedErrorBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.blue, width: 0.0),
)),),

Related

Vertically bottom Align Text in TextFormField Flutter

So I know that you can Align the contents in a textformfield through the
textAlignVertical
property. I tried this on my TextFormField:
TextFormField(
textAlignVertical: TextAlignVertical.bottom,
style: TextStyle(
color:
isUnlocked ? Color(0xffF6CD9D) : Colors.grey),
cursorColor: Color(0xffF6CD9D),
enabled: isUnlocked,
controller: vornameController,
decoration: new InputDecoration(
focusColor: Color(0xffF6CD9D),
hoverColor: Color(0xffF6CD9D),
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Color(0xffF6CD9D)),
),
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Color(0xffF6CD9D)),
),
),
),
The result looks like this:
But I want the text to be on the line itself. How can I achieve this behaviour?
Add is dense true and content padding
decoration: InputDecoration(
isDense: true,
contentPadding: EdgeInsets.all(0),
...
),

Flutter: How to remove underling from text when I'm typing into text field?

I want to remove this underline.
This is my input field
TextField(
decoration: InputDecoration(
contentPadding:
const EdgeInsets.symmetric(vertical: 10, horizontal: 20),
hintText: label,
hintStyle: TextStyle(color: Colors.grey[400]),
fillColor: Colors.white,
filled: true,
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(30),
borderSide:
const BorderSide(color: AppColors.textGrey2, width: 0.5),
),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(30),
borderSide:
const BorderSide(color: AppColors.textGrey2, width: 0.5),
),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(30),
borderSide:
const BorderSide(color: AppColors.textGrey2, width: 0.5)),
),
obscureText: obscureText,
),
I need this output
try to remove the styling from the text, add this line to your TextField
style: TextStyle(decoration:TextDecoration.none),
Do you see the underline in the hint text of your TextField?
If you put a Material widget above in your widget tree this should go by default.
Otherwise you can set it in the TextStyle of your hintText
hintStyle: TextStyle(decoration: TextDecoration.none)

How to hide the bottom edge on TextField?

How to hide the bottom edge on TextField?
TextField(
decoration: InputDecoration(
hintText: '(201) 555-0123',
),
You can use the *border parameters of TextField:
TextField(
decoration: InputDecoration(
hintText: '(201) 555-0123',
// Hides the border when the TextField is enabled
enabledBorder: OutlineInputBorder(
borderSide: const BorderSide(color: Colors.transparent),
),
// Hides the border when you click the TextField
focusedBorder: OutlineInputBorder(
borderSide: const BorderSide(color: Colors.transparent),
),
// Hides the border when the TextField is disabled
disabledBorder: OutlineInputBorder(
borderSide: const BorderSide(color: Colors.transparent),
),
),
)
How are you?
You can set the border of InputDecoration to InputBorder.none.
child: TextField(
decoration: InputDecoration(
border: InputBorder.none,
hintText: S.of(context).textHere,
hintStyle: TextStyle(fontSize: 12),
),
minLines: 5,
maxLines: null,
controller: _content,
keyboardType: TextInputType.multiline,
textCapitalization: TextCapitalization.sentences,
),
https://i.stack.imgur.com/trK69.png

How to change the inside color of a Textfield in flutter?

I want to change the Color of an textfield in flutter.
Means the area within the InputBorder.
I tried to wrap the textfield in container, and change the color of the container, but this seems a fool's step to solve the problem.
I tried the fillColor option, but nothing changed.
Here is my Code -->
Container(
padding: EdgeInsets.fromLTRB(
10,
screenHeight * 0.016415869,
10,
0,
),
height: screenHeight * 0.082079343,
child: TextField(
cursorColor: Color(0xFF7675E0),
textAlign: TextAlign.left,
decoration: InputDecoration(
fillColor: Colors.black, //Nothing Worked
contentPadding: EdgeInsets.fromLTRB(
15,
screenHeight * 0.002735978,
2,
screenHeight * 0.002735978,
),
hintText: "Search",
hintStyle: GoogleFonts.sniglet(
fontSize: screenHeight * 0.020519836,
color: Color(0xFFC6C8CA),
),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(5.0),
borderSide: BorderSide(
color: Colors.grey[200].withOpacity(0.2),
),
),
prefixIcon: Icon(Icons.search),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Colors.grey[200].withOpacity(1),
),
),
),
),
),
Thanks in Advance :)
Try out this:-
decoration: InputDecoration(
filled: true,
fillColor: Colors.grey,
If you want to set the color to your text field then there is one boolean variable which you need to set true so your color will be added to your text field
Container(
child: TextField(
cursorColor: Color(0xFF7675E0),
textAlign: TextAlign.left,
decoration: InputDecoration(
fillColor: Colors.black, // you can change color of textfield
filled: true, // this should be true if you want to set color to textfield
hintText: "Search",
prefixIcon: Icon(Icons.search),
),
),
),
Basically you can leave your code as you provided us. The important missing value is
filled: true
With this value applied you can style the background color easy.
Reference to the doc: https://api.flutter.dev/flutter/material/TextField-class.html
don't use Container for TextField decoration, there are more property into TextField
TextField use
decoration: InputDecoration(
filled: true,
fillColor: Colors.white10,
border: new OutlineInputBorder(
borderRadius: new BorderRadius.all(
new Radius.circular(14.0),
),
),
TextField(
controller: usernameController,
keyboardType: TextInputType.emailAddress,
style: TextStyle(color: Colors.white),
decoration: InputDecoration(
filled: true,
fillColor: Colors.white10,
border: new OutlineInputBorder(
borderRadius: new BorderRadius.all(
new Radius.circular(14.0),
),
),
hintText: 'Username',
hintStyle: TextStyle(color: Colors.white),
contentPadding: const EdgeInsets.all(24),
prefixIcon: Icon(Icons.person, color: Colors.white),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.white10),
borderRadius: BorderRadius.circular(14),
),
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.white10),
borderRadius: BorderRadius.circular(14),
),
),
),

flutter align errorText to the bottom-right of textField

I want to align inputDecoration errorText to the bottom-right of TextField.
The default mode is bottom-left.
I want to set it like
here is my textField code:
TextField authTextFiled(
String hint, ValidationBloc bloc, AsyncSnapshot<String> snapshot) {
return TextField(
textAlign: TextAlign.right,
onChanged: (String text) => bloc.updateText(text),
decoration: InputDecoration(
hintStyle: AppStyle.textFieldHintTextStyle,
errorStyle: AppStyle.textFieldErrorTextStyle,
errorText: snapshot.hasError ? snapshot.error : null,
border: OutlineInputBorder(borderRadius: AppStyle.borderRadius),
disabledBorder: OutlineInputBorder(
borderRadius: AppStyle.borderRadius,
borderSide: BorderSide(width: 1, color: AppColors.pinkDarkDisableColor)
),
focusedBorder: OutlineInputBorder(
borderRadius: AppStyle.borderRadius,
borderSide: BorderSide(width: 1, color: AppColors.bluePrimaryColor),
),
errorBorder: OutlineInputBorder(
borderRadius: AppStyle.borderRadius,
borderSide: BorderSide(width: 1, color: AppColors.pinkDarkHotColor)
),
focusedErrorBorder: OutlineInputBorder(
borderRadius: AppStyle.borderRadius,
borderSide: BorderSide(width: 1, color: AppColors.pinkDarkHotColor)),
hintText: hint,
),
keyboardType: TextInputType.number,
textDirection: TextDirection.rtl,
);
}
any help would be appreciated.
Wrap your TextFormField inside Directionality and give RTL direction,
Directionality(
textDirection: TextDirection.rtl,
child: TextFormField(
...
What is Directionality CLass?
A widget that determines the ambient directionality of text and text-direction-sensitive render objects.
Output