This commit is contained in:
Hamza-Ayed
2024-05-23 02:10:42 +03:00
parent da6741e24e
commit 3ff0eace3f
10 changed files with 127 additions and 102 deletions

View File

@@ -66,28 +66,32 @@ class LoginController extends GetxController {
if (jsonDecoeded['status'] == 'success' && if (jsonDecoeded['status'] == 'success' &&
jsonDecoeded['data'][0]['verified'] == 1) { jsonDecoeded['data'][0]['verified'] == 1) {
// //
box.write(BoxName.isVerified, 'true');
box.write(BoxName.email, jsonDecoeded['data'][0]['email']);
Get.offAll(() => const MapPagePassenger());
print(box.read(BoxName.tokenFCM)); print(box.read(BoxName.tokenFCM));
var token = await CRUD().get(link: AppLink.getTokens, payload: { var token = await CRUD().get(link: AppLink.getTokens, payload: {
'passengerID': box.read(BoxName.passengerID).toString() 'passengerID': box.read(BoxName.passengerID).toString()
}); });
print(token); print(token);
print(box.read(BoxName.tokenFCM));
if (token != 'failure') { if (token != 'failure') {
if (jsonDecode(token)['data'][0]['token'] != if (jsonDecode(token)['data'][0]['token'] !=
box.read(BoxName.tokenFCM)) { box.read(BoxName.tokenFCM)) {
Get.find<FirebaseMessagesController>() Get.put(FirebaseMessagesController())
.sendNotificationToAnyWithoutData( .sendNotificationToAnyWithoutData(
'token change', 'token change',
'change device', 'change device',
jsonDecode(token)['data'][0]['token'].toString(), jsonDecode(token)['data'][0]['token'].toString(),
); );
await CRUD().post(link: AppLink.addTokens, payload: {
'token': box.read(BoxName.tokenFCM),
'passengerID': box.read(BoxName.passengerID).toString()
}).then((value) => print('cccc'));
} }
} }
await CRUD().post(link: AppLink.addTokens, payload: {
'token': box.read(BoxName.tokenFCM), Get.offAll(() => const MapPagePassenger());
'passengerID': box.read(BoxName.passengerID).toString()
}).then((value) => print('cccc'));
} else { } else {
Get.offAll(() => SmsSignupEgypt()); Get.offAll(() => SmsSignupEgypt());
// Get.snackbar(jsonDecoeded['status'], jsonDecoeded['data'], // Get.snackbar(jsonDecoeded['status'], jsonDecoeded['data'],
@@ -238,7 +242,7 @@ class LoginController extends GetxController {
} }
} }
print('permisson is ${permissionGranted.toString()}'); print('permisson is ${permissionGranted.toString()}');
if ('PermissionStatus.granted' == permissionGranted.toString()) { if (permissionGranted.toString() == 'PermissionStatus.granted') {
box.write(BoxName.locationPermission, 'true'); box.write(BoxName.locationPermission, 'true');
} }
update(); update();

View File

