9/3/1
This commit is contained in:
@@ -16,4 +16,5 @@ class BoxName {
|
||||
static const String cvvCode = "cvvCode";
|
||||
static const String passengerWalletDetails = "passengerWalletDetails";
|
||||
static const String passengerWalletTotal = "passengerWalletTotal";
|
||||
static const String passengerWalletFound = "passengerWalletFound";
|
||||
}
|
||||
|
||||
@@ -5,6 +5,9 @@ import 'package:flutter/material.dart';
|
||||
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/launch.dart';
|
||||
import 'package:ride/views/widgets/elevated_btn.dart';
|
||||
|
||||
import '../../constant/box_name.dart';
|
||||
import '../../constant/credential.dart';
|
||||
@@ -84,31 +87,89 @@ class FirebasMessagesController extends GetxController {
|
||||
}
|
||||
}
|
||||
|
||||
void getToken() async {
|
||||
await fcmToken.getToken().then((token) {
|
||||
Future getToken() async {
|
||||
fcmToken.getToken().then((token) {
|
||||
box.write(BoxName.tokenFCM, token);
|
||||
print(token);
|
||||
});
|
||||
|
||||
FirebaseMessaging.onMessage.listen((RemoteMessage message) {
|
||||
print(
|
||||
'onMessage: ${message.notification!.title} ${message.notification!.body}');
|
||||
if (Get.currentRoute == '/') {
|
||||
// If the app is in the foreground, show a dialog to the user
|
||||
if (message.notification!.title!.contains('ride')) {
|
||||
Get.snackbar('ride', 'message', backgroundColor: AppColor.redColor);
|
||||
}
|
||||
} else {
|
||||
// If the app is in the background or terminated, show a system tray message
|
||||
RemoteNotification? notification = message.notification;
|
||||
AndroidNotification? android = message.notification?.android;
|
||||
if (notification != null && android != null) {
|
||||
print(
|
||||
'onMessageOpenedApp: ${notification.title} ${notification.body}');
|
||||
if (message.notification!.title!.contains('ride')) {
|
||||
Get.snackbar('ride', 'message', backgroundColor: AppColor.redColor);
|
||||
// SendGpsNow().getSiteNotification();
|
||||
}
|
||||
if (message.data.isNotEmpty) {
|
||||
if (message.notification!.title!.contains('Order')) {
|
||||
var myListString = message.data['myList'];
|
||||
var myList = jsonDecode(myListString) as List<dynamic>;
|
||||
Get.defaultDialog(
|
||||
title: message.notification!.title.toString(),
|
||||
content: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// Text(message.notification!.body.toString()),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: TextButton.icon(
|
||||
onPressed: () {
|
||||
String mapUrl =
|
||||
'https://www.google.com/maps/dir/${myList[0]}/${myList[0]}/';
|
||||
print(mapUrl);
|
||||
launchUrl1(mapUrl);
|
||||
},
|
||||
icon: const Icon(Icons.map),
|
||||
label: Text('Rouats of Trip'.tr)),
|
||||
),
|
||||
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Text(
|
||||
'Tatal From Passenger is '.tr +
|
||||
double.parse(myList[2]).toStringAsFixed(2),
|
||||
style: AppStyle.title,
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Text(
|
||||
'Tatal For You is '.tr +
|
||||
double.parse(myList[3]).toStringAsFixed(2),
|
||||
style: AppStyle.title,
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Text(
|
||||
'Distance is '.tr + myList[4].toString() + ' Minutes'.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Text(
|
||||
'Duration of Trip is '.tr + myList[5].toString(),
|
||||
style: AppStyle.title,
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
MyElevatedButton(
|
||||
title: 'Apply Order'.tr,
|
||||
onPressed: () {
|
||||
//TODO save and request to passenger
|
||||
},
|
||||
),
|
||||
MyElevatedButton(
|
||||
title: 'Refuse Order'.tr,
|
||||
onPressed: () {
|
||||
//TODO save and request to passenger and driver log upto 3 per 1 day
|
||||
},
|
||||
kolor: AppColor.redColor,
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
));
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -119,8 +180,8 @@ class FirebasMessagesController extends GetxController {
|
||||
RemoteNotification? notification = message.notification;
|
||||
if (notification != null) {
|
||||
print('onMessageOpenedApp: ${notification.title} ${notification.body}');
|
||||
if (message.notification!.title!.contains('ride')) {
|
||||
Get.snackbar('ride', 'message', backgroundColor: AppColor.redColor);
|
||||
if (message.notification!.title!.contains('SEFER')) {
|
||||
Get.snackbar('SEFER', 'message', backgroundColor: AppColor.redColor);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -222,4 +283,31 @@ class FirebasMessagesController extends GetxController {
|
||||
// print('sendNotification() error: $e');
|
||||
// });
|
||||
// }
|
||||
|
||||
void sendNotificationDriverId(String title, body, Strin1, Strin2, Strin3,
|
||||
Strin4, Strin5, Strin6, token) async {
|
||||
http
|
||||
.post(Uri.parse('https://fcm.googleapis.com/fcm/send'),
|
||||
headers: <String, String>{
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': 'key=${AppCredintials.serverAPI}'
|
||||
},
|
||||
body: jsonEncode({
|
||||
'notification': <String, dynamic>{
|
||||
'title': title,
|
||||
'body': body,
|
||||
'sound': 'true'
|
||||
},
|
||||
'data': {
|
||||
'myList': jsonEncode(
|
||||
[Strin1, Strin2, Strin3, Strin4, Strin5, Strin6]),
|
||||
},
|
||||
'priority': 'high',
|
||||
'to': token,
|
||||
}))
|
||||
.whenComplete(() {})
|
||||
.catchError((e) {
|
||||
print('sendNotification() error: $e');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,8 +21,8 @@ class CRUD {
|
||||
'Basic ${base64Encode(utf8.encode(AppCredintials.basicAuthCredentials))}',
|
||||
},
|
||||
);
|
||||
// print("--------------" + response.request.toString());
|
||||
// print("--------------" + payload.toString());
|
||||
print("--------------" + response.request.toString());
|
||||
print("--------------" + payload.toString());
|
||||
if (response.statusCode == 200) {
|
||||
var jsonData = jsonDecode(response.body);
|
||||
if (jsonData['status'] == 'success') {
|
||||
|
||||
@@ -2,7 +2,6 @@ import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'dart:math' show sqrt, pi, cos, sin;
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:geolocator/geolocator.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:google_maps_flutter/google_maps_flutter.dart';
|
||||
import 'package:google_polyline_algorithm/google_polyline_algorithm.dart';
|
||||
@@ -10,6 +9,7 @@ import 'package:location/location.dart';
|
||||
import 'package:ride/constant/box_name.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/views/widgets/elevated_btn.dart';
|
||||
@@ -115,11 +115,48 @@ class MapController extends GetxController {
|
||||
update();
|
||||
}
|
||||
|
||||
changeConfirmRide() {
|
||||
changeConfirmRide() async {
|
||||
rideConfirm = true;
|
||||
print('rideConfirm= $rideConfirm');
|
||||
|
||||
//TODO add ride and get ride id and details
|
||||
await CRUD().post(link: AppLink.addRides, payload: {
|
||||
"start_location":
|
||||
'${data[0]["start_location"]['lat']},${data[0]["start_location"]['lng']}',
|
||||
"end_location":
|
||||
'${data[0]["end_location"]['lat']},${data[0]["end_location"]['lng']}',
|
||||
"date": DateTime.now().toString(),
|
||||
"time": DateTime.now().toString(),
|
||||
"endtime": durationToAdd.toString(),
|
||||
"price": totalPassenger.toString(),
|
||||
"passenger_id": box.read(BoxName.pasengerID).toString(),
|
||||
"driver_id": dataCarsLocationByPassenger['message'][0]['id'].toString(),
|
||||
"status": "active",
|
||||
"price_for_driver": totalDriver.toString(),
|
||||
"price_for_passenger": totaME.toString(),
|
||||
"distance": distance.toString()
|
||||
}).then((value) {
|
||||
print(value);
|
||||
List<String> body = [
|
||||
'${data[0]["start_location"]['lat']},${data[0]["start_location"]['lng']}',
|
||||
'${data[0]["end_location"]['lat']},${data[0]["end_location"]['lng']}',
|
||||
totalPassenger.toString(),
|
||||
totalDriver.toString(),
|
||||
duration.toString(),
|
||||
distance.toString(),
|
||||
];
|
||||
FirebasMessagesController().sendNotificationDriverId(
|
||||
'Order',
|
||||
'body',
|
||||
body[0],
|
||||
body[1],
|
||||
body[2],
|
||||
body[3],
|
||||
body[4],
|
||||
body[5],
|
||||
box.read(BoxName.tokenFCM).toString(), //TODO change to Driver
|
||||
);
|
||||
});
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
@@ -369,7 +406,8 @@ class MapController extends GetxController {
|
||||
}
|
||||
|
||||
void reloadMarkers() async {
|
||||
await getCarsLocationByPassenger();
|
||||
//TODO await getCarsLocationByPassenger();
|
||||
|
||||
// Clear existing markers
|
||||
markers.clear();
|
||||
getNearestDriverByPassengerLocation();
|
||||
@@ -392,59 +430,62 @@ class MapController extends GetxController {
|
||||
|
||||
String duratioByPassenger = '';
|
||||
void getNearestDriverByPassengerLocation() async {
|
||||
double nearestDistance = double.infinity;
|
||||
for (var i = 0; i < dataCarsLocationByPassenger['message'].length; i++) {
|
||||
var carLocation = dataCarsLocationByPassenger['message'][i];
|
||||
if (polylines.isEmpty) {
|
||||
double nearestDistance = double.infinity;
|
||||
for (var i = 0; i < dataCarsLocationByPassenger['message'].length; i++) {
|
||||
var carLocation = dataCarsLocationByPassenger['message'][i];
|
||||
|
||||
// double distance1 = Geolocator.distanceBetween(
|
||||
// mylocation.latitude,
|
||||
// mylocation.longitude,
|
||||
// double.parse(carLocation['latitude']),
|
||||
// double.parse(carLocation['longitude']),
|
||||
// );
|
||||
// if (distance1 < nearestDistance) {
|
||||
// nearestDistance = distance1;
|
||||
// // nearestCarLocation = carLocation;
|
||||
// nearestCar = CarLocation(
|
||||
// distance: distance1,
|
||||
// id: carLocation['driver_id'],
|
||||
// latitude: double.parse(carLocation['latitude']),
|
||||
// longitude: double.parse(carLocation['longitude']),
|
||||
// );
|
||||
// }
|
||||
isloading = true;
|
||||
update();
|
||||
// Make API request to get exact distance and duration
|
||||
String apiUrl =
|
||||
'${AppLink.googleMapsLink}distancematrix/json?destinations=${carLocation['latitude']},${carLocation['longitude']}&origins=${mylocation.latitude},${mylocation.longitude}&units=metric&key=${AppCredintials.mapAPIKEY}';
|
||||
var response = await CRUD().getGoogleApi(link: apiUrl, payload: {});
|
||||
if (response['status'] == "OK") {
|
||||
var data = response;
|
||||
// Extract distance and duration from the response and handle accordingly
|
||||
int distance1 = data['rows'][0]['elements'][0]['distance']['value'];
|
||||
duration1 = data['rows'][0]['elements'][0]['duration']['value'];
|
||||
duratioByPassenger = data['rows'][0]['elements'][0]['duration']['text'];
|
||||
// double distance1 = Geolocator.distanceBetween(
|
||||
// mylocation.latitude,
|
||||
// mylocation.longitude,
|
||||
// double.parse(carLocation['latitude']),
|
||||
// double.parse(carLocation['longitude']),
|
||||
// );
|
||||
// if (distance1 < nearestDistance) {
|
||||
// nearestDistance = distance1;
|
||||
// // nearestCarLocation = carLocation;
|
||||
// nearestCar = CarLocation(
|
||||
// distance: distance1,
|
||||
// id: carLocation['driver_id'],
|
||||
// latitude: double.parse(carLocation['latitude']),
|
||||
// longitude: double.parse(carLocation['longitude']),
|
||||
// );
|
||||
// }
|
||||
isloading = true;
|
||||
update();
|
||||
// Make API request to get exact distance and duration
|
||||
String apiUrl =
|
||||
'${AppLink.googleMapsLink}distancematrix/json?destinations=${carLocation['latitude']},${carLocation['longitude']}&origins=${mylocation.latitude},${mylocation.longitude}&units=metric&key=${AppCredintials.mapAPIKEY}';
|
||||
var response = await CRUD().getGoogleApi(link: apiUrl, payload: {});
|
||||
if (response['status'] == "OK") {
|
||||
var data = response;
|
||||
// Extract distance and duration from the response and handle accordingly
|
||||
int distance1 = data['rows'][0]['elements'][0]['distance']['value'];
|
||||
duration1 = data['rows'][0]['elements'][0]['duration']['value'];
|
||||
duratioByPassenger =
|
||||
data['rows'][0]['elements'][0]['duration']['text'];
|
||||
|
||||
if (distance1 < nearestDistance) {
|
||||
nearestDistance = distance1.toDouble();
|
||||
if (distance1 < nearestDistance) {
|
||||
nearestDistance = distance1.toDouble();
|
||||
|
||||
nearestCar = CarLocation(
|
||||
distance: distance1.toDouble(),
|
||||
duration: duration1.toDouble(),
|
||||
id: carLocation['driver_id'],
|
||||
latitude: double.parse(carLocation['latitude']),
|
||||
longitude: double.parse(carLocation['longitude']),
|
||||
);
|
||||
isloading = false;
|
||||
update();
|
||||
nearestCar = CarLocation(
|
||||
distance: distance1.toDouble(),
|
||||
duration: duration1.toDouble(),
|
||||
id: carLocation['driver_id'],
|
||||
latitude: double.parse(carLocation['latitude']),
|
||||
longitude: double.parse(carLocation['longitude']),
|
||||
);
|
||||
isloading = false;
|
||||
update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Handle the distance and duration as needed
|
||||
else {
|
||||
print(
|
||||
'Failed to retrieve distance and duration: ${response['status']}');
|
||||
// Handle the failure case
|
||||
// Handle the distance and duration as needed
|
||||
else {
|
||||
print(
|
||||
'Failed to retrieve distance and duration: ${response['status']}');
|
||||
// Handle the failure case
|
||||
}
|
||||
}
|
||||
}
|
||||
print(nearestCar!.distance);
|
||||
@@ -534,6 +575,7 @@ class MapController extends GetxController {
|
||||
bool promoTaken = false;
|
||||
void applyPromoCodetoPassenger() async {
|
||||
//TAWJIHI
|
||||
|
||||
CRUD().get(link: AppLink.getPassengersPromo, payload: {
|
||||
'promo_code': promo.text,
|
||||
}).then((value) {
|
||||
@@ -736,8 +778,8 @@ class MapController extends GetxController {
|
||||
@override
|
||||
void onInit() async {
|
||||
await getLocation();
|
||||
await getCarsLocationByPassenger();
|
||||
getNearestDriverByPassengerLocation();
|
||||
// await getCarsLocationByPassenger();
|
||||
// getNearestDriverByPassengerLocation();
|
||||
addCustomPicker();
|
||||
addCustomCarIcon();
|
||||
startMarkerReloading();
|
||||
|
||||
@@ -13,30 +13,34 @@ class PaymentController extends GetxController {
|
||||
bool isloading = false;
|
||||
bool isWalletCheced = false;
|
||||
bool isCashCheced = false;
|
||||
bool isWalletFound = false;
|
||||
final formKey = GlobalKey<FormState>();
|
||||
final promo = TextEditingController();
|
||||
double totalPassenger = MapController().totalPassenger;
|
||||
List<dynamic> totalPassengerWalletDetails = [];
|
||||
String passengerTotalWalletAmount = '';
|
||||
|
||||
getPassengerWallet() async {
|
||||
isloading = true;
|
||||
update();
|
||||
if (box.read(BoxName.passengerWalletDetails) == null) {
|
||||
box.write(BoxName.passengerWalletFound, isWalletFound);
|
||||
// totalPassengerWalletDetails = box.read(BoxName.passengerWalletDetails);
|
||||
|
||||
if (totalPassengerWalletDetails == null ||
|
||||
totalPassengerWalletDetails.isEmpty) {
|
||||
await CRUD().get(link: AppLink.getWalletByPassenger, payload: {
|
||||
'passenger_id': box.read(BoxName.pasengerID)
|
||||
}).then((value) {
|
||||
final total = jsonDecode(value)['message'];
|
||||
|
||||
box.write(BoxName.passengerWalletDetails, total);
|
||||
print(value);
|
||||
totalPassengerWalletDetails = jsonDecode(value)['message'];
|
||||
passengerTotalWalletAmount = totalPassengerWalletDetails[0]['total'];
|
||||
box.write(BoxName.passengerWalletDetails, totalPassengerWalletDetails);
|
||||
});
|
||||
isloading = false;
|
||||
update();
|
||||
print('from empty');
|
||||
print(box.read(BoxName.passengerWalletDetails));
|
||||
} else {
|
||||
box.read(BoxName.passengerWalletDetails);
|
||||
update();
|
||||
print('from full');
|
||||
print(box.read(BoxName.passengerWalletDetails));
|
||||
}
|
||||
|
||||
isloading = false;
|
||||
update();
|
||||
print(totalPassengerWalletDetails);
|
||||
}
|
||||
|
||||
void onChangedPymentethodWallet(bool? value) {
|
||||
@@ -63,6 +67,7 @@ class PaymentController extends GetxController {
|
||||
var firstElement = decod["message"][0];
|
||||
totalPassenger = totalPassenger -
|
||||
(totalPassenger * int.parse(firstElement['amount']));
|
||||
MapController().promoTaken = true;
|
||||
update();
|
||||
print(totalPassenger);
|
||||
}
|
||||
@@ -70,8 +75,8 @@ class PaymentController extends GetxController {
|
||||
}
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
getPassengerWallet();
|
||||
void onInit() async {
|
||||
await getPassengerWallet();
|
||||
|
||||
super.onInit();
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ void main() async {
|
||||
|
||||
await FirebasMessagesController().requestFirebaseMessagingPermission();
|
||||
// await FirebasMessagesController().getNotificationSettings();
|
||||
FirebasMessagesController().getToken();
|
||||
await FirebasMessagesController().getToken();
|
||||
await FirebasMessagesController().getTokens();
|
||||
LocationPermissions().locationPermissions();
|
||||
FirebaseMessaging.onBackgroundMessage(backgroundMessageHandler);
|
||||
|
||||
@@ -129,7 +129,8 @@ class MapPage extends StatelessWidget {
|
||||
// Circle(
|
||||
// circleId: const CircleId('kk'),
|
||||
// center: controller.mylocation,
|
||||
// radius: 2000)
|
||||
// radius: 60,
|
||||
// fillColor: AppColor.primaryColor,)
|
||||
// },
|
||||
mapType:
|
||||
controller.mapType ? MapType.satellite : MapType.normal,
|
||||
|
||||
@@ -233,61 +233,62 @@ GetBuilder<MapController> buttomSheetMapPage() {
|
||||
),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
Get.defaultDialog(
|
||||
title: 'Add Promo'.tr,
|
||||
content: Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
width:
|
||||
Get.width * .7,
|
||||
child:
|
||||
TextFormField(
|
||||
controller:
|
||||
controller.promo,
|
||||
decoration:
|
||||
InputDecoration(
|
||||
labelText: 'Promo Code'.tr,
|
||||
hintText: 'Enter promo code'.tr,
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
filled: true,
|
||||
fillColor: Colors.grey[200],
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: const BorderSide(
|
||||
color: AppColor.primaryColor,
|
||||
width: 2.0,
|
||||
Get
|
||||
.defaultDialog(
|
||||
title: 'Add Promo'
|
||||
.tr,
|
||||
content:
|
||||
Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
width: Get.width * .7,
|
||||
child: TextFormField(
|
||||
controller: controller.promo,
|
||||
decoration: InputDecoration(
|
||||
labelText: 'Promo Code'.tr,
|
||||
hintText: 'Enter promo code'.tr,
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
filled: true,
|
||||
fillColor: Colors.grey[200],
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: const BorderSide(
|
||||
color: AppColor.primaryColor,
|
||||
width: 2.0,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
errorBorder: OutlineInputBorder(
|
||||
borderSide: const BorderSide(
|
||||
color: Colors.red,
|
||||
width: 2.0,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: const BorderSide(
|
||||
color: Colors.grey,
|
||||
width: 1.0,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
errorBorder: OutlineInputBorder(
|
||||
borderSide: const BorderSide(
|
||||
color: Colors.red,
|
||||
width: 2.0,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: const BorderSide(
|
||||
color: Colors.grey,
|
||||
width: 1.0,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
MyElevatedButton(
|
||||
title:
|
||||
'Add Promo'.tr,
|
||||
onPressed:
|
||||
() async {
|
||||
controller.applyPromoCodetoPassenger();
|
||||
Get.back();
|
||||
},
|
||||
)
|
||||
],
|
||||
));
|
||||
MyElevatedButton(
|
||||
title: 'Add Promo'.tr,
|
||||
onPressed: () async {
|
||||
if (controller.promoTaken == false) {
|
||||
controller.applyPromoCodetoPassenger();
|
||||
Get.back();
|
||||
} else {
|
||||
Get.defaultDialog(title: 'You have Promo ?.'.tr);
|
||||
}
|
||||
},
|
||||
)
|
||||
],
|
||||
));
|
||||
},
|
||||
child: Text(
|
||||
'Add Promo'.tr,
|
||||
|
||||
@@ -2,11 +2,8 @@ import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:ride/constant/box_name.dart';
|
||||
import 'package:ride/constant/style.dart';
|
||||
import 'package:ride/controller/functions/secure_storage.dart';
|
||||
import 'package:ride/controller/home/payment/payment_controller.dart';
|
||||
import 'package:ride/views/widgets/circle_container.dart';
|
||||
import 'package:ride/views/widgets/elevated_btn.dart';
|
||||
import 'package:ride/views/widgets/mycircular.dart';
|
||||
|
||||
import '../../../constant/colors.dart';
|
||||
import '../../../controller/home/map_page_controller.dart';
|
||||
@@ -72,7 +69,7 @@ class CashConfirmPageShown extends StatelessWidget {
|
||||
),
|
||||
Text(
|
||||
// '${'Your Wallet balance is '.tr}JD ',
|
||||
'${'Your Wallet balance is '.tr}JD ${box.read(BoxName.passengerWalletDetails)[0]['total'].toString()}',
|
||||
'${'Your Wallet balance is '.tr}JD ${controller.passengerTotalWalletAmount.toString()}',
|
||||
style: AppStyle.subtitle,
|
||||
),
|
||||
],
|
||||
|
||||
@@ -6,18 +6,19 @@ import '../../constant/colors.dart';
|
||||
class MyElevatedButton extends StatelessWidget {
|
||||
final String title;
|
||||
final VoidCallback onPressed;
|
||||
|
||||
final Color kolor;
|
||||
const MyElevatedButton({
|
||||
Key? key,
|
||||
required this.title,
|
||||
required this.onPressed,
|
||||
this.kolor = AppColor.primaryColor,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ElevatedButton(
|
||||
style: ButtonStyle(
|
||||
backgroundColor: MaterialStateProperty.all(AppColor.primaryColor),
|
||||
backgroundColor: MaterialStateProperty.all(kolor),
|
||||
),
|
||||
onPressed: onPressed,
|
||||
child: Text(
|
||||
|
||||
Reference in New Issue
Block a user