Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

change labelText direction to RTL in InputDecoration() flutter

Tags:

just I want to change direction of labelText to RTL in below code:

 new TextField(      textAlign: TextAlign.right,      controller: _textEdittingControler_bookName,      autofocus: true,      decoration: new InputDecoration(                 labelText: "افزودن کتاب",                 hintText: "نام کتاب را وارد کنید"                 ),      ) 
like image 968
Mo Meshkani Avatar asked Aug 04 '18 15:08

Mo Meshkani


People also ask

How do you make the Flutter app right to left?

To change the rendering direction from right to left, wrap the SfDataGrid widget inside the Directionality widget and set the textDirection property as TextDirection. rtl.

How do you make text go from left to right flutter?

TextAlign. justify horizontally justifies the text over its container. textDirection: textDirection is used to specify the direction of the text inside a Text Widget say ltr (left-to-right) or rtl (right to left). ltr is the default text direction.


2 Answers

Simply use Directionality:

new Directionality(     textDirection: TextDirection.rtl,     child: TextField(      textAlign: TextAlign.right,      controller: _textEdittingControler_bookName,      autofocus: true,      decoration: new InputDecoration(                 labelText: "افزودن کتاب",                 hintText: "نام کتاب را وارد کنید"                 ),      ) 

Directionality's docs

like image 75
Yamin Avatar answered Sep 17 '22 14:09

Yamin


Can be used textAlign

            TextFormField(               textAlign: TextAlign.right,               decoration: InputDecoration(                 hintText: 'ادخل تفاصيل الكتابة الخاصة بك',               ), 
like image 20
Muhannad Mahamooad Avatar answered Sep 17 '22 14:09

Muhannad Mahamooad