2/25/2
This commit is contained in:
@@ -64,6 +64,7 @@ class AppLink {
|
|||||||
static String addDriverPaymentPoints = "$ride/driverPayment/add.php";
|
static String addDriverPaymentPoints = "$ride/driverPayment/add.php";
|
||||||
static String getDriverPaymentPoints = "$ride/driverWallet/get.php";
|
static String getDriverPaymentPoints = "$ride/driverWallet/get.php";
|
||||||
static String getDriverpaymentToday = "$ride/payment/get.php";
|
static String getDriverpaymentToday = "$ride/payment/get.php";
|
||||||
|
static String getCountRide = "$ride/payment/getCountRide.php";
|
||||||
static String getAllPaymentFromRide = "$ride/payment/getAllPayment.php";
|
static String getAllPaymentFromRide = "$ride/payment/getAllPayment.php";
|
||||||
static String getAllPaymentVisa = "$ride/payment/getAllPaymentVisa.php";
|
static String getAllPaymentVisa = "$ride/payment/getAllPaymentVisa.php";
|
||||||
|
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ class HomeCaptainController extends GetxController {
|
|||||||
bool isLoading = true;
|
bool isLoading = true;
|
||||||
bool isCallOn = false;
|
bool isCallOn = false;
|
||||||
String totalMoneyToday = '0';
|
String totalMoneyToday = '0';
|
||||||
|
String countRideToday = '0';
|
||||||
String totalMoneyInSEFER = '0';
|
String totalMoneyInSEFER = '0';
|
||||||
String totalDurationToday = '0';
|
String totalDurationToday = '0';
|
||||||
Timer? timer;
|
Timer? timer;
|
||||||
@@ -196,6 +197,7 @@ class HomeCaptainController extends GetxController {
|
|||||||
await getlocation();
|
await getlocation();
|
||||||
onButtonSelected();
|
onButtonSelected();
|
||||||
getPaymentToday();
|
getPaymentToday();
|
||||||
|
getCountRideToday();
|
||||||
getAllPayment();
|
getAllPayment();
|
||||||
startPeriodicExecution();
|
startPeriodicExecution();
|
||||||
onMapCreated(mapHomeCaptaiController!);
|
onMapCreated(mapHomeCaptaiController!);
|
||||||
@@ -224,6 +226,17 @@ class HomeCaptainController extends GetxController {
|
|||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getCountRideToday() async {
|
||||||
|
var res = await CRUD().get(
|
||||||
|
link: AppLink.getCountRide,
|
||||||
|
payload: {'driver_id': box.read(BoxName.driverID).toString()});
|
||||||
|
data = jsonDecode(res);
|
||||||
|
|
||||||
|
countRideToday = data['message'][0]['count'].toString();
|
||||||
|
// print(countRideToday);
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
getAllPayment() async {
|
getAllPayment() async {
|
||||||
var res = await CRUD().get(
|
var res = await CRUD().get(
|
||||||
link: AppLink.getAllPaymentFromRide,
|
link: AppLink.getAllPaymentFromRide,
|
||||||
|
|||||||
@@ -290,6 +290,7 @@ class MapDriverController extends GetxController {
|
|||||||
return d['message'][0]['count'];
|
return d['message'][0]['count'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Position? currentPosition;
|
||||||
void startRideFromDriver() async {
|
void startRideFromDriver() async {
|
||||||
changeRideToBeginToPassenger();
|
changeRideToBeginToPassenger();
|
||||||
isPassengerInfoWindow = false;
|
isPassengerInfoWindow = false;
|
||||||
@@ -325,7 +326,37 @@ class MapDriverController extends GetxController {
|
|||||||
'driverID': box.read(BoxName.driverID).toString(),
|
'driverID': box.read(BoxName.driverID).toString(),
|
||||||
});
|
});
|
||||||
var d = jsonDecode(res);
|
var d = jsonDecode(res);
|
||||||
mapController!.animateCamera(CameraUpdate.newLatLngZoom(myLocation, 18));
|
// mapController!.animateCamera(
|
||||||
|
// CameraUpdate.newLatLngZoom(
|
||||||
|
// myLocation,
|
||||||
|
// 12,
|
||||||
|
// ),
|
||||||
|
// );
|
||||||
|
|
||||||
|
StreamSubscription<Position>? locationSubscription;
|
||||||
|
|
||||||
|
try {
|
||||||
|
locationSubscription =
|
||||||
|
Geolocator.getPositionStream().listen((Position position) {
|
||||||
|
currentPosition = position;
|
||||||
|
// Update camera position on the map
|
||||||
|
mapController!.animateCamera(
|
||||||
|
CameraUpdate.newCameraPosition(
|
||||||
|
CameraPosition(
|
||||||
|
target: LatLng(position.latitude, position.longitude),
|
||||||
|
zoom: 7,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}); // Stop listening to GPS updates when the ride is finished
|
||||||
|
if (!isRideBegin) {
|
||||||
|
locationSubscription?.cancel();
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
debugPrint('Error listening to GPS: $error');
|
||||||
|
// Handle GPS errors gracefully, e.g., show a user-friendly message
|
||||||
|
}
|
||||||
|
|
||||||
update();
|
update();
|
||||||
print('...................');
|
print('...................');
|
||||||
print(d);
|
print(d);
|
||||||
|
|||||||
@@ -564,6 +564,10 @@ class MyTranslation extends Translations {
|
|||||||
'from 12:00 till 15:00 (Thursday, Friday, Saturday, Monday)':
|
'from 12:00 till 15:00 (Thursday, Friday, Saturday, Monday)':
|
||||||
"من 12:00 إلى 15:00 (يوم الخميس، الجمعة، السبت، الإثنين)",
|
"من 12:00 إلى 15:00 (يوم الخميس، الجمعة، السبت، الإثنين)",
|
||||||
'Night': "الليل",
|
'Night': "الليل",
|
||||||
|
'You have in account': 'يوجد في حسابك ',
|
||||||
|
'Ride Today :': 'عدد الرحلات : ',
|
||||||
|
'After this period\nYou can\'t cancel!':
|
||||||
|
'بعد هذه الفتره \nلا تستطيع الغاء الرحله',
|
||||||
'from 23:59 till 05:30': "من 23:59 إلى 05:30",
|
'from 23:59 till 05:30': "من 23:59 إلى 05:30",
|
||||||
'Rate Driver': "تقييم السائق",
|
'Rate Driver': "تقييم السائق",
|
||||||
'Total Cost is ': ' صافي الربح ',
|
'Total Cost is ': ' صافي الربح ',
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ class DriverWalletHistoryController extends GetxController {
|
|||||||
update();
|
update();
|
||||||
var res = await CRUD().get(
|
var res = await CRUD().get(
|
||||||
link: AppLink.getWalletByDriver,
|
link: AppLink.getWalletByDriver,
|
||||||
payload: {'driver_id': box.read(BoxName.driverID)});
|
payload: {'driverID': box.read(BoxName.driverID)});
|
||||||
|
|
||||||
archive = jsonDecode(res)['message'];
|
archive = jsonDecode(res)['message'];
|
||||||
print(archive);
|
print(archive);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import 'package:SEFER/views/home/Captin/home_captain/driver_call_page.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/widgets.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:google_maps_flutter/google_maps_flutter.dart';
|
import 'package:google_maps_flutter/google_maps_flutter.dart';
|
||||||
import 'package:flutter_font_icons/flutter_font_icons.dart';
|
import 'package:flutter_font_icons/flutter_font_icons.dart';
|
||||||
@@ -8,33 +8,26 @@ import 'package:SEFER/views/widgets/mycircular.dart';
|
|||||||
|
|
||||||
import '../../../../constant/colors.dart';
|
import '../../../../constant/colors.dart';
|
||||||
import '../../../../constant/info.dart';
|
import '../../../../constant/info.dart';
|
||||||
import '../../../../constant/links.dart';
|
|
||||||
import '../../../../constant/style.dart';
|
import '../../../../constant/style.dart';
|
||||||
import '../../../../constant/table_names.dart';
|
import '../../../../constant/table_names.dart';
|
||||||
import '../../../../controller/functions/crud.dart';
|
|
||||||
import '../../../../controller/functions/location_controller.dart';
|
import '../../../../controller/functions/location_controller.dart';
|
||||||
import '../../../../controller/home/captin/home_captain_controller.dart';
|
import '../../../../controller/home/captin/home_captain_controller.dart';
|
||||||
import '../../../../controller/home/captin/map_driver_controller.dart';
|
|
||||||
import '../../../../controller/home/captin/order_request_controller.dart';
|
import '../../../../controller/home/captin/order_request_controller.dart';
|
||||||
import '../../../../controller/home/captin/widget/call_page.dart';
|
|
||||||
import '../../../../controller/home/captin/widget/connect.dart';
|
import '../../../../controller/home/captin/widget/connect.dart';
|
||||||
import '../../../../controller/home/captin/widget/left_menu_map_captain.dart';
|
import '../../../../controller/home/captin/widget/left_menu_map_captain.dart';
|
||||||
import '../../../../controller/home/payment/captain_wallet_controller.dart';
|
import '../../../../controller/home/payment/captain_wallet_controller.dart';
|
||||||
import '../../../../controller/local/local_controller.dart';
|
|
||||||
import '../../../../main.dart';
|
import '../../../../main.dart';
|
||||||
import '../../../widgets/circle_container.dart';
|
import '../../../widgets/circle_container.dart';
|
||||||
|
|
||||||
class HomeCaptain extends StatelessWidget {
|
class HomeCaptain extends StatelessWidget {
|
||||||
HomeCaptain({super.key});
|
HomeCaptain({super.key});
|
||||||
final LocationController locationController = Get.put(LocationController());
|
final LocationController locationController = Get.put(LocationController());
|
||||||
// final HomeCaptainController homeCaptainController = HomeCaptainController();
|
final HomeCaptainController homeCaptainController =
|
||||||
// final LocationController locationController=LocationController();
|
Get.put(HomeCaptainController());
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
Get.put(OrderRequestController());
|
Get.put(OrderRequestController());
|
||||||
Get.put(HomeCaptainController());
|
|
||||||
// Get.put(LocationController());
|
|
||||||
print('local is ${Get.find<LocaleController>().language!.countryCode}');
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
backgroundColor: AppColor.greenColor,
|
backgroundColor: AppColor.greenColor,
|
||||||
@@ -116,8 +109,8 @@ class HomeCaptain extends StatelessWidget {
|
|||||||
child: const ConnectWidget()),
|
child: const ConnectWidget()),
|
||||||
Positioned(
|
Positioned(
|
||||||
top: 5,
|
top: 5,
|
||||||
right: Get.width * .17,
|
right: Get.width * .05,
|
||||||
left: Get.width * .17,
|
left: Get.width * .05,
|
||||||
child: GetBuilder<HomeCaptainController>(
|
child: GetBuilder<HomeCaptainController>(
|
||||||
builder: (homeCaptainController) => Container(
|
builder: (homeCaptainController) => Container(
|
||||||
decoration: AppStyle.boxDecoration,
|
decoration: AppStyle.boxDecoration,
|
||||||
@@ -142,24 +135,40 @@ class HomeCaptain extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
children: [
|
children: [
|
||||||
const Icon(
|
const Icon(
|
||||||
Entypo.loop,
|
Entypo.wallet,
|
||||||
color: AppColor.yellowColor,
|
color: AppColor.yellowColor,
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
' You Have in'.tr +
|
'${' You Have in'.tr} ${homeCaptainController.totalMoneyInSEFER} ${AppInformation.appName} ',
|
||||||
' ${AppInformation.appName} '.tr +
|
|
||||||
homeCaptainController.totalMoneyInSEFER,
|
|
||||||
style: AppStyle.title,
|
style: AppStyle.title,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
Text(
|
Row(
|
||||||
'Total points is '.tr +
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
Get.find<CaptainWalletController>().totalPoints,
|
children: [
|
||||||
style: AppStyle.title,
|
Text(
|
||||||
|
'Total points is '.tr +
|
||||||
|
Get.find<CaptainWalletController>().totalPoints,
|
||||||
|
style: AppStyle.title,
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
color: AppColor.greenColor,
|
||||||
|
child: Padding(
|
||||||
|
padding:
|
||||||
|
const EdgeInsets.symmetric(horizontal: 8),
|
||||||
|
child: Text(
|
||||||
|
'Ride Today :'.tr +
|
||||||
|
Get.find<HomeCaptainController>()
|
||||||
|
.countRideToday,
|
||||||
|
style: AppStyle.title,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
))),
|
))),
|
||||||
@@ -236,7 +245,7 @@ class HomeCaptain extends StatelessWidget {
|
|||||||
// bottom: Get.height * .4,
|
// bottom: Get.height * .4,
|
||||||
// child: IconButton(
|
// child: IconButton(
|
||||||
// onPressed: () {
|
// onPressed: () {
|
||||||
// Get.to(() => const CallPage());
|
// homeCaptainController.getCountRideToday();
|
||||||
// },
|
// },
|
||||||
// icon: const Icon(Icons.call),
|
// icon: const Icon(Icons.call),
|
||||||
// ),
|
// ),
|
||||||
|
|||||||
@@ -20,27 +20,36 @@ GetBuilder<MapPassengerController> timerForCancelTripFromPassenger() {
|
|||||||
decoration: AppStyle.boxDecoration,
|
decoration: AppStyle.boxDecoration,
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
child: Row(
|
child: Column(
|
||||||
children: <Widget>[
|
children: [
|
||||||
Stack(
|
Row(
|
||||||
alignment: Alignment.center,
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
children: [
|
children: <Widget>[
|
||||||
CircularProgressIndicator(
|
Stack(
|
||||||
value: controller.progress,
|
alignment: Alignment.center,
|
||||||
// Set the color based on the "isNearEnd" condition
|
children: [
|
||||||
color: isNearEnd ? Colors.red : Colors.blue,
|
CircularProgressIndicator(
|
||||||
|
value: controller.progress,
|
||||||
|
// Set the color based on the "isNearEnd" condition
|
||||||
|
color: isNearEnd ? Colors.red : Colors.blue,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
'${controller.remainingTime}',
|
||||||
|
style: AppStyle.number,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
width: 30,
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
'${controller.remainingTime}',
|
'You can cancel Ride now'.tr,
|
||||||
style: AppStyle.number,
|
style: AppStyle.title,
|
||||||
),
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(
|
|
||||||
width: 30,
|
|
||||||
),
|
|
||||||
Text(
|
Text(
|
||||||
'You can cancel Ride now'.tr,
|
'After this period\nYou can\'t cancel!'.tr,
|
||||||
style: AppStyle.title,
|
style: AppStyle.title,
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -27,14 +27,14 @@ class PaymentHistoryDriverPage extends StatelessWidget {
|
|||||||
padding: const EdgeInsets.all(4),
|
padding: const EdgeInsets.all(4),
|
||||||
child: Container(
|
child: Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: double.parse(list['balance']) < 0
|
color: double.parse(list['amount']) < 0
|
||||||
? AppColor.redColor.withOpacity(.4)
|
? AppColor.redColor.withOpacity(.4)
|
||||||
: AppColor.greenColor.withOpacity(.4)),
|
: AppColor.greenColor.withOpacity(.4)),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
list['balance'],
|
list['amount'],
|
||||||
style: AppStyle.title,
|
style: AppStyle.title,
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
|
|||||||
@@ -169,8 +169,10 @@ class WaletCaptain extends StatelessWidget {
|
|||||||
child: MyTextForm(
|
child: MyTextForm(
|
||||||
controller: captainWalletController
|
controller: captainWalletController
|
||||||
.amountFromBudgetController,
|
.amountFromBudgetController,
|
||||||
label: 'insert amount'.tr,
|
label:
|
||||||
hint: 'insert amount'.tr,
|
'${'You have in account'.tr} ${captainWalletController.totalAmount}',
|
||||||
|
hint:
|
||||||
|
'${'You have in account'.tr} ${captainWalletController.totalAmount}',
|
||||||
type: TextInputType.number,
|
type: TextInputType.number,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user