Flutter Easy Localization Doesn't Change Bottom Navigation Bar Item's Titles

182 Views Asked by At

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

1

There are 1 best solutions below

0
Farzad On

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);