I want to move the icon and the label text to the right side of the Text Field. I tried textAlign: TextAlign.right but it's only for input text.

TextFormField(
textAlign: TextAlign.right,
textDirection: TextDirection.rtl,
keyboardType: TextInputType.multiline,
maxLines: 2,
decoration: const InputDecoration(
icon: Icon(Icons.description),
labelText: 'details',
),
),
Use suffixIcon, An icon that appears after the editable part of the text field and after the suffix or suffixText, within the decoration's container.Official API Doc
TextFormField(
textAlign: TextAlign.right,
decoration: InputDecoration(
hintText: "Enter a message",
suffixIcon: Icon(Icons.description),
),
),
This exactly what you need, you need to customize some style
@override
Widget build(BuildContext context) {
return Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
width: 200,
child: TextFormField(
textAlign: TextAlign.right,
decoration: InputDecoration(
hintText: "Enter a message",
),
),
),
Container(
child: Icon(Icons.description),
),
],
);
}

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With