This commit is contained in:
Hamza Aleghwairyeen
2024-04-16 10:22:01 +03:00
parent a2d4cd845c
commit 24b3804045
18 changed files with 457 additions and 226 deletions

View File

@@ -305,14 +305,14 @@ class CountryPicker extends StatelessWidget {
final ProfileController controller = Get.put(ProfileController());
final List<String> countryOptions = [
'Jordan'.tr,
'USA'.tr,
'Eygpt'.tr,
'Turkey'.tr,
'Saudi Arabia'.tr,
'Qatar'.tr,
'Bahrain'.tr,
'Kuwait'.tr,
'Jordan',
'USA',
'Egypt',
'Turkey',
'Saudi Arabia',
'Qatar',
'Bahrain',
'Kuwait',
];
CountryPicker({Key? key}) : super(key: key);
@@ -341,27 +341,33 @@ class CountryPicker extends StatelessWidget {
itemExtent: 32,
onSelectedItemChanged: (int index) {
controller.setCountry(countryOptions[index]);
box.write(BoxName.countryCode,
countryOptions[index]); // Save in English
},
children: List.generate(
countryOptions.length,
(index) => Center(
child: Text(
countryOptions[index],
countryOptions[index]
.tr, // Display translated if not English
style: AppStyle.title,
),
),
),
),
),
MyElevatedButton(
title: 'Select Country'.tr,
onPressed: () {
Get.find<LoginController>()
.saveCountryCode(controller.selectedCountry.toString());
box.write(
BoxName.countryCode, controller.selectedCountry.toString());
Get.off(LoginPage());
})
title: 'Select Country'.tr, // Use translated text for button
onPressed: () {
Get.find<LoginController>().saveCountryCode(controller
.selectedCountry
.toString()); // No conversion needed
box.write(BoxName.countryCode,
controller.selectedCountry); // Already saved in English
Get.off(LoginPage());
},
)
],
);
});