Search code examples
androidiosflutterflutter-layoutappbar

Flutter RTL AppBar Icon postion


what I am asking for is to add an icon in appBar in flutter ... I have active the localization property so my App is RTL Now

  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

... the problem is the drawer menu Icon in right which is right ... but when I add Icon in leading property in appBar it doesn't go to the left side ... but it replaced the drawer Icon !!!

// 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),
  ),

Best regards


Solution

  • set automaticallyImplyLeading to 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),
    ),