10/16/1
This commit is contained in:
@@ -6,6 +6,7 @@ class BoxName {
|
||||
static const String password = "password";
|
||||
static const String passwordDriver = "passwordDriver";
|
||||
static const String agreeTerms = "agreeTerms";
|
||||
static const String sosPhonePassenger = "sosPhonePassenger";
|
||||
static const String passengerID = "pasengerID";
|
||||
static const String phone = "phone";
|
||||
static const String phoneDriver = "phoneDriver";
|
||||
|
||||
@@ -18,6 +18,9 @@ class AppCredintials {
|
||||
|
||||
class MyClass {
|
||||
static const String mapAPIKEY = 'AIzaSyCyfwRXTwSTLOFQSQgN5p7QZgGJVZnEKq0';
|
||||
static const String twilloRecoveryCode = 'TQF13XUVU2NJ3VFU8JWBWYBS';
|
||||
static const String accountSIDTwillo = 'ACb4ad857efe0903bfd6238a763a2ce4d1';
|
||||
static const String authTokenTwillo = '14f39ef4628bb8a4f18469f462f8af75';
|
||||
static const String additionalText = 'additional text';
|
||||
|
||||
String getBasicAuthCredentials() {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import 'package:flutter_sms/flutter_sms.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:ride/constant/box_name.dart';
|
||||
import 'dart:async';
|
||||
@@ -62,14 +61,6 @@ class HomeCaptainController extends GetxController {
|
||||
super.onInit();
|
||||
}
|
||||
|
||||
void sendSMSToRecipents(String message, List<String> recipents) async {
|
||||
String _result = await sendSMS(message: message, recipients: recipents)
|
||||
.catchError((onError) {
|
||||
print(onError);
|
||||
});
|
||||
print(_result);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
activeTimer?.cancel();
|
||||
|
||||
@@ -17,10 +17,13 @@ import 'package:ride/views/Rate/rate_captain.dart';
|
||||
import 'package:ride/views/widgets/elevated_btn.dart';
|
||||
import '../../main.dart';
|
||||
import '../../models/model/locations.dart';
|
||||
import '../functions/launch.dart';
|
||||
|
||||
class MapPassengerController extends GetxController {
|
||||
bool isLoading = true;
|
||||
TextEditingController placeController = TextEditingController();
|
||||
TextEditingController sosPhonePassengerProfile = TextEditingController();
|
||||
final sosFormKey = GlobalKey<FormState>();
|
||||
List data = [];
|
||||
List<LatLng> bounds = [];
|
||||
List places = [];
|
||||
@@ -80,6 +83,9 @@ class MapPassengerController extends GetxController {
|
||||
double progressTimerRideBegin = 0;
|
||||
int remainingTimeTimerRideBegin = 60;
|
||||
String stringRemainingTimeRideBegin = '';
|
||||
late String rideId;
|
||||
late String driverToken;
|
||||
int carsOrder = 0;
|
||||
|
||||
void onChangedPassengerCount(int newValue) {
|
||||
selectedPassengerCount = newValue;
|
||||
@@ -116,6 +122,32 @@ class MapPassengerController extends GetxController {
|
||||
update();
|
||||
}
|
||||
|
||||
void sendSMS(String to) async {
|
||||
// Get the driver's phone number.
|
||||
String driverPhone =
|
||||
dataCarsLocationByPassenger['message'][carsOrder]['phone'].toString();
|
||||
|
||||
// Format the message.
|
||||
String message =
|
||||
'Hi! This is ${box.read(BoxName.name)}. I am using Sefer to ride with ${dataCarsLocationByPassenger['message'][carsOrder]['first_name'].toString()} as the driver. ${dataCarsLocationByPassenger['message'][carsOrder]['first_name'].toString()} is driving a ${dataCarsLocationByPassenger['message'][carsOrder]['model'].toString()} with license plate ${dataCarsLocationByPassenger['message'][carsOrder]['license_plate'].toString()}. I am currently located at $myLocation. If you need to reach me, please contact the driver directly at $driverPhone.';
|
||||
|
||||
// Launch the URL to send the SMS.
|
||||
launchCommunication('sms', to, message);
|
||||
}
|
||||
|
||||
void sendWhatsapp(String to) async {
|
||||
// Get the driver's phone number.
|
||||
String driverPhone =
|
||||
dataCarsLocationByPassenger['message'][carsOrder]['phone'].toString();
|
||||
|
||||
// Format the message.
|
||||
String message =
|
||||
'Hi! This is ${box.read(BoxName.name)}. I am using Sefer to ride with ${dataCarsLocationByPassenger['message'][carsOrder]['first_name'].toString()} as the driver. ${dataCarsLocationByPassenger['message'][carsOrder]['first_name'].toString()} is driving a ${dataCarsLocationByPassenger['message'][carsOrder]['model'].toString()} with license plate ${dataCarsLocationByPassenger['message'][carsOrder]['license_plate'].toString()}. I am currently located at $myLocation. If you need to reach me, please contact the driver directly at $driverPhone.';
|
||||
|
||||
// Launch the URL to send the SMS.
|
||||
launchCommunication('whatsapp', to, message);
|
||||
}
|
||||
|
||||
void changeCancelRidePageShow() {
|
||||
// rideConfirm == true
|
||||
// ?
|
||||
@@ -223,9 +255,6 @@ class MapPassengerController extends GetxController {
|
||||
update();
|
||||
}
|
||||
|
||||
late String rideId;
|
||||
late String driverToken;
|
||||
int carsOrder = 0;
|
||||
changeConfirmRide() async {
|
||||
PaymentController paymentController = Get.find<PaymentController>();
|
||||
rideConfirm = true;
|
||||
|
||||
@@ -15,7 +15,7 @@ class ProfileController extends GetxController {
|
||||
TextEditingController txtController = TextEditingController();
|
||||
List genders = ['Male', 'Female', 'Non-binary'];
|
||||
|
||||
String gender = '';
|
||||
String gender = 'Male';
|
||||
|
||||
void setGender(String value) {
|
||||
gender = value;
|
||||
|
||||
@@ -121,8 +121,8 @@ class HomeCaptain extends StatelessWidget {
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
homeCaptainController.sendSMSToRecipents(
|
||||
'hi from Sefer', ['+962798583052']);
|
||||
// homeCaptainController.sendSMSToRecipents(
|
||||
// 'hi from Sefer', ['+962798583052']);
|
||||
},
|
||||
child: const Text('send msg')),
|
||||
],
|
||||
|
||||
@@ -151,7 +151,7 @@ class MapPage extends StatelessWidget {
|
||||
onTap: (argument) {
|
||||
controller.hidePlaces();
|
||||
|
||||
controller.changeBottomSheetShown();
|
||||
// controller.changeBottomSheetShown();
|
||||
// controller.bottomSheet();
|
||||
},
|
||||
initialCameraPosition: CameraPosition(
|
||||
|
||||
@@ -327,7 +327,7 @@ GetBuilder<MapPassengerController> buttomSheetMapPage() {
|
||||
.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Container(
|
||||
SizedBox(
|
||||
height:
|
||||
200, // Set the desired height here
|
||||
child: CupertinoPicker(
|
||||
|
||||
@@ -72,22 +72,24 @@ class MainBottomMenuMap extends StatelessWidget {
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 30,
|
||||
child: AnimatedTextKit(
|
||||
animatedTexts: [
|
||||
ScaleAnimatedText(
|
||||
'${'Where to'.tr} ${box.read(BoxName.name)}'),
|
||||
// WavyAnimatedText(
|
||||
child: Text(
|
||||
'${'Where to'.tr} ${box.read(BoxName.name)}')
|
||||
// AnimatedTextKit(
|
||||
// animatedTexts: [
|
||||
// ScaleAnimatedText(
|
||||
// '${'Where to'.tr} ${box.read(BoxName.name)}'),
|
||||
// FlickerAnimatedText(
|
||||
// '${'Where to'.tr} ${box.read(BoxName.name)}'),
|
||||
// WavyAnimatedText(
|
||||
// '${'Where to'.tr} ${box.read(BoxName.name)}'),
|
||||
],
|
||||
isRepeatingAnimation: true,
|
||||
onTap: () {
|
||||
print("Tap Event");
|
||||
},
|
||||
),
|
||||
// // WavyAnimatedText(
|
||||
// // '${'Where to'.tr} ${box.read(BoxName.name)}'),
|
||||
// // FlickerAnimatedText(
|
||||
// // '${'Where to'.tr} ${box.read(BoxName.name)}'),
|
||||
// // WavyAnimatedText(
|
||||
// // '${'Where to'.tr} ${box.read(BoxName.name)}'),
|
||||
// ],
|
||||
// isRepeatingAnimation: true,
|
||||
// onTap: () {
|
||||
// print("Tap Event");
|
||||
// },
|
||||
// ),
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
@@ -148,21 +150,11 @@ class FavioratePlacesDialogu extends StatelessWidget {
|
||||
builder: (controller) => DefaultTextStyle(
|
||||
style: AppStyle.title,
|
||||
child: Center(
|
||||
child: AnimatedTextKit(
|
||||
animatedTexts: [
|
||||
TypewriterAnimatedText('Favorite Places'.tr),
|
||||
ScaleAnimatedText(
|
||||
'Favorite Places'.tr,
|
||||
),
|
||||
// TyperAnimatedText(
|
||||
// 'Favorite Places'.tr,
|
||||
// ),
|
||||
],
|
||||
isRepeatingAnimation: true,
|
||||
child: InkWell(
|
||||
onTap: () async {
|
||||
List favoritePlaces =
|
||||
await sql.getAllData(TableName.placesFavorite);
|
||||
print(favoritePlaces);
|
||||
// print(favoritePlaces);
|
||||
Get.defaultDialog(
|
||||
title: 'Favorite Places'.tr,
|
||||
content: SizedBox(
|
||||
@@ -224,8 +216,7 @@ class FavioratePlacesDialogu extends StatelessWidget {
|
||||
// backgroundColor:
|
||||
// AppColor.accentColor);
|
||||
},
|
||||
icon:
|
||||
const Icon(Icons.favorite_outlined),
|
||||
icon: const Icon(Icons.favorite_outlined),
|
||||
),
|
||||
],
|
||||
);
|
||||
@@ -236,8 +227,11 @@ class FavioratePlacesDialogu extends StatelessWidget {
|
||||
title: 'Back'.tr, onPressed: () => Get.back()),
|
||||
);
|
||||
},
|
||||
child: Text(
|
||||
'\u{1F3D8} ' 'Favorite Places'.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
),
|
||||
)),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:ride/constant/box_name.dart';
|
||||
import 'package:ride/controller/profile/profile_controller.dart';
|
||||
import 'package:ride/main.dart';
|
||||
import 'package:ride/views/widgets/elevated_btn.dart';
|
||||
|
||||
import '../../../constant/colors.dart';
|
||||
@@ -13,6 +16,7 @@ class RideBeginPassenger extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
ProfileController profileController = Get.put(ProfileController());
|
||||
return GetBuilder<MapPassengerController>(builder: (controller) {
|
||||
if (controller.rideTimerBegin) {
|
||||
return Positioned(
|
||||
@@ -26,6 +30,7 @@ class RideBeginPassenger extends StatelessWidget {
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
'You will arrive to your destination after '.tr,
|
||||
@@ -50,11 +55,114 @@ class RideBeginPassenger extends StatelessWidget {
|
||||
)
|
||||
],
|
||||
),
|
||||
controller.remainingTimeTimerRideBegin < 5
|
||||
? MyElevatedButton(
|
||||
title:
|
||||
'If you in destination Now. Press finish The Ride',
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
if (box.read(BoxName.sosPhonePassenger).toString() ==
|
||||
'') {
|
||||
Get.defaultDialog(
|
||||
title: 'You dont Add Emergency Phone Yet!'.tr,
|
||||
content: Column(
|
||||
children: [
|
||||
Form(
|
||||
key: controller.sosFormKey,
|
||||
child: TextFormField(
|
||||
keyboardType: TextInputType
|
||||
.phone, // Set the keyboard type to phone
|
||||
validator: (value) {
|
||||
if (value!.isEmpty ||
|
||||
value.length < 10) {
|
||||
return 'Please enter a phone number';
|
||||
}
|
||||
// Add additional validation if needed
|
||||
return null;
|
||||
},
|
||||
decoration: const InputDecoration(
|
||||
border: OutlineInputBorder(),
|
||||
hintText: 'Type here',
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
confirm: MyElevatedButton(
|
||||
title: 'Add Phone'.tr,
|
||||
onPressed: () async {
|
||||
await profileController
|
||||
.updatField('sosPhone');
|
||||
box.write(
|
||||
BoxName.sosPhonePassenger,
|
||||
profileController
|
||||
.prfoileData['sosPhone']);
|
||||
}));
|
||||
} else {
|
||||
controller
|
||||
.sendSMS(box.read(BoxName.sosPhonePassenger));
|
||||
}
|
||||
},
|
||||
icon: const Icon(
|
||||
Icons.sos_rounded,
|
||||
color: AppColor.redColor,
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
if (box.read(BoxName.sosPhonePassenger).toString() ==
|
||||
'') {
|
||||
Get.defaultDialog(
|
||||
title: 'You dont Add Emergency Phone Yet!'.tr,
|
||||
content: Column(
|
||||
children: [
|
||||
Form(
|
||||
key: controller.sosFormKey,
|
||||
child: TextFormField(
|
||||
keyboardType: TextInputType
|
||||
.phone, // Set the keyboard type to phone
|
||||
validator: (value) {
|
||||
if (value!.isEmpty ||
|
||||
value.length < 10) {
|
||||
return 'Please enter a phone number';
|
||||
}
|
||||
// Add additional validation if needed
|
||||
return null;
|
||||
},
|
||||
decoration: const InputDecoration(
|
||||
border: OutlineInputBorder(),
|
||||
hintText: 'Type here',
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
confirm: MyElevatedButton(
|
||||
title: 'Add Phone'.tr,
|
||||
onPressed: () async {
|
||||
await profileController
|
||||
.updatField('sosPhone');
|
||||
box.write(
|
||||
BoxName.sosPhonePassenger,
|
||||
profileController
|
||||
.prfoileData['sosPhone']);
|
||||
}));
|
||||
} else {
|
||||
controller.sendWhatsapp(
|
||||
box.read(BoxName.sosPhonePassenger));
|
||||
}
|
||||
},
|
||||
icon: const Icon(
|
||||
Icons.ring_volume,
|
||||
color: AppColor.blueColor,
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
// controller.remainingTimeTimerRideBegin < 5
|
||||
// ? MyElevatedButton(
|
||||
// title:
|
||||
// 'If you in destination Now. Press finish The Ride',
|
||||
// onPressed: () async {
|
||||
//todo finish the trip and rest all counter ,start new counter of the trip time
|
||||
|
||||
// await CRUD()
|
||||
@@ -76,8 +184,8 @@ class RideBeginPassenger extends StatelessWidget {
|
||||
// title: 'The Ride is Begin'.tr,
|
||||
// backgroundColor: AppColor.greenColor,
|
||||
// );
|
||||
})
|
||||
: const SizedBox()
|
||||
// })
|
||||
// : const SizedBox()
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -2,6 +2,7 @@ import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:ride/constant/box_name.dart';
|
||||
import 'package:ride/constant/colors.dart';
|
||||
import 'package:ride/constant/style.dart';
|
||||
import 'package:ride/controller/profile/profile_controller.dart';
|
||||
import 'package:ride/main.dart';
|
||||
@@ -106,11 +107,17 @@ class PassengerProfilePage extends StatelessWidget {
|
||||
.toString()),
|
||||
onTap: () {
|
||||
Get.defaultDialog(
|
||||
barrierDismissible: true,
|
||||
title: 'Update Education'.tr,
|
||||
content: Column(
|
||||
content: SizedBox(
|
||||
height: 200,
|
||||
child: Column(
|
||||
children: [
|
||||
EducationDegreePicker(),
|
||||
MyElevatedButton(
|
||||
],
|
||||
),
|
||||
),
|
||||
confirm: MyElevatedButton(
|
||||
title: 'Update Education'.tr,
|
||||
onPressed: () {
|
||||
controller.updateColumn({
|
||||
@@ -121,8 +128,6 @@ class PassengerProfilePage extends StatelessWidget {
|
||||
});
|
||||
Get.back();
|
||||
},
|
||||
)
|
||||
],
|
||||
));
|
||||
},
|
||||
),
|
||||
@@ -160,6 +165,25 @@ class PassengerProfilePage extends StatelessWidget {
|
||||
controller.updatField('maritalStatus');
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
title: Text(
|
||||
'SOS Phone'.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
leading: const Icon(
|
||||
Icons.sos,
|
||||
color: AppColor.redColor,
|
||||
size: 35,
|
||||
),
|
||||
trailing: const Icon(Icons.arrow_forward_ios),
|
||||
subtitle: Text(controller.prfoileData['sosPhone']
|
||||
.toString()),
|
||||
onTap: () async {
|
||||
await controller.updatField('sosPhone');
|
||||
box.write(BoxName.sosPhonePassenger,
|
||||
controller.prfoileData['sosPhone']);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -189,7 +213,9 @@ class GenderPicker extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return CupertinoPicker(
|
||||
return SizedBox(
|
||||
height: 100,
|
||||
child: CupertinoPicker(
|
||||
itemExtent: 32.0,
|
||||
onSelectedItemChanged: (int index) {
|
||||
controller.setGender(genderOptions[index]);
|
||||
@@ -197,6 +223,7 @@ class GenderPicker extends StatelessWidget {
|
||||
children: genderOptions.map((String value) {
|
||||
return Text(value);
|
||||
}).toList(),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -216,17 +243,21 @@ class EducationDegreePicker extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return CupertinoPicker(
|
||||
return SizedBox(
|
||||
height: 200,
|
||||
child: CupertinoPicker(
|
||||
// backgroundColor: AppColor.accentColor,
|
||||
looping: true,
|
||||
squeeze: 2, diameterRatio: 2,
|
||||
itemExtent: 32.0,
|
||||
// looping: true,
|
||||
squeeze: 2,
|
||||
// diameterRatio: 5,
|
||||
itemExtent: 32,
|
||||
onSelectedItemChanged: (int index) {
|
||||
controller.setDegree(degreeOptions[index]);
|
||||
},
|
||||
children: degreeOptions.map((String value) {
|
||||
return Text(value);
|
||||
}).toList(),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -326,14 +326,6 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.0.0"
|
||||
flutter_sms:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: flutter_sms
|
||||
sha256: "2fe5f584f02596343557eeca56348f9b82413fefe83a423fab880cdbdf54d8d8"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.3.3"
|
||||
flutter_spinkit:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
||||
@@ -37,7 +37,6 @@ dependencies:
|
||||
flutter_launcher_icons: ^0.13.1
|
||||
crypto: ^3.0.3
|
||||
flutter_rating_bar: ^4.0.1
|
||||
flutter_sms: ^2.3.3
|
||||
|
||||
|
||||
dev_dependencies:
|
||||
|
||||
Reference in New Issue
Block a user