Simple package to change the direction of TextField, Text,... to RTL/LTR based on the text, and set default direction for them.!
- Flutter
- Dart
-
Add auto_rtl to pubspec.yaml of your project
[auto_rtl]: git: url: https://github.com/ShawnAlisson/auto_rtl
-
Wrap your widget with this
...
String yourText = "";
...
AutoRTL(
content: yourText,
defaultRTL: true
//For LTR, it should be false, or it can be based on the language.
//For example, defaultRTL: Localizations.localeOf(context).toString() == "fa" ? true : false
child: TextField(
onChanged: (value){
setState(() {
yourText = value;
});
},
),
)