6/28/1
This commit is contained in:
@@ -38,7 +38,7 @@ class GoogleSignInHelper {
|
||||
if (googleUser != null) {
|
||||
await _handleSignUp(googleUser);
|
||||
// if (box.read(BoxName.countryCode) == 'Egypt') {
|
||||
await Get.put(LoginController()).loginFromSignInGoogle(
|
||||
await Get.put(LoginController()).loginUsingCredentials(
|
||||
box.read(BoxName.passengerID).toString(),
|
||||
box.read(BoxName.email).toString(),
|
||||
);
|
||||
|
||||
@@ -40,7 +40,7 @@ class LoginController extends GetxController {
|
||||
update();
|
||||
}
|
||||
|
||||
loginFromSignInGoogle(String passengerID, email) async {
|
||||
loginUsingCredentials(String passengerID, email) async {
|
||||
isloading = true;
|
||||
update();
|
||||
var res =
|
||||
|
||||
@@ -5,7 +5,6 @@ import 'package:firebase_messaging/firebase_messaging.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:SEFER/controller/functions/crud.dart';
|
||||
import 'package:SEFER/controller/functions/toast.dart';
|
||||
import 'package:SEFER/views/widgets/elevated_btn.dart';
|
||||
|
||||
@@ -125,6 +124,9 @@ class FirebaseMessagesController extends GetxController {
|
||||
var myList = jsonDecode(passengerList) as List<dynamic>;
|
||||
driverID = myList[0].toString();
|
||||
Get.find<MapPassengerController>().driverToken = myList[2].toString();
|
||||
Get.find<MapPassengerController>().statusRide == 'Apply';
|
||||
Get.find<MapPassengerController>().isSearchingWindow == false;
|
||||
Get.find<MapPassengerController>().update();
|
||||
NotificationController().showNotification(
|
||||
'Apply Order'.tr, 'Driver Applied the Ride for You'.tr, 'order1');
|
||||
// driverAppliedTripSnakBar();
|
||||
|
||||
@@ -4,7 +4,7 @@ import '../../constant/box_name.dart';
|
||||
import '../../main.dart';
|
||||
|
||||
class HomePageController extends GetxController {
|
||||
late bool isVibrate = true;
|
||||
late bool isVibrate = box.read(BoxName.isvibrate) ?? true;
|
||||
|
||||
void changeVibrateOption(bool value) {
|
||||
isVibrate = box.read(BoxName.isvibrate) ?? true;
|
||||
|
||||
@@ -7,8 +7,6 @@ import 'package:SEFER/views/auth/login_page.dart';
|
||||
import '../../constant/box_name.dart';
|
||||
import '../../main.dart';
|
||||
import '../../onbording_page.dart';
|
||||
import '../../views/home/map_page_passenger.dart';
|
||||
import '../auth/google_sign.dart';
|
||||
import '../auth/login_controller.dart';
|
||||
|
||||
class SplashScreenController extends GetxController
|
||||
@@ -52,7 +50,7 @@ class SplashScreenController extends GetxController
|
||||
box.read(BoxName.phone) != null &&
|
||||
box.read(BoxName.isVerified) == '1'
|
||||
// ? Get.off(() => const MapPagePassenger())
|
||||
? await Get.put(LoginController()).loginFromSignInGoogle(
|
||||
? await Get.put(LoginController()).loginUsingCredentials(
|
||||
box.read(BoxName.passengerID).toString(),
|
||||
box.read(BoxName.email).toString(),
|
||||
)
|
||||
|
||||
@@ -142,7 +142,9 @@ class PaymobPaymentWallet {
|
||||
}) async {
|
||||
final Map<String, dynamic> data = {
|
||||
"source": {
|
||||
"identifier": "01010101010", // Replace with actual source identifier
|
||||
"identifier": box
|
||||
.read(BoxName.phone)
|
||||
.toString(), // Replace with actual source identifier
|
||||
"subtype": "WALLET",
|
||||
},
|
||||
"payment_token": paymentToken,
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:SEFER/controller/home/map_passenger_controller.dart';
|
||||
import 'package:SEFER/views/widgets/my_dialog.dart';
|
||||
import 'package:firebase_auth/firebase_auth.dart';
|
||||
import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -86,8 +88,13 @@ class LoginPage extends StatelessWidget {
|
||||
if (user != null) {
|
||||
box.write(BoxName.passengerID, user.uid);
|
||||
box.write(BoxName.email, user.email);
|
||||
await GoogleSignInHelper
|
||||
.signInFromLogin();
|
||||
await Get.put(LoginController())
|
||||
.loginUsingCredentials(
|
||||
box
|
||||
.read(BoxName.passengerID)
|
||||
.toString(),
|
||||
box.read(BoxName.email).toString(),
|
||||
);
|
||||
// Navigate to another screen or perform other actions
|
||||
} else {}
|
||||
},
|
||||
@@ -265,7 +272,7 @@ class LoginPage extends StatelessWidget {
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
Text(
|
||||
'We use location to get accurate and nearest driver for you'
|
||||
'We use your precise location to find the nearest available driver and provide accurate pickup and dropoff information. You can manage this in Settings.'
|
||||
.tr,
|
||||
textAlign: TextAlign.center,
|
||||
style: AppStyle.title,
|
||||
@@ -273,7 +280,19 @@ class LoginPage extends StatelessWidget {
|
||||
MyElevatedButton(
|
||||
title: 'Next'.tr,
|
||||
onPressed: () async {
|
||||
// if (box.read(BoxName.locationPermission) != 'true') {
|
||||
// Get.put(MyDialog()).getDialog(
|
||||
// 'Location Permission is requiered for find drivers'
|
||||
// .tr,
|
||||
// 'You can just manage your account!'.tr, () {
|
||||
// Get.back();
|
||||
// Get.to(() {
|
||||
// PassengerProfilePage();
|
||||
// });
|
||||
// });
|
||||
// } else {
|
||||
await controller.getLocationPermission();
|
||||
// }
|
||||
},
|
||||
kolor: AppColor.greenColor,
|
||||
)
|
||||
|
||||
@@ -37,7 +37,7 @@ class SearchingCaptainWindow extends StatelessWidget {
|
||||
),
|
||||
Text(
|
||||
"We are searching for the nearest driver to you".tr,
|
||||
style: AppStyle.headTitle2,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Text(
|
||||
'please wait till driver accept your order'.tr,
|
||||
@@ -192,18 +192,26 @@ Widget _buildTimer(MapPassengerController mapPassengerController) {
|
||||
|
||||
return Stack(
|
||||
children: [
|
||||
Center(
|
||||
child: CircularProgressIndicator(
|
||||
value: progress, // Use calculated progress
|
||||
color: AppColor.blueColor,
|
||||
backgroundColor: AppColor.yellowColor,
|
||||
SizedBox(
|
||||
height: 35,
|
||||
width: 35,
|
||||
child: Center(
|
||||
child: CircularProgressIndicator(
|
||||
value: progress, // Use calculated progress
|
||||
color: AppColor.blueColor,
|
||||
backgroundColor: AppColor.yellowColor,
|
||||
),
|
||||
),
|
||||
),
|
||||
Center(
|
||||
child: Text(
|
||||
'${snapshot.data} ', // Display elapsed time
|
||||
style: AppStyle.title.copyWith(
|
||||
color: AppColor.greenColor), // Adjust color for timer
|
||||
SizedBox(
|
||||
height: 35,
|
||||
width: 35,
|
||||
child: Center(
|
||||
child: Text(
|
||||
'${snapshot.data} ', // Display elapsed time
|
||||
style: AppStyle.title.copyWith(
|
||||
color: AppColor.greenColor), // Adjust color for timer
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
|
||||
@@ -23,7 +23,7 @@ class MyElevatedButton extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final bool vibrate = box.read(BoxName.isvibrate) ?? true;
|
||||
bool vibrate = box.read(BoxName.isvibrate) ?? true;
|
||||
|
||||
return ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
@@ -33,7 +33,7 @@ class MyElevatedButton extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
onPressed: () async {
|
||||
if (vibrate) {
|
||||
if (vibrate == true) {
|
||||
if (Platform.isIOS) {
|
||||
HapticFeedback.selectionClick();
|
||||
} else {
|
||||
|
||||
43
lib/views/widgets/my_dialog.dart
Normal file
43
lib/views/widgets/my_dialog.dart
Normal file
@@ -0,0 +1,43 @@
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../constant/colors.dart';
|
||||
import '../../constant/style.dart';
|
||||
import '../../controller/functions/tts.dart';
|
||||
import 'elevated_btn.dart';
|
||||
|
||||
class MyDialog extends GetxController {
|
||||
void getDialog(String title, String? midTitle, VoidCallback onPressed) {
|
||||
final textToSpeechController = Get.put(TextToSpeechController());
|
||||
Get.defaultDialog(
|
||||
title: title,
|
||||
titleStyle: AppStyle.title,
|
||||
middleTextStyle: AppStyle.title,
|
||||
content: Column(
|
||||
children: [
|
||||
IconButton(
|
||||
onPressed: () async {
|
||||
await textToSpeechController.speakText(title ?? midTitle!);
|
||||
},
|
||||
icon: const Icon(Icons.headphones)),
|
||||
Text(
|
||||
midTitle!,
|
||||
style: AppStyle.title,
|
||||
)
|
||||
],
|
||||
),
|
||||
confirm: MyElevatedButton(
|
||||
title: 'Ok'.tr,
|
||||
onPressed: onPressed,
|
||||
kolor: AppColor.greenColor,
|
||||
),
|
||||
cancel: MyElevatedButton(
|
||||
title: 'Cancel',
|
||||
kolor: AppColor.redColor,
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
}));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user