5/11/4
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.9 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 4.4 KiB After Width: | Height: | Size: 5.8 KiB |
|
Before Width: | Height: | Size: 7.6 KiB After Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 354 KiB |
|
After Width: | Height: | Size: 667 B |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 3.0 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 5.1 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 4.5 KiB |
|
After Width: | Height: | Size: 8.1 KiB |
|
After Width: | Height: | Size: 2.3 KiB |
|
After Width: | Height: | Size: 6.2 KiB |
|
After Width: | Height: | Size: 2.8 KiB |
|
After Width: | Height: | Size: 7.4 KiB |
|
After Width: | Height: | Size: 8.1 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 3.9 KiB |
|
After Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 4.2 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 13 KiB |
@@ -1,20 +1,32 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
import 'package:SEFER/constant/colors.dart';
|
||||||
|
import 'package:SEFER/views/widgets/elevated_btn.dart';
|
||||||
import 'package:background_location/background_location.dart';
|
import 'package:background_location/background_location.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:permission_handler/permission_handler.dart';
|
import 'package:permission_handler/permission_handler.dart';
|
||||||
|
|
||||||
class LocationBackgroundController extends GetxController {
|
class LocationBackgroundController extends GetxController {
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
Future<void> onInit() async {
|
||||||
super.onInit();
|
super.onInit();
|
||||||
requestLocationPermission();
|
await requestLocationPermission();
|
||||||
configureBackgroundLocation();
|
await configureBackgroundLocation();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> requestLocationPermission() async {
|
Future<void> requestLocationPermission() async {
|
||||||
var status = await Permission.locationAlways.status;
|
var status = await Permission.locationAlways.status;
|
||||||
if (!status.isGranted) {
|
if (!status.isGranted) {
|
||||||
await Permission.locationAlways.request();
|
Get.defaultDialog(
|
||||||
|
title: 'Grant Location'.tr,
|
||||||
|
middleText:
|
||||||
|
'We use location to get accurate and nearest passengers for you'
|
||||||
|
.tr,
|
||||||
|
confirm: MyElevatedButton(
|
||||||
|
kolor: AppColor.greenColor,
|
||||||
|
title: 'Grant Location'.tr,
|
||||||
|
onPressed: () async {
|
||||||
|
await Permission.locationAlways.request();
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,9 @@ class MyTranslation extends Translations {
|
|||||||
@override
|
@override
|
||||||
Map<String, Map<String, String>> get keys => {
|
Map<String, Map<String, String>> get keys => {
|
||||||
"ar": {
|
"ar": {
|
||||||
|
'Welcome to Sefer!': '',
|
||||||
|
'Get to your destination quickly and easily.': '',
|
||||||
|
'Enjoy a safe and comfortable ride.': '',
|
||||||
"Choose Language": "اخْتَر اللُّغَة",
|
"Choose Language": "اخْتَر اللُّغَة",
|
||||||
"Login": "تَسْجِيل الدُّخُول",
|
"Login": "تَسْجِيل الدُّخُول",
|
||||||
"Pay with Wallet": 'ادْفَع بِاسْتِخْدَام المَحْفَظَة',
|
"Pay with Wallet": 'ادْفَع بِاسْتِخْدَام المَحْفَظَة',
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ void main() async {
|
|||||||
print(Get.deviceLocale!.countryCode);
|
print(Get.deviceLocale!.countryCode);
|
||||||
Stripe.publishableKey = AK.publishableKey;
|
Stripe.publishableKey = AK.publishableKey;
|
||||||
|
|
||||||
Get.put(LocationBackgroundController());
|
// Get.put(LocationBackgroundController());
|
||||||
|
|
||||||
if (Platform.isAndroid || Platform.isIOS) {
|
if (Platform.isAndroid || Platform.isIOS) {
|
||||||
await Firebase.initializeApp(
|
await Firebase.initializeApp(
|
||||||
@@ -146,11 +146,11 @@ class MyApp extends StatelessWidget {
|
|||||||
key: UniqueKey(),
|
key: UniqueKey(),
|
||||||
// routes: {'/':const HomePage()},
|
// routes: {'/':const HomePage()},
|
||||||
// home: LoginCaptin());
|
// home: LoginCaptin());
|
||||||
getPages: [
|
// getPages: [
|
||||||
GetPage(name: '/', page: () => SplashScreen()),
|
// GetPage(name: '/', page: () => SplashScreen()),
|
||||||
GetPage(
|
// GetPage(
|
||||||
name: '/OrderRequestPage/:id', page: () => OrderRequestPage()),
|
// name: '/OrderRequestPage/:id', page: () => OrderRequestPage()),
|
||||||
],
|
// ],
|
||||||
initialRoute: '/',
|
initialRoute: '/',
|
||||||
home: SplashScreen());
|
home: SplashScreen());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ class SplashScreen extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor:
|
backgroundColor:
|
||||||
AppColor.primaryColor, // Set your desired background color
|
AppColor.secondaryColor, // Set your desired background color
|
||||||
body: Center(
|
body: Center(
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
@@ -32,12 +32,19 @@ class SplashScreen extends StatelessWidget {
|
|||||||
splashScreenController.animationController.value < 0.5
|
splashScreenController.animationController.value < 0.5
|
||||||
? splashScreenController.zoomInAnimation.value
|
? splashScreenController.zoomInAnimation.value
|
||||||
: splashScreenController.zoomOutAnimation.value,
|
: splashScreenController.zoomOutAnimation.value,
|
||||||
child: Image.asset('assets/images/logo.png'),
|
child: Image.asset(
|
||||||
|
'assets/images/logo.png',
|
||||||
|
width: Get.width * .3,
|
||||||
|
height: Get.width * .3,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 30,
|
||||||
|
),
|
||||||
AnimatedTextKit(animatedTexts: [
|
AnimatedTextKit(animatedTexts: [
|
||||||
TypewriterAnimatedText(
|
TypewriterAnimatedText(
|
||||||
'Welcome to ${AppInformation.appName}',
|
'Welcome to ${AppInformation.appName}',
|
||||||
|
|||||||
@@ -9,22 +9,22 @@ import '../../../constant/colors.dart';
|
|||||||
import '../../../constant/info.dart';
|
import '../../../constant/info.dart';
|
||||||
import '../../../constant/style.dart';
|
import '../../../constant/style.dart';
|
||||||
import '../../../controller/auth/captin/login_captin_controller.dart';
|
import '../../../controller/auth/captin/login_captin_controller.dart';
|
||||||
import '../../../controller/auth/login_controller.dart';
|
|
||||||
import '../../../main.dart';
|
import '../../../main.dart';
|
||||||
import '../../home/profile/passenger_profile_page.dart';
|
|
||||||
import '../../widgets/elevated_btn.dart';
|
import '../../widgets/elevated_btn.dart';
|
||||||
import '../../widgets/my_scafold.dart';
|
import '../../widgets/my_scafold.dart';
|
||||||
import '../../widgets/mycircular.dart';
|
import '../../widgets/mycircular.dart';
|
||||||
|
import '../country_widget.dart';
|
||||||
import 'register_captin.dart';
|
import 'register_captin.dart';
|
||||||
|
|
||||||
class LoginCaptin extends StatelessWidget {
|
class LoginCaptin extends StatelessWidget {
|
||||||
final controller = Get.put(LoginCaptinController());
|
// final controller = Get.put(LoginCaptinController());
|
||||||
|
|
||||||
LoginCaptin({super.key});
|
LoginCaptin({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
// Get.put(LoginCaptinController());
|
Get.put(LoginCaptinController());
|
||||||
|
// Get.put(LocationBackgroundController());
|
||||||
return GetBuilder<LoginCaptinController>(
|
return GetBuilder<LoginCaptinController>(
|
||||||
builder: (controller) => MyScafolld(
|
builder: (controller) => MyScafolld(
|
||||||
title: 'Login Driver'.tr,
|
title: 'Login Driver'.tr,
|
||||||
@@ -313,36 +313,40 @@ class LoginCaptin extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
locationPermissionDialog() {
|
locationPermissionDialog() {
|
||||||
return Padding(
|
return GetBuilder<LoginCaptinController>(builder: (controller) {
|
||||||
padding: const EdgeInsets.all(16),
|
return box.read(BoxName.locationPermission) != 'true'
|
||||||
child: Container(
|
? Padding(
|
||||||
height: Get.height * .4,
|
padding: const EdgeInsets.all(16),
|
||||||
decoration: AppStyle.boxDecoration1,
|
child: Container(
|
||||||
child: Padding(
|
height: Get.height * .4,
|
||||||
padding: const EdgeInsets.all(20.0),
|
decoration: AppStyle.boxDecoration1,
|
||||||
child: Center(
|
child: Padding(
|
||||||
child: Column(
|
padding: const EdgeInsets.all(20.0),
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
child: Center(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
child: Column(
|
||||||
children: [
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
Text(
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
'We use location to get accurate and nearest passengers for you'
|
children: [
|
||||||
.tr,
|
Text(
|
||||||
textAlign: TextAlign.center,
|
'We use location to get accurate and nearest passengers for you'
|
||||||
style: AppStyle.title,
|
.tr,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: AppStyle.title,
|
||||||
|
),
|
||||||
|
MyElevatedButton(
|
||||||
|
title: 'Grant Location'.tr,
|
||||||
|
onPressed: () async {
|
||||||
|
await controller.getLocationPermission();
|
||||||
|
},
|
||||||
|
kolor: AppColor.greenColor,
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
MyElevatedButton(
|
),
|
||||||
title: 'Grant Location'.tr,
|
)
|
||||||
onPressed: () async {
|
: const SizedBox();
|
||||||
await controller.getLocationPermission();
|
});
|
||||||
},
|
|
||||||
kolor: AppColor.greenColor,
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
185
lib/views/auth/country_widget.dart
Normal file
@@ -0,0 +1,185 @@
|
|||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
|
import '../../constant/box_name.dart';
|
||||||
|
import '../../constant/colors.dart';
|
||||||
|
import '../../constant/style.dart';
|
||||||
|
import '../../controller/auth/captin/login_captin_controller.dart';
|
||||||
|
import '../../controller/profile/profile_controller.dart';
|
||||||
|
import '../../main.dart';
|
||||||
|
import '../widgets/elevated_btn.dart';
|
||||||
|
import 'captin/login_captin.dart';
|
||||||
|
|
||||||
|
class CountryPicker extends StatelessWidget {
|
||||||
|
final ProfileController controller = Get.put(ProfileController());
|
||||||
|
|
||||||
|
final List<String> countryOptions = [
|
||||||
|
'Jordan',
|
||||||
|
'USA',
|
||||||
|
'Egypt',
|
||||||
|
'Turkey',
|
||||||
|
'Saudi Arabia',
|
||||||
|
'Qatar',
|
||||||
|
'Bahrain',
|
||||||
|
'Kuwait',
|
||||||
|
];
|
||||||
|
|
||||||
|
CountryPicker({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return GetBuilder<ProfileController>(builder: (controller) {
|
||||||
|
return Padding(
|
||||||
|
padding: const EdgeInsets.all(20),
|
||||||
|
child: ListView(
|
||||||
|
children: [
|
||||||
|
const SizedBox(
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
"Select Your Country".tr,
|
||||||
|
style: AppStyle.headTitle2,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
// const SizedBox(
|
||||||
|
// height: 20,
|
||||||
|
// ),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(10),
|
||||||
|
child: Text(
|
||||||
|
"To ensure you receive the most accurate information for your location, please select your country below. This will help tailor the app experience and content to your country."
|
||||||
|
.tr,
|
||||||
|
style: AppStyle.title,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 200,
|
||||||
|
child: CupertinoPicker(
|
||||||
|
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]
|
||||||
|
.tr, // Display translated if not English
|
||||||
|
style: AppStyle.title,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
MyElevatedButton(
|
||||||
|
title: 'Select Country'.tr, // Use translated text for button
|
||||||
|
onPressed: () {
|
||||||
|
Get.find<LoginCaptinController>().saveCountryCode(controller
|
||||||
|
.selectedCountry
|
||||||
|
.toString()); // No conversion needed
|
||||||
|
box.write(
|
||||||
|
BoxName.countryCode, //
|
||||||
|
controller.selectedCountry); // Already saved in English
|
||||||
|
Get.snackbar(controller.selectedCountry.toString().tr, '');
|
||||||
|
Get.off(LoginCaptin());
|
||||||
|
},
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class CountryPickerFromSetting extends StatelessWidget {
|
||||||
|
final ProfileController controller = Get.put(ProfileController());
|
||||||
|
final LoginCaptinController loginController =
|
||||||
|
Get.put(LoginCaptinController());
|
||||||
|
|
||||||
|
final List<String> countryOptions = [
|
||||||
|
'Jordan',
|
||||||
|
'USA',
|
||||||
|
'Egypt',
|
||||||
|
'Turkey',
|
||||||
|
'Saudi Arabia',
|
||||||
|
'Qatar',
|
||||||
|
'Bahrain',
|
||||||
|
'Kuwait',
|
||||||
|
];
|
||||||
|
|
||||||
|
CountryPickerFromSetting({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return GetBuilder<ProfileController>(builder: (controller) {
|
||||||
|
return Padding(
|
||||||
|
padding: const EdgeInsets.all(20.0),
|
||||||
|
child: ListView(
|
||||||
|
children: [
|
||||||
|
const SizedBox(
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
"Select Your Country".tr,
|
||||||
|
style: AppStyle.headTitle2,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
// const SizedBox(
|
||||||
|
// height: 20,
|
||||||
|
// ),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(10),
|
||||||
|
child: Text(
|
||||||
|
"To ensure you receive the most accurate information for your location, please select your country below. This will help tailor the app experience and content to your country."
|
||||||
|
.tr,
|
||||||
|
style: AppStyle.title,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 200,
|
||||||
|
child: CupertinoPicker(
|
||||||
|
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]
|
||||||
|
.tr, // Display translated if not English
|
||||||
|
style: AppStyle.title,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
MyElevatedButton(
|
||||||
|
title: 'Select Country'.tr, // Use translated text for button
|
||||||
|
onPressed: () async {
|
||||||
|
loginController.saveCountryCode(controller.selectedCountry
|
||||||
|
.toString()); // No conversion needed
|
||||||
|
box.write(
|
||||||
|
BoxName.countryCode, //
|
||||||
|
controller.selectedCountry); // Already saved in English
|
||||||
|
Get.snackbar(controller.selectedCountry.toString().tr, '',
|
||||||
|
backgroundColor: AppColor.greenColor);
|
||||||
|
// Get.back();//
|
||||||
|
// Get.back();
|
||||||
|
},
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -10,12 +10,11 @@ import 'package:SEFER/main.dart';
|
|||||||
import 'package:SEFER/views/auth/captin/login_captin.dart';
|
import 'package:SEFER/views/auth/captin/login_captin.dart';
|
||||||
import 'package:SEFER/views/widgets/elevated_btn.dart';
|
import 'package:SEFER/views/widgets/elevated_btn.dart';
|
||||||
import 'package:SEFER/views/widgets/my_scafold.dart';
|
import 'package:SEFER/views/widgets/my_scafold.dart';
|
||||||
import 'package:SEFER/views/widgets/my_textField.dart';
|
|
||||||
|
|
||||||
import '../../constant/info.dart';
|
import '../../constant/info.dart';
|
||||||
import '../../controller/auth/login_controller.dart';
|
import '../../controller/auth/login_controller.dart';
|
||||||
import '../home/profile/passenger_profile_page.dart';
|
|
||||||
import '../widgets/mycircular.dart';
|
import '../widgets/mycircular.dart';
|
||||||
|
import 'country_widget.dart';
|
||||||
import 'register_page.dart';
|
import 'register_page.dart';
|
||||||
|
|
||||||
class LoginPage extends StatelessWidget {
|
class LoginPage extends StatelessWidget {
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import 'package:SEFER/constant/colors.dart';
|
import 'package:SEFER/constant/colors.dart';
|
||||||
import 'package:SEFER/controller/profile/setting_controller.dart';
|
import 'package:SEFER/controller/profile/setting_controller.dart';
|
||||||
import 'package:SEFER/views/home/profile/passenger_profile_page.dart';
|
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_font_icons/flutter_font_icons.dart';
|
import 'package:flutter_font_icons/flutter_font_icons.dart';
|
||||||
@@ -9,6 +8,8 @@ import 'package:SEFER/constant/style.dart';
|
|||||||
import 'package:SEFER/views/lang/languages.dart';
|
import 'package:SEFER/views/lang/languages.dart';
|
||||||
import 'package:SEFER/views/widgets/my_scafold.dart';
|
import 'package:SEFER/views/widgets/my_scafold.dart';
|
||||||
|
|
||||||
|
import '../../auth/country_widget.dart';
|
||||||
|
|
||||||
class SettingsCaptain extends StatelessWidget {
|
class SettingsCaptain extends StatelessWidget {
|
||||||
const SettingsCaptain({super.key});
|
const SettingsCaptain({super.key});
|
||||||
|
|
||||||
|
|||||||
@@ -303,176 +303,3 @@ class EducationDegreePicker extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class CountryPicker extends StatelessWidget {
|
|
||||||
final ProfileController controller = Get.put(ProfileController());
|
|
||||||
|
|
||||||
final List<String> countryOptions = [
|
|
||||||
'Jordan',
|
|
||||||
'USA',
|
|
||||||
'Egypt',
|
|
||||||
'Turkey',
|
|
||||||
'Saudi Arabia',
|
|
||||||
'Qatar',
|
|
||||||
'Bahrain',
|
|
||||||
'Kuwait',
|
|
||||||
];
|
|
||||||
|
|
||||||
CountryPicker({Key? key}) : super(key: key);
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return GetBuilder<ProfileController>(builder: (controller) {
|
|
||||||
return Padding(
|
|
||||||
padding: const EdgeInsets.all(20),
|
|
||||||
child: ListView(
|
|
||||||
children: [
|
|
||||||
const SizedBox(
|
|
||||||
height: 20,
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
"Select Your Country".tr,
|
|
||||||
style: AppStyle.headTitle2,
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
),
|
|
||||||
// const SizedBox(
|
|
||||||
// height: 20,
|
|
||||||
// ),
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.all(10),
|
|
||||||
child: Text(
|
|
||||||
"To ensure you receive the most accurate information for your location, please select your country below. This will help tailor the app experience and content to your country."
|
|
||||||
.tr,
|
|
||||||
style: AppStyle.title,
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
height: 200,
|
|
||||||
child: CupertinoPicker(
|
|
||||||
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]
|
|
||||||
.tr, // Display translated if not English
|
|
||||||
style: AppStyle.title,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
MyElevatedButton(
|
|
||||||
title: 'Select Country'.tr, // Use translated text for button
|
|
||||||
onPressed: () {
|
|
||||||
Get.find<LoginCaptinController>().saveCountryCode(controller
|
|
||||||
.selectedCountry
|
|
||||||
.toString()); // No conversion needed
|
|
||||||
box.write(
|
|
||||||
BoxName.countryCode, //
|
|
||||||
controller.selectedCountry); // Already saved in English
|
|
||||||
Get.snackbar(controller.selectedCountry.toString().tr, '');
|
|
||||||
Get.off(LoginCaptin());
|
|
||||||
},
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class CountryPickerFromSetting extends StatelessWidget {
|
|
||||||
final ProfileController controller = Get.put(ProfileController());
|
|
||||||
final LoginCaptinController loginController =
|
|
||||||
Get.put(LoginCaptinController());
|
|
||||||
|
|
||||||
final List<String> countryOptions = [
|
|
||||||
'Jordan',
|
|
||||||
'USA',
|
|
||||||
'Egypt',
|
|
||||||
'Turkey',
|
|
||||||
'Saudi Arabia',
|
|
||||||
'Qatar',
|
|
||||||
'Bahrain',
|
|
||||||
'Kuwait',
|
|
||||||
];
|
|
||||||
|
|
||||||
CountryPickerFromSetting({Key? key}) : super(key: key);
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return GetBuilder<ProfileController>(builder: (controller) {
|
|
||||||
return Padding(
|
|
||||||
padding: const EdgeInsets.all(20.0),
|
|
||||||
child: ListView(
|
|
||||||
children: [
|
|
||||||
const SizedBox(
|
|
||||||
height: 20,
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
"Select Your Country".tr,
|
|
||||||
style: AppStyle.headTitle2,
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
),
|
|
||||||
// const SizedBox(
|
|
||||||
// height: 20,
|
|
||||||
// ),
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.all(10),
|
|
||||||
child: Text(
|
|
||||||
"To ensure you receive the most accurate information for your location, please select your country below. This will help tailor the app experience and content to your country."
|
|
||||||
.tr,
|
|
||||||
style: AppStyle.title,
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
height: 200,
|
|
||||||
child: CupertinoPicker(
|
|
||||||
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]
|
|
||||||
.tr, // Display translated if not English
|
|
||||||
style: AppStyle.title,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
MyElevatedButton(
|
|
||||||
title: 'Select Country'.tr, // Use translated text for button
|
|
||||||
onPressed: () async {
|
|
||||||
loginController.saveCountryCode(controller.selectedCountry
|
|
||||||
.toString()); // No conversion needed
|
|
||||||
box.write(
|
|
||||||
BoxName.countryCode, //
|
|
||||||
controller.selectedCountry); // Already saved in English
|
|
||||||
Get.snackbar(controller.selectedCountry.toString().tr, '',
|
|
||||||
backgroundColor: AppColor.greenColor);
|
|
||||||
// Get.back();//
|
|
||||||
// Get.back();
|
|
||||||
},
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 119 KiB After Width: | Height: | Size: 354 KiB |
|
Before Width: | Height: | Size: 6.4 KiB After Width: | Height: | Size: 8.9 KiB |
|
Before Width: | Height: | Size: 397 B After Width: | Height: | Size: 489 B |
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 976 B After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 48 KiB After Width: | Height: | Size: 83 KiB |
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 3.3 KiB |
BIN
web/favicon.png
|
Before Width: | Height: | Size: 397 B After Width: | Height: | Size: 489 B |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 48 KiB After Width: | Height: | Size: 83 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 48 KiB After Width: | Height: | Size: 83 KiB |
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 2.2 KiB |