flutter align errorText to the bottom-right of textField - flutter

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

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),
...
),

How to remove error space under TextFormField 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),
)),),

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)

Pass data and receive on textfield widget in Flutter

How to pass a data from first screen to second screen but should receive on textfield widget in second screen. I have tried but there is no option in textfield widget, how to do this?
TextField(
keyboardType: TextInputType.text,
decoration: InputDecoration(
fillColor: Colors.white,
hintText: "",
filled: true,
labelText: "First name",
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Colors.white),
borderRadius: BorderRadius.circular(6),
),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Colors.white),
borderRadius: BorderRadius.circular(6),
)),
),
To set default text in your TextField you need to use TextEditingController, you can use it by initializing in initState or directly to the TextField, here are the examples
To initialize with initState
late TextEditingController _controller;
#override
void initState() {
_controller.text = widget.text;
super.initState();
}
To pass value directly
TextField(
controller: TextEditingController(text: widget.text),
keyboardType: TextInputType.text,
decoration: InputDecoration(
fillColor: Colors.white,
hintText: "",
filled: true,
labelText: "First name",
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.white),
borderRadius: BorderRadius.circular(6),
),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.white),
borderRadius: BorderRadius.circular(6),
)),
)

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