亲爱的Flutter开发人员
如何将我的抽屉内容(包括帐户信息)从右到左放置。图片中包含了结果,您可以看到文本在左侧,但我想至少将它们放在右侧或中间。谢谢
我的代码像下面这样:
endDrawer: Drawer(
child: new Column(
textDirection: TextDirection.rtl,
children: <Widget> [
Padding(
padding:
const EdgeInsets.only(top: 22.0, left: 42.0, right: 42.0),
),
new UserAccountsDrawerHeader(
currentAccountPicture: new CircleAvatar (
backgroundColor: Colors.blue,
child: Image.asset("assets/img/logo.png"),
),
accountName: Text("عنوان",style: TextStyle(
fontFamily: "Bahij",
fontSize: 14,
),textAlign: TextAlign.center,),
accountEmail:
Text("ایمیل آدرس[![enter image description here][1]][1]" ,style: TextStyle(
fontFamily: "Bahij",
fontSize: 14,
),textAlign: TextAlign.center,textDirection: TextDirection.rtl),
)
]
)
),
您可以使用方向性小部件包装抽屉。
Directionality(
textDirection: isRtl ? TextDirection.rtl : TextDirection.ltr,
child: your drawer,
)
如果要本地化您的应用,则应这样编写MaterialApp小部件:
MaterialApp(
debugShowCheckedModeBanner: false,
title: 'my app',
localizationsDelegates: [
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
],
supportedLocales: [
Locale(
"languageCode", "countryCode"
),
],
locale: Locale(
"languageCode", "countryCode"
),
theme: mainThemeData,
home: AppSplash(),
)
用您的语言和国家代码更改countryCode和languageCode