0

I am using easy_localization 3.0.1 for use several language in my app.

main file have 4 pages to navigate and I am using bottom navigation bar to change body of this file.

In Profile page I should have change language of the app with button

onPressed:(){context.setLocale(Locale("tr", "TR"));}

but with this function the title's of the bottom navigation bar items are not changing. When I use setState they are changing but i need to make it without setState

WSBT
  • 33,033
  • 18
  • 128
  • 133

1 Answers1

0

You can use Getx , GetX Translation is best option for localization

return GetMaterialApp(
    translations: Messages(),  
    locale: Locale('tr', 'TR'),  
     
);

Using translation with parameters

Map<String, Map<String, String>> get keys => {
    'en_US': {
        'logged_in': 'logged in as @name with email @email',
    },
    'tr_TR': {
       'logged_in': '@name ile e-posta @email olarak giriş yaptı',
    }
};

Change locale

var locale = Locale('tr', 'TR');
Get.updateLocale(locale);
Farzad
  • 212
  • 2
  • 6
  • 19