[英]Flutter RTL AppBar Icon postion
我要求的是在撲動的 appBar 中添加一個圖標......我已經激活了本地化屬性,所以我的應用程序現在是 RTL
localizationsDelegates: [
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
],
supportedLocales: [
Locale("ar", "AR"), // OR Locale('ar', 'AE') OR Other RTL locales
],
locale: Locale("ar", "AR"), // OR Locale('ar', 'AE') OR Other RTL locales
...問題是右側的抽屜菜單圖標是正確的...但是當我在 appBar 的領先屬性中添加圖標時,它不會轉到左側...但它取代了抽屜圖標!
// 應用欄
appBar: new AppBar(
leading: Icon(Icons.person,),
title: new Text("الرئيسية",
style: new TextStyle(fontFamily: 'RPT Bold',
fontSize: 16.0,
color: Colors.amber
),
),
centerTitle: true,
iconTheme: new IconThemeData(color: Colors.amber),
),
最好的祝福
將automaticallyImplyLeading
設置為false:
appBar: new AppBar(
automaticallyImplyLeading: false,
leading: Icon(Icons.person,),
title: new Text("الرئيسية",
style: new TextStyle(fontFamily: 'RPT Bold',
fontSize: 16.0,
color: Colors.amber
),
),
centerTitle: true,
iconTheme: new IconThemeData(color: Colors.amber),
),
您可以使用 Directionality 包裹您的腳手架並將文本方向設置為 RTL。 這種方式不需要本地化屬性。
Widget build(BuildContext context) {
return Directionality(
textDirection: TextDirection.rtl,
child: Scaffold(
appBar: AppBar(
centerTitle: true,
title: Text('title'),
),
body: Container(child: Text('text'))),
);}}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.