@@ -117,6 +117,7 @@ class RegisterController extends GetxController {
); );
if (jsonDecode(res1)['status'] == 'success') { if (jsonDecode(res1)['status'] == 'success') {
box.write(BoxName.isVerified, 'true'); box.write(BoxName.isVerified, 'true');
box.write(BoxName.phone, '+2${phoneController.text}');
Get.offAll(const MapPagePassenger()); Get.offAll(const MapPagePassenger());
} }
} else { } else {

View File

@@ -143,6 +143,8 @@ class FirebaseMessagesController extends GetxController {
.showNotification('Promo', 'Show latest promo'.tr, 'promo'); .showNotification('Promo', 'Show latest promo'.tr, 'promo');
Get.to(const PromosPassengerPage()); Get.to(const PromosPassengerPage());
} else if (message.notification!.title! == 'token change') { } else if (message.notification!.title! == 'token change') {
NotificationController()
.showNotification('token change', 'token change', 'cancel');
GoogleSignInHelper.signOut(); GoogleSignInHelper.signOut();
} else if (message.notification!.title! == 'DriverIsGoingToPassenger') { } else if (message.notification!.title! == 'DriverIsGoingToPassenger') {
Get.find<MapPassengerController>().isDriverInPassengerWay = true; Get.find<MapPassengerController>().isDriverInPassengerWay = true;

View File

@@ -889,7 +889,7 @@ class MapPassengerController extends GetxController {
driverPhone = driverPhone =
dataCarsLocationByPassenger['message'][carsOrder]['phone'].toString(); dataCarsLocationByPassenger['message'][carsOrder]['phone'].toString();
firstName = dataCarsLocationByPassenger['message'][carsOrder] firstName = dataCarsLocationByPassenger['message'][carsOrder]
['first_name'] ['driverName']
.toString(); .toString();
carColor = carColor =
dataCarsLocationByPassenger['message'][carsOrder]['color'].toString(); dataCarsLocationByPassenger['message'][carsOrder]['color'].toString();
@@ -1002,8 +1002,14 @@ class MapPassengerController extends GetxController {
titleStyle: AppStyle.title, titleStyle: AppStyle.title,
middleText: 'Please Try anther time '.tr, middleText: 'Please Try anther time '.tr,
middleTextStyle: AppStyle.title.copyWith(color: AppColor.yellowColor), middleTextStyle: AppStyle.title.copyWith(color: AppColor.yellowColor),
confirm: confirm: MyElevatedButton(
MyElevatedButton(title: 'Ok'.tr, onPressed: () => Get.back())); title: 'Ok'.tr,
onPressed: () {
Get.back();
isSearchingWindow = false;
cancelRide();
update();
}));
} }
} }
@@ -2449,6 +2455,7 @@ class MapPassengerController extends GetxController {
totalCostPassenger = 20; totalCostPassenger = 20;
totalPassengerSpeed = 20; totalPassengerSpeed = 20;
totalPassengerComfort = 30; totalPassengerComfort = 30;
totalPassengerLady = 30;
totalPassengerMotoDelivery = 18; totalPassengerMotoDelivery = 18;
} else { } else {
totalPassenger = totalCostPassenger; totalPassenger = totalCostPassenger;
@@ -2459,6 +2466,8 @@ class MapPassengerController extends GetxController {
(-1) * (double.parse(box.read(BoxName.passengerWalletTotal))); (-1) * (double.parse(box.read(BoxName.passengerWalletTotal)));
totalPassengerComfort = totalPassengerComfort + totalPassengerComfort = totalPassengerComfort +
(-1) * (double.parse(box.read(BoxName.passengerWalletTotal))); (-1) * (double.parse(box.read(BoxName.passengerWalletTotal)));
totalPassengerLady = totalPassengerLady +
(-1) * (double.parse(box.read(BoxName.passengerWalletTotal)));
totalPassengerMotoDelivery = totalPassengerMotoDelivery + totalPassengerMotoDelivery = totalPassengerMotoDelivery +
(-1) * (double.parse(box.read(BoxName.passengerWalletTotal))); (-1) * (double.parse(box.read(BoxName.passengerWalletTotal)));
update(); update();
@@ -2587,7 +2596,8 @@ class MapPassengerController extends GetxController {
payload: {'passenger_id': box.read(BoxName.passengerID)}); payload: {'passenger_id': box.read(BoxName.passengerID)});
if (res != 'failure') { if (res != 'failure') {
print(jsonDecode(res)['message']['rating']); print(jsonDecode(res)['message']['rating']);
passengerRate = jsonDecode(res)['message']['rating'] ?? 5; passengerRate =
double.parse(jsonDecode(res)['message']['rating'].toString());
} }
} }
@@ -2602,7 +2612,7 @@ class MapPassengerController extends GetxController {
addCustomStartIcon(); addCustomStartIcon();
addCustomEndIcon(); addCustomEndIcon();
await getLocation(); await getLocation();
await addToken(); // await addToken();
await getKazanPercent(); await getKazanPercent();
await getPassengerRate(); await getPassengerRate();
await getRideStatusFromStartApp(); await getRideStatusFromStartApp();

View File

@@ -50,7 +50,7 @@ class SplashScreenController extends GetxController
? Get.off(() => OnBoardingPage()) ? Get.off(() => OnBoardingPage())
: box.read(BoxName.email) != null && : box.read(BoxName.email) != null &&
box.read(BoxName.phone) != null && box.read(BoxName.phone) != null &&
box.read(BoxName.isVerified) != 'true' box.read(BoxName.isVerified) == 'true'
// ? Get.off(() => const MapPagePassenger()) // ? Get.off(() => const MapPagePassenger())
? await Get.put(LoginController()).loginFromSignInGoogle( ? await Get.put(LoginController()).loginFromSignInGoogle(
box.read(BoxName.passengerID).toString(), box.read(BoxName.passengerID).toString(),

View File

@@ -219,6 +219,15 @@ class LoginPage extends StatelessWidget {
}, },
kolor: AppColor.blueColor, kolor: AppColor.blueColor,
), ),
// MyElevatedButton(
// title: 'Sign In by Google'.tr,
// onPressed: () async {
// print(box.read(BoxName.email));
// print(box.read(BoxName.phone));
// print(box.read(BoxName.isVerified));
// },
// kolor: AppColor.blueColor,
// ),
], ],
), ),
)), )),
@@ -350,36 +359,38 @@ class LoginPage extends StatelessWidget {
} }
locationPermissionDialog() { locationPermissionDialog() {
return Padding( return GetBuilder<LoginController>(builder: (controller) {
padding: const EdgeInsets.all(16), return Padding(
child: Container( padding: const EdgeInsets.all(16),
height: Get.height * .4, child: Container(
decoration: AppStyle.boxDecoration1, height: Get.height * .4,
child: Padding( decoration: AppStyle.boxDecoration1,
padding: const EdgeInsets.all(20.0), child: Padding(
child: Center( padding: const EdgeInsets.all(20.0),
child: Column( child: Center(
crossAxisAlignment: CrossAxisAlignment.center, child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround, crossAxisAlignment: CrossAxisAlignment.center,
children: [ mainAxisAlignment: MainAxisAlignment.spaceAround,
Text( children: [
'We use location to get accurate and nearest driver for you' Text(
.tr, 'We use location to get accurate and nearest driver for you'
textAlign: TextAlign.center, .tr,
style: AppStyle.title, textAlign: TextAlign.center,
), style: AppStyle.title,
MyElevatedButton( ),
title: 'Grant Location'.tr, MyElevatedButton(
onPressed: () async { title: 'Grant Location'.tr,
await controller.getLocationPermission(); onPressed: () async {
}, await controller.getLocationPermission();
kolor: AppColor.greenColor, },
) kolor: AppColor.greenColor,
], )
],
),
), ),
), ),
), ),
), );
); });
} }
} }

