2/25/2
This commit is contained in:
@@ -64,6 +64,7 @@ class AppLink {
|
||||
static String addDriverPaymentPoints = "$ride/driverPayment/add.php";
|
||||
static String getDriverPaymentPoints = "$ride/driverWallet/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 getAllPaymentVisa = "$ride/payment/getAllPaymentVisa.php";
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ class HomeCaptainController extends GetxController {
|
||||
bool isLoading = true;
|
||||
bool isCallOn = false;
|
||||
String totalMoneyToday = '0';
|
||||
String countRideToday = '0';
|
||||
String totalMoneyInSEFER = '0';
|
||||
String totalDurationToday = '0';
|
||||
Timer? timer;
|
||||
@@ -196,6 +197,7 @@ class HomeCaptainController extends GetxController {
|
||||
await getlocation();
|
||||
onButtonSelected();
|
||||
getPaymentToday();
|
||||
getCountRideToday();
|
||||
getAllPayment();
|
||||
startPeriodicExecution();
|
||||
onMapCreated(mapHomeCaptaiController!);
|
||||
@@ -224,6 +226,17 @@ class HomeCaptainController extends GetxController {
|
||||
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 {
|
||||
var res = await CRUD().get(
|
||||
link: AppLink.getAllPaymentFromRide,
|
||||
|
||||
@@ -290,6 +290,7 @@ class MapDriverController extends GetxController {
|
||||
return d['message'][0]['count'];
|
||||
}
|
||||
|
||||
Position? currentPosition;
|
||||
void startRideFromDriver() async {
|
||||
changeRideToBeginToPassenger();
|
||||
isPassengerInfoWindow = false;
|
||||
@@ -325,7 +326,37 @@ class MapDriverController extends GetxController {
|
||||
'driverID': box.read(BoxName.driverID).toString(),
|
||||
});
|
||||
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();
|
||||
print('...................');
|
||||
print(d);
|
||||
|
||||
@@ -564,6 +564,10 @@ class MyTranslation extends Translations {
|
||||
'from 12:00 till 15:00 (Thursday, Friday, Saturday, Monday)':
|
||||
"من 12:00 إلى 15:00 (يوم الخميس، الجمعة، السبت، الإثنين)",
|
||||
'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",
|
||||
'Rate Driver': "تقييم السائق",
|
||||
'Total Cost is ': ' صافي الربح ',
|
||||
|
||||
@@ -15,7 +15,7 @@ class DriverWalletHistoryController extends GetxController {
|
||||
update();
|
||||
var res = await CRUD().get(
|
||||
link: AppLink.getWalletByDriver,
|
||||
payload: {'driver_id': box.read(BoxName.driverID)});
|
||||
payload: {'driverID': box.read(BoxName.driverID)});
|
||||
|
||||
archive = jsonDecode(res)['message'];
|
||||
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/widgets.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:google_maps_flutter/google_maps_flutter.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/info.dart';
|
||||
import '../../../../constant/links.dart';
|
||||
import '../../../../constant/style.dart';
|
||||
import '../../../../constant/table_names.dart';
|
||||
import '../../../../controller/functions/crud.dart';
|
||||
import '../../../../controller/functions/location_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/widget/call_page.dart';
|
||||
import '../../../../controller/home/captin/widget/connect.dart';
|
||||
import '../../../../controller/home/captin/widget/left_menu_map_captain.dart';
|
||||
import '../../../../controller/home/payment/captain_wallet_controller.dart';
|
||||
import '../../../../controller/local/local_controller.dart';
|
||||
import '../../../../main.dart';
|
||||
import '../../../widgets/circle_container.dart';
|
||||
|
||||
class HomeCaptain extends StatelessWidget {
|
||||
HomeCaptain({super.key});
|
||||
final LocationController locationController = Get.put(LocationController());
|
||||
// final HomeCaptainController homeCaptainController = HomeCaptainController();
|
||||
// final LocationController locationController=LocationController();
|
||||
final HomeCaptainController homeCaptainController =
|
||||
Get.put(HomeCaptainController());
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Get.put(OrderRequestController());
|
||||
Get.put(HomeCaptainController());
|
||||
// Get.put(LocationController());
|
||||
print('local is ${Get.find<LocaleController>().language!.countryCode}');
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
backgroundColor: AppColor.greenColor,
|
||||
@@ -116,8 +109,8 @@ class HomeCaptain extends StatelessWidget {
|
||||
child: const ConnectWidget()),
|
||||
Positioned(
|
||||
top: 5,
|
||||
right: Get.width * .17,
|
||||
left: Get.width * .17,
|
||||
right: Get.width * .05,
|
||||
left: Get.width * .05,
|
||||
child: GetBuilder<HomeCaptainController>(
|
||||
builder: (homeCaptainController) => Container(
|
||||
decoration: AppStyle.boxDecoration,
|
||||
@@ -142,24 +135,40 @@ class HomeCaptain extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
const Icon(
|
||||
Entypo.loop,
|
||||
Entypo.wallet,
|
||||
color: AppColor.yellowColor,
|
||||
),
|
||||
Text(
|
||||
' You Have in'.tr +
|
||||
' ${AppInformation.appName} '.tr +
|
||||
homeCaptainController.totalMoneyInSEFER,
|
||||
'${' You Have in'.tr} ${homeCaptainController.totalMoneyInSEFER} ${AppInformation.appName} ',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
],
|
||||
),
|
||||
Text(
|
||||
'Total points is '.tr +
|
||||
Get.find<CaptainWalletController>().totalPoints,
|
||||
style: AppStyle.title,
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
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,
|
||||
// child: IconButton(
|
||||
// onPressed: () {
|
||||
// Get.to(() => const CallPage());
|
||||
// homeCaptainController.getCountRideToday();
|
||||
// },
|
||||
// icon: const Icon(Icons.call),
|
||||
// ),
|
||||
|
||||
@@ -20,27 +20,36 @@ GetBuilder<MapPassengerController> timerForCancelTripFromPassenger() {
|
||||
decoration: AppStyle.boxDecoration,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
CircularProgressIndicator(
|
||||
value: controller.progress,
|
||||
// Set the color based on the "isNearEnd" condition
|
||||
color: isNearEnd ? Colors.red : Colors.blue,
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: <Widget>[
|
||||
Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
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(
|
||||
'${controller.remainingTime}',
|
||||
style: AppStyle.number,
|
||||
),
|
||||
'You can cancel Ride now'.tr,
|
||||
style: AppStyle.title,
|
||||
)
|
||||
],
|
||||
),
|
||||
const SizedBox(
|
||||
width: 30,
|
||||
),
|
||||
Text(
|
||||
'You can cancel Ride now'.tr,
|
||||
'After this period\nYou can\'t cancel!'.tr,
|
||||
style: AppStyle.title,
|
||||
)
|
||||
],
|
||||
|
||||
@@ -27,14 +27,14 @@ class PaymentHistoryDriverPage extends StatelessWidget {
|
||||
padding: const EdgeInsets.all(4),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: double.parse(list['balance']) < 0
|
||||
color: double.parse(list['amount']) < 0
|
||||
? AppColor.redColor.withOpacity(.4)
|
||||
: AppColor.greenColor.withOpacity(.4)),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
list['balance'],
|
||||
list['amount'],
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Text(
|
||||
|
||||
@@ -169,8 +169,10 @@ class WaletCaptain extends StatelessWidget {
|
||||
child: MyTextForm(
|
||||
controller: captainWalletController
|
||||
.amountFromBudgetController,
|
||||
label: 'insert amount'.tr,
|
||||
hint: 'insert amount'.tr,
|
||||
label:
|
||||
'${'You have in account'.tr} ${captainWalletController.totalAmount}',
|
||||
hint:
|
||||
'${'You have in account'.tr} ${captainWalletController.totalAmount}',
|
||||
type: TextInputType.number,
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user