I'm working on an application that should also work with RTL layout direction (Arabic and Hebrew languages).
I also need to perform some changes in the layout in case the layout direction is RTL.
How can I determine what is the current layout direction of the app?
You can get the current direction using Directionality.of
.
final TextDirection currentDirection = Directionality.of(context);
final bool isRTL = currentDirection == TextDirection.rtl;
which determines `the direction of the selctedlanguage but if need you to set it manually, probably this can work for you.
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
theme: ThemeData(),
home: Directionality(
textDirection: TextDirection.rtl,
child: Home(),
),
);
}
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