1

I have an Homepage with dummy categories which wont update after i changed language inside the app. I use Easy localization package, and everything works fine. There are 3 pages on my app, but the Homepage is the only one that wont update. It does, only when i perform a hot reload from Android Studio.

In my app settings, i use steState() to setLocale language, but it seems to not affect the Homepage.

So, i came at conclusion to use a method to rebuild app after user change language. What is your thoughts? How to rebuild the app after saving languages preferences?

RadioListTile(
                 title: Text('Italiano'), value: Language.Italian, groupValue: _selecIndex, subtitle: Text('Italian'),
                      onChanged: (newValue) {
                   _selecIndex = newValue;
                   setState((){
                     setLocale(index = 'IT');
                   });
                 }),

 //some code ....

void setLocale(index) async {
if (index == 'EN'){
  await context.setLocale(Locale('en','US'));
}
else if (index == 'FR'){
  await context.setLocale(Locale('fr','FR'));
}
else if (index == 'IT'){
  await context.setLocale(Locale('it','IT'));
}

}

Giovanni
  • 512
  • 2
  • 6
  • 23
  • Does this answer your question? [Button to change the language Flutter](https://stackoverflow.com/questions/65307961/button-to-change-the-language-flutter) – user18309290 Aug 24 '22 at 15:33

0 Answers0