View File

@@ -16,8 +16,8 @@ class SmsSignupEgypt extends StatelessWidget {
title: 'Phone Check'.tr, title: 'Phone Check'.tr,
body: [ body: [
GetBuilder<RegisterController>(builder: (registerController) { GetBuilder<RegisterController>(builder: (registerController) {
return Column( return ListView(
mainAxisAlignment: MainAxisAlignment.center, // mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
// Logo at the top // Logo at the top
Padding( Padding(

View File

@@ -1,4 +1,5 @@
import 'package:SEFER/constant/colors.dart'; import 'package:SEFER/constant/colors.dart';
import 'package:SEFER/constant/links.dart';
import 'package:SEFER/constant/style.dart'; import 'package:SEFER/constant/style.dart';
import 'package:SEFER/controller/firebase/firbase_messge.dart'; import 'package:SEFER/controller/firebase/firbase_messge.dart';
import 'package:SEFER/controller/home/map_passenger_controller.dart'; import 'package:SEFER/controller/home/map_passenger_controller.dart';
@@ -143,7 +144,7 @@ class ApplyOrderWidget extends StatelessWidget {
backgroundImage: NetworkImage( backgroundImage: NetworkImage(
// '', // '',
// ), // ),
'https://ride.mobile-app.store/portrate_captain_image/${controller.driverId}.jpg'), '${AppLink.server}/portrate_captain_image/${controller.driverId}.jpg'),
), ),
Column( Column(
children: [ children: [

View File

@@ -202,7 +202,7 @@ class CarDetailsTypeToChoose extends StatelessWidget {
) )
: carType.carType == 'Lady' && : carType.carType == 'Lady' &&
(mapPassengerController (mapPassengerController
.totalPassengerLady > .totalPassengerSpeed >
20) 20)
? Row( ? Row(
children: [ children: [
@@ -396,8 +396,7 @@ class CarDetailsTypeToChoose extends StatelessWidget {
2) { 2) {
box.write(BoxName.carType, 'Lady'); box.write(BoxName.carType, 'Lady');
mapPassengerController.totalPassenger = mapPassengerController.totalPassenger =
mapPassengerController mapPassengerController.totalPassengerLady;
.totalPassengerSpeed;
Get.defaultDialog( Get.defaultDialog(
title: 'Lady', title: 'Lady',
titleStyle: AppStyle.title, titleStyle: AppStyle.title,
@@ -521,7 +520,7 @@ class HeaderDestination extends StatelessWidget {
right: 5, right: 5,
child: Container( child: Container(
decoration: AppStyle.boxDecoration1, decoration: AppStyle.boxDecoration1,
height: Get.height * .16, height: Get.height * .2,
width: Get.width * .8, width: Get.width * .8,
child: InkWell( child: InkWell(
onTap: () { onTap: () {
@@ -531,30 +530,38 @@ class HeaderDestination extends StatelessWidget {
mapPassengerController.cancelRide(); mapPassengerController.cancelRide();
}); });
}, },
child: Padding( child: Column(
padding: const EdgeInsets.all(8.0), mainAxisAlignment: MainAxisAlignment.spaceAround,
child: Column( children: [
crossAxisAlignment: CrossAxisAlignment.start, Padding(
mainAxisAlignment: MainAxisAlignment.spaceAround, padding: const EdgeInsets.all(8.0),
children: [ child: SizedBox(
Text( height: Get.height * .12,
'🤢 ${mapPassengerController.startNameAddress}', child: ListView(
style: AppStyle.subtitle, // crossAxisAlignment: CrossAxisAlignment.start,
//
children: [
Text(
'🟢 ${mapPassengerController.startNameAddress}',
style: AppStyle.subtitle,
),
Text(
'🔴 ${mapPassengerController.endNameAddress}',
style: AppStyle.subtitle,
),
],
),
), ),
Text( ),
'😡 ${mapPassengerController.endNameAddress}', Row(
style: AppStyle.subtitle, children: [
), Text(
Row( '📍 ${mapPassengerController.distance} ${'KM'.tr}${mapPassengerController.hours > 0 ? '${'Your Ride Duration is '.tr}${mapPassengerController.hours} ${'H and'.tr} ${mapPassengerController.minutes} ${'m'.tr}' : '${'Your Ride Duration is '.tr} ${mapPassengerController.minutes} m'}',
children: [ style: AppStyle.subtitle,
Text( ),
'📍 ${mapPassengerController.distance} ${'KM'.tr}${mapPassengerController.hours > 0 ? '${'Your Ride Duration is '.tr}${mapPassengerController.hours} ${'H and'.tr} ${mapPassengerController.minutes} ${'m'.tr}' : '${'Your Ride Duration is '.tr} ${mapPassengerController.minutes} m'}', ],
style: AppStyle.subtitle, ),
), ],
],
),
],
),
), ),
), ),
), ),

View File

@@ -334,41 +334,30 @@ class MainBottomMenuMap extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
SizedBox( SizedBox(
height: 30, height: 25,
child: Text('${'Where to'.tr} ${box.read(BoxName.name)}')), child: Text('${'Where to'.tr} ${box.read(BoxName.name)}')),
Row( Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
controller.noCarString == false if (controller.noCarString)
? Text('Nearest Car for you about '.tr) Text('Nearest Car for you about '.tr)
: Container( else
decoration: BoxDecoration( Container(
borderRadius: BorderRadius.circular(12), decoration: BoxDecoration(
color: AppColor.redColor, borderRadius: BorderRadius.circular(12),
), color: AppColor.redColor,
child: null ),
// Padding( child: null,
// padding: const EdgeInsets.all(6), ),
// child: Text( if (!controller.noCarString)
// 'No Car in your site. Sorry!'.tr, Padding(
// style: AppStyle.title padding: const EdgeInsets.all(4),
// .copyWith(color: AppColor.secondaryColor), child: Text(
// ), (controller.nearestCar != null
// ), ? controller.nearestDistance.toStringAsFixed(0)
), : ''),
controller.noCarString == false ),
? Container( ),
decoration: BoxDecoration(
border:
Border.all(color: AppColor.redColor, width: 3)),
child: Padding(
padding: const EdgeInsets.all(4),
child: Text((controller.nearestCar != null
? controller.nearestDistance.toStringAsFixed(0)
: 'N/A')),
),
)
: const SizedBox(),
], ],
) )
], ],