diff --git a/lib/constant/box_name.dart b/lib/constant/box_name.dart index ef510cd..a821afc 100644 --- a/lib/constant/box_name.dart +++ b/lib/constant/box_name.dart @@ -26,6 +26,7 @@ class BoxName { static const String lastNameDriver = "lastNameDriver"; static const String name = "name"; static const String nameDriver = "nameDriver"; + static const String driverPhotoUrl = "driverPhotoUrl"; static const String email = "email"; static const String emailDriver = "emailDriver"; static const String tokens = "tokens"; diff --git a/lib/controller/auth/google_sign.dart b/lib/controller/auth/google_sign.dart new file mode 100644 index 0000000..7fa4c77 --- /dev/null +++ b/lib/controller/auth/google_sign.dart @@ -0,0 +1,49 @@ +import 'package:SEFER/constant/box_name.dart'; +import 'package:SEFER/main.dart'; +import 'package:get/get.dart'; +import 'package:google_sign_in/google_sign_in.dart'; + +import '../../views/auth/captin/ai_page.dart'; + +class GoogleSignInHelper { + static final GoogleSignIn _googleSignIn = GoogleSignIn( + scopes: [ + 'email', + 'profile', + ], + ); + + static Future signIn() async { + try { + final GoogleSignInAccount? googleUser = await _googleSignIn.signIn(); + getDriverInfo(); + Get.to(() => AiPage()); + return googleUser; + } catch (error) { + print('Google Sign-In error: $error'); + return null; + } + } + + static Future signOut() async { + try { + await _googleSignIn.signOut(); + } catch (error) { + print('Google Sign-Out error: $error'); + } + } + + static GoogleSignInAccount? getCurrentUser() { + return _googleSignIn.currentUser; + } + + static String? getDriverInfo() { + final GoogleSignInAccount? user = _googleSignIn.currentUser; + box.write(BoxName.driverID, user!.id); + box.write(BoxName.emailDriver, user.email); + box.write(BoxName.nameDriver, user.displayName); + box.write(BoxName.driverPhotoUrl, user.photoUrl); + print('emailDriver =${box.read(BoxName.emailDriver)}'); + return user.displayName; + } +} diff --git a/lib/controller/home/map_passenger_controller.dart b/lib/controller/home/map_passenger_controller.dart index 039fa98..290b30e 100644 --- a/lib/controller/home/map_passenger_controller.dart +++ b/lib/controller/home/map_passenger_controller.dart @@ -1225,6 +1225,7 @@ class MapPassengerController extends GetxController { dataCarsLocationByPassenger = res; update(); } else { + // Get.snackbar('no car', 'message'); noCarString = false; dataCarsLocationByPassenger = jsonDecode(res); //print(dataCarsLocationByPassenger); @@ -1234,22 +1235,38 @@ class MapPassengerController extends GetxController { .toString(); gender = dataCarsLocationByPassenger['message'][carsOrder]['gender'] .toString(); - } + // } - // //print('driverId==============$driverId'); + // //print('driverId==============$driverId'); - carsLocationByPassenger.clear(); // Clear existing markers + carsLocationByPassenger.clear(); // Clear existing markers - // late LatLng lastDriverLocation; // Initialize a variable for last location + // late LatLng lastDriverLocation; // Initialize a variable for last location - for (var i = 0; i < dataCarsLocationByPassenger['message'].length; i++) { - var json = dataCarsLocationByPassenger['message'][i]; - print(json); - CarLocationModel model = CarLocationModel.fromJson(json); - if (carLocationsModels.length < i + 1) { - carLocationsModels.add(model); - markers.add( - Marker( + for (var i = 0; + i < dataCarsLocationByPassenger['message'].length; + i++) { + var json = dataCarsLocationByPassenger['message'][i]; + print(json); + CarLocationModel model = CarLocationModel.fromJson(json); + if (carLocationsModels.length < i + 1) { + carLocationsModels.add(model); + markers.add( + Marker( + markerId: MarkerId(json['latitude']), + position: LatLng( + double.parse(json['latitude']), + double.parse(json['longitude']), + ), + rotation: double.parse(json['heading']), + icon: carIcon, + ), + ); + driversToken.add(json['token']); + // driversToken = json['token']; + } else { + carLocationsModels[i] = model; + markers[i] = Marker( markerId: MarkerId(json['latitude']), position: LatLng( double.parse(json['latitude']), @@ -1257,23 +1274,10 @@ class MapPassengerController extends GetxController { ), rotation: double.parse(json['heading']), icon: carIcon, - ), - ); - driversToken.add(json['token']); - // driversToken = json['token']; - } else { - carLocationsModels[i] = model; - markers[i] = Marker( - markerId: MarkerId(json['latitude']), - position: LatLng( - double.parse(json['latitude']), - double.parse(json['longitude']), - ), - rotation: double.parse(json['heading']), - icon: carIcon, - ); - // driversToken = json['token']; - driversToken.add(json['token']); + ); + // driversToken = json['token']; + driversToken.add(json['token']); + } } } diff --git a/lib/controller/local/translations.dart b/lib/controller/local/translations.dart index e29070c..96236b3 100644 --- a/lib/controller/local/translations.dart +++ b/lib/controller/local/translations.dart @@ -570,14 +570,19 @@ class MyTranslation extends Translations { 'Pick your ride location on the map - Tap to confirm': 'حدد موقع ‏الالتقاء على الخريطة - اضغط للتأكيد', "To Work": "إلى العمل", + 'Are you want to go this site': '‏هل تريد الذهاب إلى هذا المكان', 'Closest & Cheapest': ' الأقرب ', "Work Saved": "تم حفظ العمل", + 'Sefer is the ride-hailing app that is safe, reliable, and accessible.': + '"سفر: تطبيق طلب السيارة الآمن والموثوق والمعتمد"', + 'With Sefer, you can get a ride to your destination in minutes.': + 'مع سفر، يمكنك الحصول على رحلة إلى وجهتك في دقائق.', + 'Sefer is committed to safety, and all of our captains are carefully screened and background checked.': + 'تلتزم سفر بالسلامة، ويتم فحص جميع سائقينا وفحص سجلاتهم الشخصية بعناية.', "To Home": "إلى المنزل", "Home Saved": "تم حفظ المنزل", - "Destination Selected": - "تم تحديد الوجهة:", // "Tam تحديد al-waṣʿah:", (literally "The destination has been determined:") - "Now select start pick": - "حدد موقع الانطلاق الآن:", // "Ḥaddid mowāqiʿ al-inṭilāq al-ʾān:", (literally "Specify the starting location now:") + "Destination selected": "تم تحديد الوجهة:", + "Now select start pick": "حدد موقع الانطلاق الآن:", "Pick from map": "اختيار من الخريطة", "Click here point": "حدد هذا المكان", "No Car in your site. Sorry!": "لا توجد سيارة في موقعك. آسف!", diff --git a/lib/controller/profile/profile_controller.dart b/lib/controller/profile/profile_controller.dart index 83eaef5..104f05a 100644 --- a/lib/controller/profile/profile_controller.dart +++ b/lib/controller/profile/profile_controller.dart @@ -92,7 +92,7 @@ class ProfileController extends GetxController { }); if (res.toString() == 'failure') { - Get.snackbar('failure', 'message'); + // Get.snackbar('failure', 'message'); isloading = false; update(); } else { diff --git a/lib/views/auth/captin/ai_page.dart b/lib/views/auth/captin/ai_page.dart index 32410be..6aaba72 100644 --- a/lib/views/auth/captin/ai_page.dart +++ b/lib/views/auth/captin/ai_page.dart @@ -1,4 +1,5 @@ import 'package:SEFER/constant/box_name.dart'; +import 'package:SEFER/controller/functions/crud.dart'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:SEFER/constant/colors.dart'; @@ -11,6 +12,7 @@ import 'package:SEFER/views/widgets/elevated_btn.dart'; import 'package:SEFER/views/widgets/my_scafold.dart'; import 'package:SEFER/views/widgets/mycircular.dart'; +import '../../../constant/links.dart'; import '../../../controller/functions/gemeni.dart'; class AiPage extends StatelessWidget { @@ -21,46 +23,20 @@ class AiPage extends StatelessWidget { @override Widget build(BuildContext context) { return MyScafolld( - title: 'AI Page'.tr, + title: 'Documents check'.tr, body: [ - box.read(BoxName.countryCode) == 'USA' - ? Positioned( - top: 3, - left: Get.width * .2, - right: Get.width * .2, - child: MyElevatedButton( - title: 'Take Picture Of ID Card'.tr, - onPressed: () { - scanDocumentsByApi.scanDocumentsByApi(); - }, - )) - : box.read(BoxName.countryCode) == 'Jordan' - ? Positioned( - top: 3, - left: Get.width * .1, - right: Get.width * .1, - child: MyElevatedButton( - title: 'Take Picture Of Driver License Card'.tr, - onPressed: () { - contentController.getDriverLicenseJordanContent(); - }, - )) - : Positioned( - top: 3, - left: Get.width * .1, - right: Get.width * .1, - child: MyElevatedButton( - title: 'Take Picture Of Driver License Card'.tr, //egypt - onPressed: () { - contentController - .getDriverLicenseJordanContent(); //egypt - }, - )), - box.read(BoxName.countryCode) == 'USA' - ? usaDriverLicensWidget() - : box.read(BoxName.countryCode) == 'Jordan' - ? jordanDriverLicenseWidget() - : egyptDriverLicenseWidget() + // box.read(BoxName.countryCode) == 'USA' + // ? UsaAiDocuments(scanDocumentsByApi: scanDocumentsByApi) + // : box.read(BoxName.countryCode) == 'Jordan' + // ? JordanDocumants(contentController: contentController) + // : + // EgyptDocuments(contentController: contentController), + // box.read(BoxName.countryCode) == 'USA' + // ? usaDriverLicensWidget() + // : box.read(BoxName.countryCode) == 'Jordan' + // ? jordanDriverLicenseWidget() + // : + egyptDriverLicenseWidget() ], isleading: true); } @@ -87,14 +63,14 @@ class AiPage extends StatelessWidget { child: ListView( children: [ Container( - decoration: AppStyle.boxDecoration, + decoration: AppStyle.boxDecoration1, // height: Get.height * .4, child: Padding( padding: const EdgeInsets.all(5), child: contentController.responseMap.isEmpty ? Center( child: Text( - 'There is no data yet.'.tr, + 'Take Picture Of ID Card'.tr, style: AppStyle.title, ), ) @@ -318,45 +294,6 @@ class AiPage extends StatelessWidget { ) ])) : const SizedBox() - // MyElevatedButton( - // title: 'Detect Your Face '.tr, - // onPressed: () => scanDocumentsByApi - // .checkMatchFaceApi(), - // ), - // scanDocumentsByApi.res.isEmpty - // ? const SizedBox() - // : scanDocumentsByApi.res['data'] - // ['result'] - // .toString() == - // 'Same' - // ? MyElevatedButton( - // onPressed: () async { - // await registerCaptainController - // .register(); - // await registerCaptainController - // .addLisence(); - // // await scanDocumentsByApi - // // .uploadImagePortrate(); - // }, - // title: - // 'Go to next step\nscan Car License.' - // .tr, - // kolor: AppColor.greenColor, - // ) - // : const SizedBox(), - // MyElevatedButton( - // title: 'get sql data', - // kolor: AppColor.yellowColor, - // onPressed: () { - // sql.deleteAllData( - // TableName.faceDetectTimes); - // sql - // .getAllData( - // TableName.faceDetectTimes) - // .then((value) => print( - // value[0]['faceDetectTimes'])); - // }, - // ), ], ), ), @@ -378,14 +315,22 @@ class AiPage extends StatelessWidget { : Column( children: [ Container( - decoration: AppStyle.boxDecoration, + decoration: AppStyle.boxDecoration1, height: Get.height * .35, child: Padding( padding: const EdgeInsets.all(5), child: Center( - child: Text( - 'There is no data yet.'.tr, - style: AppStyle.title, + child: InkWell( + onTap: () async { + await CRUD().allMethodForAI( + 'name,address,dob,nationalNo,', + AppLink.uploadEgypt, + 'idFront'); //egypt + }, + child: Text( + 'Take Picture Of ID Card'.tr, + style: AppStyle.title, + ), ), )), ), @@ -962,3 +907,73 @@ Output the extracted information in the following JSON formate and make date for ); } } + +class EgyptDocuments extends StatelessWidget { + const EgyptDocuments({ + super.key, + required this.contentController, + }); + + final AI contentController; + + @override + Widget build(BuildContext context) { + return Positioned( + top: 3, + left: Get.width * .1, + right: Get.width * .1, + child: MyElevatedButton( + title: 'Take Picture Of ID Card'.tr, //egypt + onPressed: () async { + await CRUD().allMethodForAI('name,address,dob,nationalNo,', + AppLink.uploadEgypt, 'idFront'); //egypt + }, + )); + } +} + +class JordanDocumants extends StatelessWidget { + const JordanDocumants({ + super.key, + required this.contentController, + }); + + final AI contentController; + + @override + Widget build(BuildContext context) { + return Positioned( + top: 3, + left: Get.width * .1, + right: Get.width * .1, + child: MyElevatedButton( + title: 'Take Picture Of Driver License Card'.tr, + onPressed: () { + contentController.getDriverLicenseJordanContent(); + }, + )); + } +} + +class UsaAiDocuments extends StatelessWidget { + const UsaAiDocuments({ + super.key, + required this.scanDocumentsByApi, + }); + + final ScanDocumentsByApi scanDocumentsByApi; + + @override + Widget build(BuildContext context) { + return Positioned( + top: 3, + left: Get.width * .2, + right: Get.width * .2, + child: MyElevatedButton( + title: 'Take Picture Of ID Card'.tr, + onPressed: () { + scanDocumentsByApi.scanDocumentsByApi(); + }, + )); + } +} diff --git a/lib/views/auth/captin/register_captin.dart b/lib/views/auth/captin/register_captin.dart index c1b909b..11929b0 100644 --- a/lib/views/auth/captin/register_captin.dart +++ b/lib/views/auth/captin/register_captin.dart @@ -1,5 +1,3 @@ -import 'package:SEFER/constant/box_name.dart'; -import 'package:SEFER/main.dart'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:SEFER/controller/auth/captin/register_captin_controller.dart'; @@ -7,6 +5,7 @@ import 'package:SEFER/views/widgets/elevated_btn.dart'; import 'package:SEFER/views/widgets/my_scafold.dart'; import '../../../constant/colors.dart'; +import '../../../controller/auth/google_sign.dart'; class RegisterCaptin extends StatelessWidget { const RegisterCaptin({super.key}); @@ -17,150 +16,151 @@ class RegisterCaptin extends StatelessWidget { return MyScafolld( title: 'Register Driver'.tr, body: [ - GetBuilder( - builder: (controller) => Form( - key: controller.formKey, - child: Padding( - padding: const EdgeInsets.all(16.0), - child: SingleChildScrollView( - child: Container( - decoration: const BoxDecoration( - boxShadow: [ - BoxShadow( - offset: Offset(3, 3), - color: AppColor.accentColor, - blurRadius: 3) - ], - color: AppColor.secondaryColor, - ), - child: Padding( - padding: const EdgeInsets.all(16), - child: Column( - children: [ - SizedBox( - width: Get.width * .8, - child: TextFormField( - keyboardType: TextInputType.emailAddress, - controller: controller.emailController, - decoration: InputDecoration( - focusedBorder: OutlineInputBorder( - borderSide: const BorderSide( - color: AppColor.primaryColor, - width: 2.0, - ), - borderRadius: BorderRadius.circular(10), - ), - fillColor: AppColor.accentColor, - hoverColor: AppColor.accentColor, - focusColor: AppColor.accentColor, - border: const OutlineInputBorder( - borderRadius: - BorderRadius.all(Radius.circular(12))), - labelText: 'Email'.tr, - hintText: 'Enter your email address'.tr, - ), - validator: (value) { - if (value!.isEmpty || - (!value.contains('@') || - !value.contains('.'))) { - return 'Please enter Your Email.'.tr; - } - return null; - }, - ), - ), - const SizedBox( - height: 15, - ), - SizedBox( - width: Get.width * .8, - child: TextFormField( - obscureText: true, - keyboardType: TextInputType.emailAddress, - controller: controller.passwordController, - decoration: InputDecoration( - focusedBorder: OutlineInputBorder( - borderSide: const BorderSide( - color: AppColor.primaryColor, - width: 2.0, - ), - borderRadius: BorderRadius.circular(10), - ), - fillColor: AppColor.accentColor, - hoverColor: AppColor.accentColor, - focusColor: AppColor.accentColor, - border: const OutlineInputBorder( - borderRadius: - BorderRadius.all(Radius.circular(12))), - labelText: 'Password'.tr, - hintText: 'Enter your Password'.tr, - ), - validator: (value) { - if (value!.isEmpty) { - return 'Please enter Your Password.'.tr; - } - if (value.length < 6) { - return 'Password must br at least 6 character.' - .tr; - } - return null; - }, - ), - ), - const SizedBox( - height: 15, - ), - SizedBox( - width: Get.width * .8, - child: TextFormField( - keyboardType: TextInputType.phone, - cursorColor: AppColor.accentColor, - controller: controller.phoneController, - decoration: InputDecoration( - focusedBorder: OutlineInputBorder( - borderSide: const BorderSide( - color: AppColor.primaryColor, - width: 2.0, - ), - borderRadius: BorderRadius.circular(10), - ), - focusColor: AppColor.accentColor, - fillColor: AppColor.accentColor, - border: const OutlineInputBorder( - borderRadius: - BorderRadius.all(Radius.circular(12))), - labelText: 'Phone'.tr, - hintText: 'Enter your phone number'.tr, - ), - validator: (value) { - if (value!.isEmpty || value.length != 10) { - return 'Please enter your phone number.'.tr; - } - return null; - }, - ), - ), - const SizedBox( - height: 15, - ), - MyElevatedButton( - title: 'Next'.tr, - onPressed: () => controller.nextToAIDetection()), - IconButton( - onPressed: () { - print(box.write(BoxName.countryCode, 'Jordan')); - print(box.read(BoxName.countryCode)); - }, - icon: const Icon(Icons.add), - ) - ], - ), - ), - ), - ), - ), - ), - ) + // GetBuilder( + // builder: (controller) => Form( + // key: controller.formKey, + // child: Padding( + // padding: const EdgeInsets.all(16.0), + // child: SingleChildScrollView( + // child: Container( + // decoration: const BoxDecoration( + // boxShadow: [ + // BoxShadow( + // offset: Offset(3, 3), + // color: AppColor.accentColor, + // blurRadius: 3) + // ], + // color: AppColor.secondaryColor, + // ), + // child: Padding( + // padding: const EdgeInsets.all(16), + // child: Column( + // children: [ + // SizedBox( + // width: Get.width * .8, + // child: TextFormField( + // keyboardType: TextInputType.emailAddress, + // controller: controller.emailController, + // decoration: InputDecoration( + // focusedBorder: OutlineInputBorder( + // borderSide: const BorderSide( + // color: AppColor.primaryColor, + // width: 2.0, + // ), + // borderRadius: BorderRadius.circular(10), + // ), + // fillColor: AppColor.accentColor, + // hoverColor: AppColor.accentColor, + // focusColor: AppColor.accentColor, + // border: const OutlineInputBorder( + // borderRadius: + // BorderRadius.all(Radius.circular(12))), + // labelText: 'Email'.tr, + // hintText: 'Enter your email address'.tr, + // ), + // validator: (value) { + // if (value!.isEmpty || + // (!value.contains('@') || + // !value.contains('.'))) { + // return 'Please enter Your Email.'.tr; + // } + // return null; + // }, + // ), + // ), + // const SizedBox( + // height: 15, + // ), + // SizedBox( + // width: Get.width * .8, + // child: TextFormField( + // obscureText: true, + // keyboardType: TextInputType.emailAddress, + // controller: controller.passwordController, + // decoration: InputDecoration( + // focusedBorder: OutlineInputBorder( + // borderSide: const BorderSide( + // color: AppColor.primaryColor, + // width: 2.0, + // ), + // borderRadius: BorderRadius.circular(10), + // ), + // fillColor: AppColor.accentColor, + // hoverColor: AppColor.accentColor, + // focusColor: AppColor.accentColor, + // border: const OutlineInputBorder( + // borderRadius: + // BorderRadius.all(Radius.circular(12))), + // labelText: 'Password'.tr, + // hintText: 'Enter your Password'.tr, + // ), + // validator: (value) { + // if (value!.isEmpty) { + // return 'Please enter Your Password.'.tr; + // } + // if (value.length < 6) { + // return 'Password must br at least 6 character.' + // .tr; + // } + // return null; + // }, + // ), + // ), + // const SizedBox( + // height: 15, + // ), + // SizedBox( + // width: Get.width * .8, + // child: TextFormField( + // keyboardType: TextInputType.phone, + // cursorColor: AppColor.accentColor, + // controller: controller.phoneController, + // decoration: InputDecoration( + // focusedBorder: OutlineInputBorder( + // borderSide: const BorderSide( + // color: AppColor.primaryColor, + // width: 2.0, + // ), + // borderRadius: BorderRadius.circular(10), + // ), + // focusColor: AppColor.accentColor, + // fillColor: AppColor.accentColor, + // border: const OutlineInputBorder( + // borderRadius: + // BorderRadius.all(Radius.circular(12))), + // labelText: 'Phone'.tr, + // hintText: 'Enter your phone number'.tr, + // ), + // validator: (value) { + // if (value!.isEmpty || value.length != 10) { + // return 'Please enter your phone number.'.tr; + // } + // return null; + // }, + // ), + // ), + // const SizedBox( + // height: 15, + // ), + // MyElevatedButton( + // title: 'Next'.tr, + // onPressed: () => controller.nextToAIDetection()), + // ], + // ), + // ), + // ), + // ), + // ), + // ), + // ) + Center( + child: MyElevatedButton( + title: 'Sign In by Google'.tr, + onPressed: () async { + await GoogleSignInHelper.signIn(); + }, + kolor: AppColor.blueColor, + )) ], isleading: true); } diff --git a/lib/views/home/map_widget.dart/cancel_raide_page.dart b/lib/views/home/map_widget.dart/cancel_raide_page.dart index 75dc156..a0c90e1 100644 --- a/lib/views/home/map_widget.dart/cancel_raide_page.dart +++ b/lib/views/home/map_widget.dart/cancel_raide_page.dart @@ -19,10 +19,10 @@ GetBuilder cancelRidePage() { return GetBuilder( builder: (controller) => controller.isCancelRidePageShown ? Positioned( - left: 60, - top: 40, - right: 60, - // bottom: 100, + left: Get.width * .1, + top: Get.width * .2, + right: Get.width * .1, + bottom: Get.width * .15, child: Container( decoration: BoxDecoration( color: AppColor.secondaryColor, diff --git a/lib/views/home/map_widget.dart/form_search_places_destenation.dart b/lib/views/home/map_widget.dart/form_search_places_destenation.dart index 0eec278..e0a2447 100644 --- a/lib/views/home/map_widget.dart/form_search_places_destenation.dart +++ b/lib/views/home/map_widget.dart/form_search_places_destenation.dart @@ -219,10 +219,11 @@ GetBuilder formSearchPlacesDestenation() { controller.passengerLocation = controller.newMyLocation; controller.myDestination = LatLng( - double.parse( - res['geometry']['location']['lat'].toString()), - double.parse( - res['geometry']['location']['lng'].toString())); + double.parse( + res['geometry']['location']['lat'].toString()), + double.parse( + res['geometry']['location']['lng'].toString()), + ); controller.convertHintTextDestinationNewPlaces(index); controller.placesDestination = []; diff --git a/lib/views/home/map_widget.dart/main_bottom_Menu_map.dart b/lib/views/home/map_widget.dart/main_bottom_Menu_map.dart index 7768842..121248c 100644 --- a/lib/views/home/map_widget.dart/main_bottom_Menu_map.dart +++ b/lib/views/home/map_widget.dart/main_bottom_Menu_map.dart @@ -12,7 +12,6 @@ import '../../../constant/colors.dart'; import '../../../constant/table_names.dart'; import '../../../controller/functions/toast.dart'; import '../../../controller/functions/tts.dart'; -import 'form_search_start.dart'; class MainBottomMenuMap extends StatelessWidget { const MainBottomMenuMap({super.key}); @@ -103,26 +102,26 @@ class MainBottomMenuMap extends StatelessWidget { const SizedBox( height: 10, ), - MyElevatedButton( - title: 'Get Details of Trip'.tr, - onPressed: () async { - controller.changeMainBottomMenuMap(); - - await controller.getMap( - '${controller.newStartPointLocation.latitude},${controller.newStartPointLocation.longitude}', - '${controller.newMyLocation.latitude},${controller.newMyLocation.longitude}', - ); - controller.currentLocationToFormPlaces = - false; - controller.placesDestination = []; - // controller.isCancelRidePageShown = true; - controller.clearPlacesStart(); - controller.clearPlacesDestination(); - - controller.showBottomSheet1(); - Get.back(); - controller.showBottomSheet1(); - }), + // MyElevatedButton( + // title: 'Get Details of Trip'.tr, + // onPressed: () async { + // controller.changeMainBottomMenuMap(); + // + // await controller.getMap( + // '${controller.newStartPointLocation.latitude},${controller.newStartPointLocation.longitude}', + // '${controller.newMyLocation.latitude},${controller.newMyLocation.longitude}', + // ); + // controller.currentLocationToFormPlaces = + // false; + // controller.placesDestination = []; + // // controller.isCancelRidePageShown = true; + // controller.clearPlacesStart(); + // controller.clearPlacesDestination(); + // + // controller.showBottomSheet1(); + // Get.back(); + // controller.showBottomSheet1(); + // }), TextButton( onPressed: () { controller.changeMainBottomMenuMap(); @@ -303,7 +302,8 @@ class MainBottomMenuMap extends StatelessWidget { ), Text( controller.passengerStartLocationFromMap - ? 'Pick your ride location on the map - Tap to confirm'.tr + ? 'Pick or Tap to confirm'.tr + // ? 'Pick your ride location on the map - Tap to confirm'.tr : "Click here point".tr, style: AppStyle.title, ), @@ -346,15 +346,16 @@ class MainBottomMenuMap extends StatelessWidget { borderRadius: BorderRadius.circular(12), color: AppColor.redColor, ), - child: Padding( - padding: const EdgeInsets.all(6), - child: Text( - 'No Car in your site. Sorry!'.tr, - style: AppStyle.title - .copyWith(color: AppColor.secondaryColor), - ), + child: null + // Padding( + // padding: const EdgeInsets.all(6), + // child: Text( + // 'No Car in your site. Sorry!'.tr, + // style: AppStyle.title + // .copyWith(color: AppColor.secondaryColor), + // ), + // ), ), - ), controller.noCarString == false ? Container( decoration: BoxDecoration( diff --git a/lib/views/home/profile/passenger_profile_page.dart b/lib/views/home/profile/passenger_profile_page.dart index 62eb0ed..104b228 100644 --- a/lib/views/home/profile/passenger_profile_page.dart +++ b/lib/views/home/profile/passenger_profile_page.dart @@ -188,56 +188,59 @@ class PassengerProfilePage extends StatelessWidget { }, ), // const Spacer(), + Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + MyElevatedButton( + title: 'Sign Out'.tr, + onPressed: () { + LogOutController().logOutPassenger(); + }), + GetBuilder( + builder: (logOutController) { + return MyElevatedButton( + title: 'Delete My Account'.tr, + onPressed: () { + Get.defaultDialog( + title: + 'Are you sure to delete your account?' + .tr, + content: Form( + key: logOutController.formKey1, + child: MyTextForm( + controller: logOutController + .emailTextController, + label: 'Type your Email'.tr, + hint: 'Type your Email'.tr, + type: + TextInputType.emailAddress, + ), + ), + confirm: MyElevatedButton( + title: 'Delete My Account'.tr, + kolor: AppColor.redColor, + onPressed: () async { + await logOutController + .deletePassengerAccount(); + }), + cancel: MyElevatedButton( + title: 'No I want'.tr, + onPressed: () { + logOutController + .emailTextController + .clear(); + logOutController.update(); + Get.back(); + })); + }); + }), + ], + ), ], ), ), ), )), - Positioned( - left: 70, - bottom: 100, - right: 70, - child: MyElevatedButton( - title: 'Sign Out'.tr, - onPressed: () { - LogOutController().logOutPassenger(); - }), - ), - Positioned( - left: 70, - bottom: 10, - right: 70, - child: GetBuilder(builder: (logOutController) { - return MyElevatedButton( - title: 'Delete My Account'.tr, - onPressed: () { - Get.defaultDialog( - title: 'Are you sure to delete your account?'.tr, - content: Form( - key: logOutController.formKey1, - child: MyTextForm( - controller: logOutController.emailTextController, - label: 'Type your Email'.tr, - hint: 'Type your Email'.tr, - type: TextInputType.emailAddress, - ), - ), - confirm: MyElevatedButton( - title: 'Delete My Account'.tr, - kolor: AppColor.redColor, - onPressed: () async { - await logOutController.deletePassengerAccount(); - }), - cancel: MyElevatedButton( - title: 'No I want'.tr, - onPressed: () { - logOutController.emailTextController.clear(); - logOutController.update(); - Get.back(); - })); - }); - }), - ) ], ); } @@ -320,64 +323,67 @@ class CountryPicker extends StatelessWidget { @override Widget build(BuildContext context) { return GetBuilder(builder: (controller) { - return 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, + 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, ), - ), - 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, + // 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().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(LoginPage()); - }, - ) - ], + MyElevatedButton( + title: 'Select Country'.tr, // Use translated text for button + onPressed: () { + Get.find().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(LoginPage()); + }, + ) + ], + ), ); }); } @@ -403,65 +409,68 @@ class CountryPickerFromSetting extends StatelessWidget { @override Widget build(BuildContext context) { return GetBuilder(builder: (controller) { - return 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, + 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, ), - ), - 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, + // 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(); - }, - ) - ], + 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(); + }, + ) + ], + ), ); }); } diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift index 966cf2e..0806438 100644 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -15,6 +15,7 @@ import flutter_local_notifications import flutter_secure_storage_macos import flutter_tts import geolocator_apple +import google_sign_in_ios import iris_method_channel import just_audio import location @@ -37,6 +38,7 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { FlutterSecureStoragePlugin.register(with: registry.registrar(forPlugin: "FlutterSecureStoragePlugin")) FlutterTtsPlugin.register(with: registry.registrar(forPlugin: "FlutterTtsPlugin")) GeolocatorPlugin.register(with: registry.registrar(forPlugin: "GeolocatorPlugin")) + FLTGoogleSignInPlugin.register(with: registry.registrar(forPlugin: "FLTGoogleSignInPlugin")) IrisMethodChannelPlugin.register(with: registry.registrar(forPlugin: "IrisMethodChannelPlugin")) JustAudioPlugin.register(with: registry.registrar(forPlugin: "JustAudioPlugin")) LocationPlugin.register(with: registry.registrar(forPlugin: "LocationPlugin")) diff --git a/pubspec.lock b/pubspec.lock index 3eab4bf..e7c314f 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -856,6 +856,14 @@ packages: url: "https://pub.dev" source: hosted version: "0.0.1-dev" + google_identity_services_web: + dependency: transitive + description: + name: google_identity_services_web + sha256: "9482364c9f8b7bd36902572ebc3a7c2b5c8ee57a9c93e6eb5099c1a9ec5265d8" + url: "https://pub.dev" + source: hosted + version: "0.3.1+1" google_maps: dependency: transitive description: @@ -908,18 +916,18 @@ packages: dependency: transitive description: name: google_mlkit_commons - sha256: "046586b381cdd139f7f6a05ad6998f7e339d061bd70158249907358394b5f496" + sha256: "27d626c66a181351a953eba5b6ff1ff123aadb891b4dab085b292118f039d6ac" url: "https://pub.dev" source: hosted - version: "0.6.1" + version: "0.7.1" google_mlkit_text_recognition: dependency: "direct main" description: name: google_mlkit_text_recognition - sha256: d484de2a10961a6f0ff8b54cc92b71bfbb0e65509be0903edca0e1f9256ca4c2 + sha256: "89c848329355f165ff17ca8645cab5998770e9e25e431fe6dd8261ed9cf7bdc4" url: "https://pub.dev" source: hosted - version: "0.11.0" + version: "0.13.0" google_polyline_algorithm: dependency: "direct main" description: @@ -928,6 +936,46 @@ packages: url: "https://pub.dev" source: hosted version: "3.1.0" + google_sign_in: + dependency: "direct main" + description: + name: google_sign_in + sha256: "0b8787cb9c1a68ad398e8010e8c8766bfa33556d2ab97c439fb4137756d7308f" + url: "https://pub.dev" + source: hosted + version: "6.2.1" + google_sign_in_android: + dependency: transitive + description: + name: google_sign_in_android + sha256: "7647893c65e6720973f0e579051c8f84b877b486614d9f70a404259c41a4632e" + url: "https://pub.dev" + source: hosted + version: "6.1.23" + google_sign_in_ios: + dependency: transitive + description: + name: google_sign_in_ios + sha256: a058c9880be456f21e2e8571c1126eaacd570bdc5b6c6d9d15aea4bdf22ca9fe + url: "https://pub.dev" + source: hosted + version: "5.7.6" + google_sign_in_platform_interface: + dependency: transitive + description: + name: google_sign_in_platform_interface + sha256: "1f6e5787d7a120cc0359ddf315c92309069171306242e181c09472d1b00a2971" + url: "https://pub.dev" + source: hosted + version: "2.4.5" + google_sign_in_web: + dependency: transitive + description: + name: google_sign_in_web + sha256: fc0f14ed45ea616a6cfb4d1c7534c2221b7092cc4f29a709f0c3053cc3e821bd + url: "https://pub.dev" + source: hosted + version: "0.12.4" graphs: dependency: transitive description: @@ -1933,6 +1981,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.1.0" + web: + dependency: transitive + description: + name: web + sha256: "97da13628db363c635202ad97068d47c5b8aa555808e7a9411963c533b449b27" + url: "https://pub.dev" + source: hosted + version: "0.5.1" web_socket_channel: dependency: transitive description: @@ -2014,5 +2070,5 @@ packages: source: hosted version: "3.1.2" sdks: - dart: ">=3.2.3 <4.0.0" - flutter: ">=3.16.6" + dart: ">=3.3.0 <4.0.0" + flutter: ">=3.19.0" diff --git a/pubspec.yaml b/pubspec.yaml index e54f6bb..b4b5a76 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -18,7 +18,6 @@ dependencies: google_maps_flutter: ^2.5.0 sqflite: ^2.3.0 path: ^1.8.3 - # google_sign_in: ^6.1.4 lottie: ^2.5.0 intl: ^0.18.1 google_fonts: ^ 4.0.4 @@ -39,7 +38,6 @@ dependencies: flutter_font_icons: ^2.2.5 device_info_plus: ^9.1.0 image_picker: ^1.0.4 - google_mlkit_text_recognition: ^0.11.0 flutter_stripe: ^9.5.0+1 camera: ^0.10.5+5 flutter_widget_from_html: ^0.14.6 @@ -57,13 +55,13 @@ dependencies: vibration: ^1.8.4 wakelock_plus: background_location: ^0.13.0 - # flutter_sound: ^9.2.13 record: ^5.0.5 dio: ^5.4.3+1 - # paymob_payment: ^0.0.1+1 webview_flutter: ^4.7.0 just_audio: ^0.9.37 share: ^2.0.4 + google_sign_in: ^6.2.1 + google_mlkit_text_recognition: ^0.13.0