颤动将抽屉内容从右到左
flutter put drawer content right to left
尊敬的 Flutter 开发者
如何将我的抽屉内容从右到左放置,包括帐户 information.the 结果包含图片,您可以看到文本在左侧,但我想将它们放在右侧或至少居中。
谢谢
我的代码如下:
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
尊敬的 Flutter 开发者
如何将我的抽屉内容从右到左放置,包括帐户 information.the 结果包含图片,您可以看到文本在左侧,但我想将它们放在右侧或至少居中。 谢谢
我的代码如下:
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