This commit is contained in:
Hamza-Ayed
2024-06-05 21:53:17 +03:00
parent 22487e138d
commit a3d3090a15
22 changed files with 633 additions and 539 deletions

View File

@@ -1,6 +1,7 @@
import 'dart:convert';
import 'dart:math';
import 'package:SEFER/constant/colors.dart';
import 'package:SEFER/controller/functions/location_background_controller.dart';
import 'package:SEFER/views/auth/captin/cards/sms_signup.dart';
import 'package:SEFER/views/auth/captin/register_captin.dart';
@@ -178,6 +179,7 @@ class LoginCaptinController extends GetxController {
}
} else {
print('res is null');
Get.snackbar('failure'.tr, '', backgroundColor: AppColor.redColor);
isloading = false;
update();
}

View File

@@ -41,7 +41,7 @@ class GoogleSignInHelper {
if (googleUser != null) {
await _handleSignUp(googleUser);
// if (box.read(BoxName.countryCode) == 'Egypt') {
Get.find<LoginCaptinController>().loginFromSignInGoogle(
await Get.find<LoginCaptinController>().loginFromSignInGoogle(
box.read(BoxName.driverID).toString(),
box.read(BoxName.emailDriver).toString(),
);

View File

@@ -18,7 +18,7 @@ class SmsEgyptController extends GetxController {
"password": AK.smsPasswordEgypt, //'E)Pu=an/@Z',
"message": "${AppInformation.appName} app code is $otp\ncopy it to app",
"language": box.read(BoxName.lang) == 'en' ? "e" : 'r',
"sender": "Sefer", // todo add sefer sender name
"sender": "SEFER EGY", // todo add sefer sender name
"receiver": "2$phone"
});

View File

@@ -1,5 +1,6 @@
import 'dart:convert';
import 'package:SEFER/views/widgets/elevated_btn.dart';
import 'package:fl_chart/fl_chart.dart';
import 'package:get/get.dart';
import 'package:SEFER/constant/box_name.dart';
@@ -85,34 +86,46 @@ class DurationController extends GetxController {
link: AppLink.getRidesDriverByDay,
payload: {'driver_id': box.read(BoxName.driverID)},
);
jsonData2 = jsonDecode(res);
var jsonResponse = jsonDecode(res) as Map<String, dynamic>;
isLoading = false;
// print(jsonResponse);
final List<dynamic> jsonData = jsonResponse['message'];
rideCountData = jsonData.map<MonthlyRideModel>((item) {
return MonthlyRideModel.fromJson(item);
}).toList();
ridePriceDriverData = jsonData.map<MonthlyPriceDriverModel>((item) {
return MonthlyPriceDriverModel.fromJson(item);
}).toList();
if (res != 'failure') {
jsonData2 = jsonDecode(res);
var jsonResponse = jsonDecode(res) as Map<String, dynamic>;
isLoading = false;
// print(jsonResponse);
final List<dynamic> jsonData = jsonResponse['message'];
rideCountData = jsonData.map<MonthlyRideModel>((item) {
return MonthlyRideModel.fromJson(item);
}).toList();
ridePriceDriverData = jsonData.map<MonthlyPriceDriverModel>((item) {
return MonthlyPriceDriverModel.fromJson(item);
}).toList();
final List<FlSpot> spots = rideCountData
.map((data) => FlSpot(
data.day.toDouble(),
data.countRide.toDouble(),
))
.toList();
chartRideCount = spots;
final List<FlSpot> spotsDriverPrices = ridePriceDriverData
.map((data) => FlSpot(
data.day.toDouble(),
data.pricePerDay.toDouble(),
))
.toList();
chartRidePriceDriver = spotsDriverPrices;
final List<FlSpot> spots = rideCountData
.map((data) => FlSpot(
data.day.toDouble(),
data.countRide.toDouble(),
))
.toList();
chartRideCount = spots;
final List<FlSpot> spotsDriverPrices = ridePriceDriverData
.map((data) => FlSpot(
data.day.toDouble(),
data.pricePerDay.toDouble(),
))
.toList();
chartRidePriceDriver = spotsDriverPrices;
update(); // Notify the observers about the data and loading state change
update(); // Notify the observers about the data and loading state change
} else {
Get.defaultDialog(
title: 'No data yet!'.tr,
middleText: '',
confirm: MyElevatedButton(
title: 'OK'.tr,
onPressed: () {
Get.back();
Get.back();
}));
}
}
List<DurationData> parseData(List<dynamic> json) {

View File

@@ -9,6 +9,7 @@ class LocaleController extends GetxController {
Locale? language;
String countryCode = '';
void restartApp() {
// Get.offAll(MyApp);
runApp(const MyApp());
}

View File

@@ -4,6 +4,10 @@ class MyTranslation extends Translations {
@override
Map<String, Map<String, String>> get keys => {
"ar": {
"fromBudget": "من الميزانية",
"You must restart the app to change the language.":
"يجب إعادة تشغيل التطبيق لتغيير اللغة",
"hours before trying again.": "ساعة قبل المحاولة مرة أخرى",
"Transaction failed": "فشل المعاملة",
"Wallet Type": "نوع المحفظة",
"Enter your wallet number": "أدخل رقم محفظتك",