将 AppBar 中的文本方向从 LTR 更改为 RTL 颤动

Hus*_*awi 2 dart flutter flutter-appbar

我有一个正在构建的应用程序,其中有一个AppBar. 我的文本是阿拉伯语,我想将文本位置从LTR(从左到右)更改为RTL(从右到左)

\n

这是屏幕截图AppBar

\n

在此输入图像描述

\n

这是我的代码AppBar

\n
class MyAppBar extends StatelessWidget with PreferredSizeWidget {\n\n  @override\n  Size get preferredSize => Size.fromHeight(kToolBarHeight);\n\n  @override\n  Widget build(BuildContext context) {\n    return AppBar(\n      title: Text(\n        kAppBarTitleFirst,\n      ),\n    );\n  }\n}\n\n
Run Code Online (Sandbox Code Playgroud)\n

所以问题是:-我怎样才能让文本\xd8\xb9\xd9\x86\xd9\x88\xd8\xa7\xd9\x86 \xd8\xa7\xd9\x84\xd8\xaa\xd8\xb7\xd8\xa8\xd9\x8a\xd9\x82位于我标记的红色位置(参见上面的屏幕截图)

\n

Anu*_*thi 7

如果您希望整个应用程序中的文本方向从右到左,而不仅仅是在应用程序栏中,您可以Directionality提供MaterialApp

MaterialApp(
 builder: (context, child) {
    return Directionality(
      textDirection: TextDirection.rtl,
      child: child,
    );
  },
);
Run Code Online (Sandbox Code Playgroud)