showLanguagePopup method
void
showLanguagePopup(
)
Implementation
void showLanguagePopup(BuildContext context) {
// Get the current locale to show the selected language
Locale currentLocale = Get.locale ?? Get.deviceLocale!;
Get.defaultDialog(
title: 'Choose Language',
titleStyle: TextStyles.medium(context),
content: Column(
children: [
ListTile(
title: AppText('English', style: TextStyles.medium(context)),
trailing: currentLocale.languageCode == 'en'
? const Icon(Icons.check, color: Colors.green)
: null,
onTap: () {
changeLanguage('English');
updateLocal(const Locale('en', 'US'));
},
),
ListTile(
title: AppText('Marathi', style: TextStyles.medium(context)),
trailing: currentLocale.languageCode == 'mr'
? const Icon(Icons.check, color: Colors.green)
: null,
onTap: () {
changeLanguage('Marathi');
updateLocal(const Locale('mr', 'IN'));
},
),
ListTile(
title: AppText('Hindi', style: TextStyles.medium(context)),
trailing: currentLocale.languageCode == 'hi'
? const Icon(Icons.check, color: Colors.green)
: null,
onTap: () {
changeLanguage('Hindi');
updateLocal(const Locale('hi', 'IN'));
},
),
],
),
);
}