I have the following codes in my login page:
@override
Widget build(BuildContext context) {
return Scaffold(
body: Directionality(
textDirection: TextDirection.rtl,
child: . . .
.
.
.
showDialog(
context: context,
barrierDismissible: false,
builder: (context) => AlertDialog(
title: const Text('خطا'),
content: Text('جهت تست'),
actions: [
TextButton(
onPressed: () {
Navigator.pop(context);
},
child: const Text("تایید"))
],
),
);
}
When I run the code, everything is in RTL mode but the dialog is in LTR mode. How can I make it RTL?
2
Answers
The best and shortest way to set RTL configuration for the entire app.
If you need to display text in reverse direction then just set it’s textdirection property to TextDirection.rtl.
OR :
Example code for TextField widget,
Example code for Text widget,
wrap the widget returned in the showDialog with a
Directionality
:With changing
/* your text direction*/
with your desired direction.