This commit is contained in:
Hamza-Ayed
2023-09-06 12:01:52 +03:00
parent 4380826253
commit c2600c5938
56 changed files with 259 additions and 54 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.4 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 6.4 KiB

BIN
assets/images/2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.8 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 335 KiB

After

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.8 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 591 B

After

Width:  |  Height:  |  Size: 366 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 780 B

After

Width:  |  Height:  |  Size: 435 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 672 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 747 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1021 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 119 KiB

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.3 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

File diff suppressed because one or more lines are too long

View File

@@ -24,8 +24,8 @@ class AppLink {
static const String deletePassengersPromo = "$promo/delete.php";
static const String updatePassengersPromo = "$promo/update.php";
////=======================ride===================
static const String ride = '$server/ride/';
////=======================cancelRide===================
static const String ride = '$server/ride';
static const String addCancelRide = "$server/ride/cancelRide/add.php";
static const String cancelRide = "$server/ride/cancelRide/get.php";
//-----------------ridessss------------------
@@ -34,6 +34,12 @@ class AppLink {
static const String updateRides = "$ride/rides/update.php";
static const String deleteRides = "$ride/rides/delete.php";
//-----------------DriverOrder------------------
static const String addDriverOrder = "$ride/driver_order/add.php";
static const String getDriverOrder = "$ride/driver_order/get.php";
static const String updateDriverOrder = "$ride/driver_order/update.php";
static const String deleteDriverOrder = "$ride/driver_order/delete.php";
static const String pathImage = "$server/upload/types/";
static const String uploadImage = "$server/uploadImage.php";
static const String uploadImageType = "$server/uploadImageType.php";

View File

@@ -6,7 +6,9 @@ import 'package:get/get.dart';
import 'package:http/http.dart' as http;
import 'package:ride/constant/colors.dart';
import 'package:ride/constant/style.dart';
import 'package:ride/controller/functions/crud.dart';
import 'package:ride/controller/functions/launch.dart';
import 'package:ride/controller/functions/toast.dart';
import 'package:ride/views/widgets/elevated_btn.dart';
import '../../constant/box_name.dart';
@@ -136,14 +138,16 @@ class FirebasMessagesController extends GetxController {
Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
'Distance is '.tr + myList[4].toString() + ' Minutes'.tr,
'Distance is '.tr + myList[5].toString() + ' KM'.tr,
style: AppStyle.title,
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
'Duration of Trip is '.tr + myList[5].toString(),
'Duration of Trip is '.tr +
myList[4].toString() +
' Minutes'.tr,
style: AppStyle.title,
),
),
@@ -154,14 +158,30 @@ class FirebasMessagesController extends GetxController {
children: [
MyElevatedButton(
title: 'Apply Order'.tr,
onPressed: () {
//TODO save and request to passenger
onPressed: () async {
await CRUD().postFromDialogue(
link: AppLink.addDriverOrder,
payload: {
'driver_id': myList[6].toString(),
// box.read(BoxName.driverID).toString(),
'order_id':
message.notification!.body.toString(),
'status': 'Apply'
});
},
),
MyElevatedButton(
title: 'Refuse Order'.tr,
onPressed: () {
//TODO save and request to passenger and driver log upto 3 per 1 day
onPressed: () async {
await CRUD().postFromDialogue(
link: AppLink.addDriverOrder,
payload: {
'driver_id': myList[6].toString(),
// box.read(BoxName.driverID).toString(),
'order_id':
message.notification!.body.toString(),
'status': 'Refused'
});
},
kolor: AppColor.redColor,
),
@@ -170,6 +190,8 @@ class FirebasMessagesController extends GetxController {
)
],
));
} else if (message.notification!.title!.contains('Promo')) {
// Get.to(page)
}
}
});
@@ -285,7 +307,7 @@ class FirebasMessagesController extends GetxController {
// }
void sendNotificationDriverId(String title, body, Strin1, Strin2, Strin3,
Strin4, Strin5, Strin6, token) async {
Strin4, Strin5, Strin6, String7, token) async {
http
.post(Uri.parse('https://fcm.googleapis.com/fcm/send'),
headers: <String, String>{
@@ -300,7 +322,7 @@ class FirebasMessagesController extends GetxController {
},
'data': {
'myList': jsonEncode(
[Strin1, Strin2, Strin3, Strin4, Strin5, Strin6]),
[Strin1, Strin2, Strin3, Strin4, Strin5, Strin6, String7]),
},
'priority': 'high',
'to': token,

View File

@@ -26,7 +26,7 @@ class CRUD {
if (response.statusCode == 200) {
var jsonData = jsonDecode(response.body);
if (jsonData['status'] == 'success') {
print(jsonData);
// print(jsonData);
return response.body;
}
return jsonData['status'];
@@ -65,6 +65,39 @@ class CRUD {
return (jsonData['status']);
}
Future<dynamic> postFromDialogue({
required String link,
Map<String, dynamic>? payload,
}) async {
var url = Uri.parse(
link,
);
var response = await http.post(
url,
body: payload,
headers: {
"Content-Type": "application/x-www-form-urlencoded",
'Authorization':
'Basic ${base64Encode(utf8.encode(AppCredintials.basicAuthCredentials))}',
},
);
print(response.request);
var jsonData = jsonDecode(response.body);
if (response.statusCode == 200) {
if (jsonData['status'] == 'success') {
Get.back();
Get.snackbar(
jsonData['status'],
jsonData['message'],
);
return response.body;
}
}
return (jsonData['status']);
}
Future<dynamic> getGoogleApi({
required String link,
Map<String, dynamic>? payload,

View File

@@ -1,20 +1,17 @@
import 'dart:async';
import 'dart:convert';
import 'dart:math' show sqrt, pi, cos, sin;
import 'dart:math' show cos;
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:google_polyline_algorithm/google_polyline_algorithm.dart';
import 'package:location/location.dart';
import 'package:path/path.dart';
import 'package:ride/constant/box_name.dart';
import 'package:ride/constant/colors.dart';
import 'package:ride/constant/credential.dart';
import 'package:ride/constant/links.dart';
import 'package:ride/controller/firebase/firbase_messge.dart';
import 'package:ride/controller/functions/crud.dart';
import 'package:ride/controller/functions/secure_storage.dart';
import 'package:ride/controller/functions/toast.dart';
import 'package:ride/views/widgets/elevated_btn.dart';
import '../../main.dart';
import '../../models/model/locations.dart';
@@ -46,6 +43,7 @@ class MapController extends GetxController {
bool isPickerShown = false;
bool isButtomSheetShown = false;
bool mapType = false;
bool mapTraficON = false;
bool isCancelRidePageShown = false;
bool isCashConfirmPageShown = false;
bool isPaymentMethodPageShown = false;
@@ -53,6 +51,7 @@ class MapController extends GetxController {
bool isMainBottomMenuMap = true;
double heightButtomSheetShown = 0;
double cashConfirmPageShown = 250;
double widthMapTypeAndTrafic = 50;
double paymentPageShown = Get.height * .6;
late LatLng southwest;
late LatLng northeast;
@@ -92,6 +91,11 @@ class MapController extends GetxController {
update();
}
void changeMapTraffic() {
mapTraficON = !mapTraficON;
update();
}
void changeCancelRidePageShow() {
// rideConfirm == true
// ?
@@ -102,6 +106,7 @@ class MapController extends GetxController {
void getDrawerMenu() {
heightMenuBool = !heightMenuBool;
widthMapTypeAndTrafic = heightMenuBool == true ? 0 : 50;
heightMenu = heightMenuBool == true ? 100 : 0;
widthMenu = heightMenuBool == true ? 110 : 0;
update();
@@ -140,7 +145,7 @@ class MapController extends GetxController {
"price_for_passenger": totaME.toString(),
"distance": distance.toString()
}).then((value) {
print(value);
// print(jsonDecode(value)['message']);
List<String> body = [
'${data[0]["start_location"]['lat']},${data[0]["start_location"]['lng']}',
'${data[0]["end_location"]['lat']},${data[0]["end_location"]['lng']}',
@@ -148,16 +153,19 @@ class MapController extends GetxController {
totalDriver.toString(),
duration.toString(),
distance.toString(),
dataCarsLocationByPassenger['message'][0]['id'].toString()
];
FirebasMessagesController().sendNotificationDriverId(
'Order',
'body',
jsonDecode(value)['message'].toString(),
body[0],
body[1],
body[2],
body[3],
body[4],
body[5],
body[6],
box.read(BoxName.tokenFCM).toString(), //TODO change to Driver
);
});

View File

@@ -0,0 +1,36 @@
import 'dart:convert';
import 'package:get/get.dart';
import 'package:ride/constant/box_name.dart';
import 'package:ride/constant/links.dart';
import 'package:ride/controller/functions/crud.dart';
import 'package:ride/main.dart';
class OrderHistoryController extends GetxController {
List<dynamic> orderHistoryListPassenger = [];
bool isloading = true;
@override
void onInit() {
getOrderHistoryByPassenger();
super.onInit();
}
Future getOrderHistoryByPassenger() async {
var res = await CRUD().get(link: AppLink.getRides, payload: {
'passenger_id': box.read(BoxName.pasengerID).toString(),
});
if (res.toString() == 'failure') {
Get.snackbar('failure', 'message');
isloading = false;
update();
} else {
var jsonDecoded = jsonDecode(res);
orderHistoryListPassenger = jsonDecoded['data'];
print(orderHistoryListPassenger);
isloading = false;
update();
}
}
}

View File

@@ -11,7 +11,7 @@ import '../functions/crud.dart';
class PaymentController extends GetxController {
bool isloading = false;
bool isWalletCheced = false;
bool isWalletCheced = true;
bool isCashCheced = false;
bool isWalletFound = false;
final formKey = GlobalKey<FormState>();
@@ -23,23 +23,20 @@ class PaymentController extends GetxController {
getPassengerWallet() async {
isloading = true;
update();
box.write(BoxName.passengerWalletFound, isWalletFound);
// box.write(BoxName.passengerWalletFound, isWalletFound);
// totalPassengerWalletDetails = box.read(BoxName.passengerWalletDetails);
if (totalPassengerWalletDetails.isEmpty) {
await CRUD().get(link: AppLink.getWalletByPassenger, payload: {
'passenger_id': box.read(BoxName.pasengerID)
}).then((value) {
print(value);
totalPassengerWalletDetails = jsonDecode(value)['message'];
passengerTotalWalletAmount = totalPassengerWalletDetails[0]['total'];
box.write(BoxName.passengerWalletDetails, totalPassengerWalletDetails);
});
}
// if (box.read(BoxName.passengerWalletTotal).toString().isEmpty) {
await CRUD().get(
link: AppLink.getWalletByPassenger,
payload: {'passenger_id': box.read(BoxName.pasengerID)}).then((value) {
box.write(BoxName.passengerWalletTotal,
jsonDecode(value)['message'][0]['total'].toString());
});
// }
isloading = false;
update();
print(totalPassengerWalletDetails);
}
void onChangedPymentethodWallet(bool? value) {

View File

@@ -4,10 +4,8 @@ import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:ride/constant/colors.dart';
import 'package:ride/controller/home/map_page_controller.dart';
import 'package:ride/views/home/map_widget.dart/cancel_raide_page.dart';
import 'package:ride/views/widgets/circle_container.dart';
import 'package:ride/views/widgets/mycircular.dart';
import '../../controller/functions/toast.dart';
import '../../controller/home/menu_controller.dart';
import 'map_widget.dart/buttom_sheet_map_show.dart';
import 'map_widget.dart/cash_confirm_bottom_page.dart';
@@ -15,7 +13,8 @@ import 'map_widget.dart/main_bottom_Menu_map.dart';
import 'map_widget.dart/map_menu_widget.dart';
import 'map_widget.dart/menu_map_page.dart';
import 'map_widget.dart/payment_method.page.dart';
import 'map_widget.dart/picker_animation_container.dart';
import 'my_wallet/passenger_wallet.dart';
import 'profile/order_history.dart';
class MapPage extends StatelessWidget {
const MapPage({super.key});
@@ -25,6 +24,35 @@ class MapPage extends StatelessWidget {
Get.put(MapController());
Get.put(MyMenuController());
return Scaffold(
// appBar: AppBar(),
// drawer: Drawer(
// child: ListView(
// padding: EdgeInsets.zero,
// children: [
// ListTile(
// onTap: () {
// Get.to(() => const PassengerWallet());
// },
// leading: Icon(Icons.wallet),
// title: Text('My Wallet'),
// ),
// ListTile(
// onTap: () async {
// // await OrderHistoryController().getOrderHistoryByPassenger();
// Get.to(() => const OrderHistory());
// },
// leading: Icon(Icons.history),
// title: Text('Order History'),
// ),
// ListTile(
// onTap: () {},
// leading: Icon(Icons.money),
// title: Text('Tariff'),
// ),
// ],
// ),
// ),
body: Stack(
children: [
GetBuilder<MapController>(
@@ -135,8 +163,10 @@ class MapPage extends StatelessWidget {
mapType:
controller.mapType ? MapType.satellite : MapType.normal,
myLocationButtonEnabled: true,
indoorViewEnabled: true,
trafficEnabled: false,
// liteModeEnabled: true, tiltGesturesEnabled: false,
// indoorViewEnabled: true,
trafficEnabled: controller.mapTraficON,
buildingsEnabled: true,
mapToolbarEnabled: true,
onCameraMove: (position) {
@@ -150,17 +180,50 @@ class MapPage extends StatelessWidget {
),
GetBuilder<MapController>(
builder: (controller) => Positioned(
top: 80,
top: 85,
left: 6,
child: IconButton(
onPressed: () {
controller.changeMapType();
// Toast.show(context, 'This is a toast message!');
},
icon: const Icon(
Icons.satellite_alt,
size: 35,
),
child: Column(
children: [
AnimatedContainer(
duration: const Duration(microseconds: 200),
width: controller.widthMapTypeAndTrafic,
decoration: BoxDecoration(
border: Border.all(),
color: AppColor.secondaryColor,
borderRadius: BorderRadius.circular(15)),
child: IconButton(
onPressed: () {
controller.changeMapType();
// Toast.show(context, 'This is a toast message!');
},
icon: const Icon(
Icons.satellite_alt,
size: 29,
),
),
),
const SizedBox(
height: 5,
),
AnimatedContainer(
duration: const Duration(microseconds: 200),
width: controller.widthMapTypeAndTrafic,
decoration: BoxDecoration(
color: AppColor.secondaryColor,
border: Border.all(),
borderRadius: BorderRadius.circular(15)),
child: IconButton(
onPressed: () {
controller.changeMapTraffic();
// Toast.show(context, 'This is a toast message!');
},
icon: const Icon(
Icons.streetview_sharp,
size: 29,
),
),
),
],
)),
),
const PickerIconOnMap(),

View File

@@ -7,7 +7,6 @@ import 'package:ride/views/widgets/elevated_btn.dart';
import '../../../constant/colors.dart';
import '../../../constant/style.dart';
import '../../../controller/functions/toast.dart';
import '../../../controller/home/map_page_controller.dart';
GetBuilder<MapController> buttomSheetMapPage() {

View File

@@ -49,7 +49,7 @@ class CashConfirmPageShown extends StatelessWidget {
],
),
GetBuilder<PaymentController>(
builder: (controller) => Row(
builder: (paymentController) => Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
const Icon(
@@ -69,16 +69,17 @@ class CashConfirmPageShown extends StatelessWidget {
),
Text(
// '${'Your Wallet balance is '.tr}JD ',
'${'Your Wallet balance is '.tr}JD ${controller.passengerTotalWalletAmount.toString()}',
'${'Your Wallet balance is '.tr} ${box.read(BoxName.passengerWalletTotal).toString()} JD',
style: AppStyle.subtitle,
),
],
),
const Spacer(),
Checkbox.adaptive(
value: controller.isWalletCheced,
value: paymentController.isWalletCheced,
onChanged: (value) {
controller.onChangedPymentethodWallet(value);
paymentController
.onChangedPymentethodWallet(value);
},
)
],

View File

@@ -2,7 +2,9 @@ import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:get/get_rx/src/rx_typedefs/rx_typedefs.dart';
import 'package:ride/constant/style.dart';
import 'package:ride/controller/home/profile/order_history_controller.dart';
import 'package:ride/views/home/my_wallet/passenger_wallet.dart';
import 'package:ride/views/home/profile/order_history.dart';
import '../../../constant/colors.dart';
import '../../../controller/home/map_page_controller.dart';
@@ -127,7 +129,9 @@ class MapMenuWidget extends StatelessWidget {
icon: Icons.wallet,
),
IconMainPageMap(
onTap: () {},
onTap: () async {
Get.to(() => const OrderHistory());
},
title: 'Order History',
icon: Icons.history,
),

View File

@@ -4,7 +4,9 @@ import 'package:ride/constant/style.dart';
import 'package:ride/controller/payment/payment_controller.dart';
import 'package:ride/views/widgets/my_scafold.dart';
import '../../../constant/box_name.dart';
import '../../../constant/colors.dart';
import '../../../main.dart';
class PassengerWallet extends StatelessWidget {
const PassengerWallet({super.key});
@@ -43,7 +45,7 @@ class PassengerWallet extends StatelessWidget {
child: Padding(
padding: const EdgeInsets.all(10),
child: Text(
'You Have ${controller.passengerTotalWalletAmount} JD in SEFER Wallet',
'You Have ${box.read(BoxName.passengerWalletTotal).toString()} JD in SEFER Wallet',
style: AppStyle.title,
),
),

View File

@@ -0,0 +1,35 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:ride/views/widgets/my_scafold.dart';
import 'package:ride/views/widgets/mycircular.dart';
import '../../../controller/home/profile/order_history_controller.dart';
class OrderHistory extends StatelessWidget {
const OrderHistory({super.key});
@override
Widget build(BuildContext context) {
// Instantiate the OrderHistoryController class
Get.put(OrderHistoryController());
return MyScafolld(
title: 'Order History'.tr,
isleading: true,
body: [
GetBuilder<OrderHistoryController>(
builder: (orderHistoryController) => orderHistoryController.isloading
? const MyCircularProgressIndicator()
: ListView.builder(
itemCount:
orderHistoryController.orderHistoryListPassenger.length,
itemBuilder: (BuildContext context, int index) {
return Text(orderHistoryController
.orderHistoryListPassenger[0]['date']);
},
),
)
],
);
}
}

View File

@@ -1,7 +1,6 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:ride/constant/colors.dart';
import 'package:ride/constant/style.dart';
import 'package:ride/controller/profile/profile_controller.dart';
import 'package:ride/views/widgets/elevated_btn.dart';