5/31/3
This commit is contained in:
BIN
assets/images/roundtrip.png
Normal file
BIN
assets/images/roundtrip.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 41 KiB |
@@ -211,6 +211,26 @@ class FirebaseMessagesController extends GetxController {
|
||||
} catch (e) {
|
||||
print('Error navigating to PassengerCallPage: $e');
|
||||
}
|
||||
} else if (message.notification!.title! == 'Call Income from Driver') {
|
||||
try {
|
||||
var myListString = message.data['passengerList'];
|
||||
var driverList = jsonDecode(myListString) as List<dynamic>;
|
||||
// if (Platform.isAndroid) {
|
||||
NotificationController().showNotification(
|
||||
'Call Income'.tr,
|
||||
message.notification!.body!,
|
||||
'iphone_ringtone',
|
||||
);
|
||||
// }
|
||||
// Assuming GetMaterialApp is initialized and context is valid for navigation
|
||||
Get.to(() => PassengerCallPage(
|
||||
channelName: driverList[1].toString(),
|
||||
token: driverList[0].toString(),
|
||||
remoteID: driverList[2].toString(),
|
||||
));
|
||||
} catch (e) {
|
||||
print('Error navigating to PassengerCallPage: $e');
|
||||
}
|
||||
} else if (message.notification!.title! == 'Call End') {
|
||||
try {
|
||||
var myListString = message.data['passengerList'];
|
||||
|
||||
@@ -48,9 +48,9 @@ class CRUD {
|
||||
required String uid,
|
||||
}) async {
|
||||
var uid = box.read(BoxName.phone) ?? box.read(BoxName.phoneDriver);
|
||||
var res = await http.get(
|
||||
Uri.parse(
|
||||
'https://repulsive-pig-rugby-shirt.cyclic.app/token?channelName=$channelName'),
|
||||
var res = await http.get(Uri.parse(
|
||||
// 'https://repulsive-pig-rugby-shirt.cyclic.app/token?channelName=$channelName'),
|
||||
'https://orca-app-b2i85.ondigitalocean.app/token?channelName=$channelName'),
|
||||
headers: {'Authorization': 'Bearer ${AK.agoraAppCertificate}'});
|
||||
|
||||
if (res.statusCode == 200) {
|
||||
|
||||
@@ -2413,8 +2413,8 @@ class MapPassengerController extends GetxController {
|
||||
costDelivery = (distance * deliveryPrice) + costDuration * latePrice;
|
||||
costLady = (distance * comfortPrice + 2) + costDuration * latePrice;
|
||||
costRayehGai = (distance * 2 * speedPrice) -
|
||||
((distance * 2 * speedPrice) * .3) +
|
||||
costDuration * latePrice;
|
||||
((distance * 1 * speedPrice) * .4) +
|
||||
costDuration * 2 * latePrice;
|
||||
|
||||
update();
|
||||
} else if (currentTime.hour >= 13 && currentTime.hour <= 16) {
|
||||
@@ -2425,8 +2425,8 @@ class MapPassengerController extends GetxController {
|
||||
costDelivery = (distance * deliveryPrice) + costDuration * heavyPrice;
|
||||
costLady = (distance * comfortPrice + 2) + costDuration * heavyPrice;
|
||||
costRayehGai = (distance * 2 * speedPrice) -
|
||||
((distance * 2 * speedPrice) * .3) +
|
||||
costDuration * heavyPrice;
|
||||
((distance * 1 * speedPrice) * .4) +
|
||||
costDuration * 2 * heavyPrice;
|
||||
|
||||
update();
|
||||
// } /
|
||||
@@ -2437,8 +2437,8 @@ class MapPassengerController extends GetxController {
|
||||
costDelivery = (distance * deliveryPrice) + costDuration;
|
||||
costLady = (distance * comfortPrice + 2) + costDuration;
|
||||
costRayehGai = (distance * 2 * speedPrice) -
|
||||
((distance * 2 * speedPrice) * .3) +
|
||||
costDuration;
|
||||
((distance * 1 * speedPrice) * .4) +
|
||||
costDuration * 2;
|
||||
update();
|
||||
}
|
||||
//print('cost $cost');
|
||||
|
||||
@@ -4,6 +4,16 @@ class MyTranslation extends Translations {
|
||||
@override
|
||||
Map<String, Map<String, String>> get keys => {
|
||||
"ar": {
|
||||
"joined": "انضم",
|
||||
"Driver joined the channel": "السائق انضم للقناة",
|
||||
"Driver left the channel": "السائق غادر القناة",
|
||||
"Call Page": "صفحة المكالمة",
|
||||
"Call End": "إنهاء المكالمة",
|
||||
"Call Left": "مكالمات متبقية",
|
||||
"\$ Next as Cash \$!": " نقداً !",
|
||||
"To use Wallet charge it": "لاستخدام المحفظة، قم بشحنها",
|
||||
"We are searching for the nearest driver to you":
|
||||
"نبحث عن أقرب سائق إليك",
|
||||
"Best choice for cities": "أفضل اختيار للمدن",
|
||||
"Rayeh Gai: Round trip service for convenient travel between cities, easy and reliable.":
|
||||
" رايح جاي: خدمة ذهاب وعودة للسفر المريح بين المدن، سهلة وموثوقة.",
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'dart:async';
|
||||
import 'package:SEFER/constant/box_name.dart';
|
||||
import 'package:SEFER/controller/home/map_passenger_controller.dart';
|
||||
import 'package:SEFER/main.dart';
|
||||
import 'package:SEFER/views/widgets/my_scafold.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -9,6 +10,9 @@ import 'package:permission_handler/permission_handler.dart';
|
||||
import 'package:agora_rtc_engine/agora_rtc_engine.dart';
|
||||
|
||||
import '../../../../constant/api_key.dart';
|
||||
import '../../../constant/colors.dart';
|
||||
import '../../../constant/style.dart';
|
||||
import '../../../controller/firebase/firbase_messge.dart';
|
||||
|
||||
String appId = AK.agoraAppId;
|
||||
|
||||
@@ -29,7 +33,7 @@ class _PassengerCallPageState extends State<PassengerCallPage> {
|
||||
int? _remoteUid = 0; // uid of the remote user
|
||||
bool _isJoined = false; // Indicates if the local user has joined the channel
|
||||
late RtcEngine agoraEngine; // Agora engine instance
|
||||
|
||||
String status = '';
|
||||
final GlobalKey<ScaffoldMessengerState> scaffoldMessengerKey =
|
||||
GlobalKey<ScaffoldMessengerState>(); // Global key to access the scaffold
|
||||
|
||||
@@ -72,18 +76,21 @@ class _PassengerCallPageState extends State<PassengerCallPage> {
|
||||
"Local user uid:${connection.localUid} joined the channel");
|
||||
setState(() {
|
||||
_isJoined = true;
|
||||
status = 'joined'.tr;
|
||||
});
|
||||
},
|
||||
onUserJoined: (RtcConnection connection, int remoteUid, int elapsed) {
|
||||
showMessage("Remote user uid:$remoteUid joined the channel");
|
||||
showMessage("Driver joined the channel".tr);
|
||||
setState(() {
|
||||
status = "Driver joined the channel".tr;
|
||||
_remoteUid = remoteUid;
|
||||
});
|
||||
},
|
||||
onUserOffline: (RtcConnection connection, int? remoteUid,
|
||||
UserOfflineReasonType reason) {
|
||||
showMessage("Remote user uid:$remoteUid left the channel");
|
||||
showMessage("Driver left the channel".tr);
|
||||
setState(() {
|
||||
status = "Driver left the channel".tr;
|
||||
_remoteUid = null;
|
||||
});
|
||||
},
|
||||
@@ -131,50 +138,127 @@ class _PassengerCallPageState extends State<PassengerCallPage> {
|
||||
// appBar: AppBar(
|
||||
// title: const Text('Get started with Voice Calling'),
|
||||
// ),
|
||||
title: 'Voice Calling'.tr,
|
||||
title: 'Call Page'.tr,
|
||||
isleading: true,
|
||||
body: [
|
||||
ListView(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 4),
|
||||
children: [
|
||||
// Status text
|
||||
Container(height: 40, child: Center(child: _status())),
|
||||
// Button Row
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: ElevatedButton(
|
||||
child: Text("Join".tr),
|
||||
onPressed: () => {join()},
|
||||
),
|
||||
Positioned(
|
||||
top: Get.height * .2,
|
||||
child: Container(
|
||||
height: 100, width: Get.width,
|
||||
decoration: AppStyle.boxDecoration,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: () async {
|
||||
// await callController.initAgoraFull();
|
||||
// callController.join();
|
||||
// FirebaseMessagesController().sendNotificationToPassengerToken(
|
||||
// 'Call Income',
|
||||
// '${'You have call from driver'.tr} ${box.read(BoxName.nameDriver)}',
|
||||
// Get.find<MapDriverController>().tokenPassenger,
|
||||
// [
|
||||
// callController.token,
|
||||
// callController.channelName,
|
||||
// callController.uid.toString(),
|
||||
// callController.remoteUid.toString(),
|
||||
// ],
|
||||
// );
|
||||
join();
|
||||
// callController.fetchToken();
|
||||
},
|
||||
child: Container(
|
||||
width: 50,
|
||||
height: 50,
|
||||
decoration: const BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: AppColor.greenColor),
|
||||
child: const Icon(
|
||||
Icons.phone,
|
||||
size: 35,
|
||||
color: AppColor.secondaryColor,
|
||||
)),
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
Expanded(
|
||||
child: ElevatedButton(
|
||||
child: Text("Leave".tr),
|
||||
onPressed: () => {leave()},
|
||||
),
|
||||
Column(
|
||||
children: [
|
||||
Text(
|
||||
status,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Text(Get.find<MapPassengerController>()
|
||||
.driverName
|
||||
.toString()),
|
||||
],
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () async {
|
||||
FirebaseMessagesController()
|
||||
.sendNotificationToPassengerToken(
|
||||
'Call End'.tr,
|
||||
'Call End',
|
||||
Get.find<MapPassengerController>().driverToken,
|
||||
[],
|
||||
);
|
||||
leave();
|
||||
Get.back();
|
||||
},
|
||||
child: Container(
|
||||
width: 50,
|
||||
height: 50,
|
||||
decoration: const BoxDecoration(
|
||||
shape: BoxShape.circle, color: AppColor.redColor),
|
||||
child: const Icon(
|
||||
Icons.phone_disabled_sharp,
|
||||
size: 35,
|
||||
color: AppColor.secondaryColor,
|
||||
)),
|
||||
)
|
||||
],
|
||||
),
|
||||
],
|
||||
// ignore: prefer_const_constructors
|
||||
),
|
||||
),
|
||||
// ListView(
|
||||
// padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 4),
|
||||
// children: [
|
||||
// // Status text
|
||||
// Container(height: 40, child: Center(child: _status())),
|
||||
// // Button Row
|
||||
// Row(
|
||||
// children: <Widget>[
|
||||
// Expanded(
|
||||
// child: ElevatedButton(
|
||||
// child: Text("Join".tr),
|
||||
// onPressed: () => {join()},
|
||||
// ),
|
||||
// ),
|
||||
// const SizedBox(width: 10),
|
||||
// Expanded(
|
||||
// child: ElevatedButton(
|
||||
// child: Text("Leave".tr),
|
||||
// onPressed: () => {leave()},
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
]),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _status() {
|
||||
String statusText;
|
||||
|
||||
if (!_isJoined) {
|
||||
statusText = 'Join a channel';
|
||||
} else if (_remoteUid == null)
|
||||
statusText = 'Waiting for a remote user to join...';
|
||||
else
|
||||
statusText = 'Connected to remote user, uid:$_remoteUid';
|
||||
|
||||
return Text(
|
||||
statusText,
|
||||
);
|
||||
}
|
||||
// Widget _status() {
|
||||
// String statusText;
|
||||
//
|
||||
// if (!_isJoined) {
|
||||
// statusText = 'Join a channel'.tr;
|
||||
// } else if (_remoteUid == null)
|
||||
// statusText = 'Waiting for a remote user to join...';
|
||||
// else
|
||||
// statusText = 'Connected to remote user, uid:$_remoteUid';
|
||||
//
|
||||
// return Text(
|
||||
// statusText,
|
||||
// );
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ class CarDetailsTypeToChoose extends StatelessWidget {
|
||||
CarType(
|
||||
carType: 'Rayeh Gai',
|
||||
carDetail: "Best choice for cities".tr,
|
||||
image: 'assets/images/freeRide.png',
|
||||
image: 'assets/images/roundtrip.png',
|
||||
),
|
||||
);
|
||||
} // Create a Set to remove duplicates based on the `carType` field
|
||||
@@ -464,7 +464,7 @@ class CarDetailsTypeToChoose extends StatelessWidget {
|
||||
content: CarDialogue(
|
||||
textToSpeechController:
|
||||
textToSpeechController,
|
||||
image: 'assets/images/lady.png',
|
||||
image: 'assets/images/roundtrip.png',
|
||||
text:
|
||||
"Rayeh Gai: Round trip service for convenient travel between cities, easy and reliable."
|
||||
.tr),
|
||||
|
||||
@@ -36,7 +36,7 @@ class SearchingCaptainWindow extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'We search nearst Driver to you'.tr,
|
||||
"We are searching for the nearest driver to you".tr,
|
||||
style: AppStyle.headTitle2,
|
||||
),
|
||||
Text(
|
||||
@@ -167,9 +167,11 @@ Widget _buildTimer(MapPassengerController mapPassengerController) {
|
||||
title: "No, thanks",
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
mapPassengerController.cancelRide();
|
||||
}),
|
||||
MyElevatedButton(
|
||||
title: "Increase Fee".tr,
|
||||
kolor: AppColor.greenColor,
|
||||
onPressed: () {
|
||||
mapPassengerController.increaseFeeByPassengerAndReOrder();
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user