This commit is contained in:
Hamza-Ayed
2023-08-21 23:34:15 +03:00
parent b340316e11
commit c1869d2725
18 changed files with 418 additions and 116 deletions

View File

@@ -9,7 +9,8 @@ class AppLink {
//=======================ride=================== //=======================ride===================
static const String ride = '$server/ride/'; static const String ride = '$server/ride/';
static const String addCancelRide = "$server/ride/addCancelRide.php"; static const String addCancelRide = "$server/ride/cancelRide/add.php";
static const String cancelRide = "$server/ride/cancelRide/get.php";
//-----------------ridessss------------------ //-----------------ridessss------------------
static const String addRides = "$ride/rides/add.php"; static const String addRides = "$ride/rides/add.php";
static const String getRides = "$ride/rides/get.php"; static const String getRides = "$ride/rides/get.php";

View File

@@ -49,6 +49,7 @@ class CRUD {
}, },
); );
print(response.request); print(response.request);
var jsonData = jsonDecode(response.body); var jsonData = jsonDecode(response.body);
if (response.statusCode == 200) { if (response.statusCode == 200) {
if (jsonData['status'] == 'success') { if (jsonData['status'] == 'success') {

View File

@@ -9,9 +9,7 @@ import 'package:ride/constant/box_name.dart';
import 'package:ride/constant/credential.dart'; import 'package:ride/constant/credential.dart';
import 'package:ride/constant/links.dart'; import 'package:ride/constant/links.dart';
import 'package:ride/controller/functions/crud.dart'; import 'package:ride/controller/functions/crud.dart';
import 'package:ride/views/home/map_widget.dart/buttom_sheet_map_show.dart'; import 'package:http/http.dart' as http;
import 'package:ride/views/widgets/elevated_btn.dart';
import '../../main.dart'; import '../../main.dart';
import '../../models/model/locations.dart'; import '../../models/model/locations.dart';
import '../firebase/firbase_messge.dart'; import '../firebase/firbase_messge.dart';
@@ -46,7 +44,7 @@ class MapController extends GetxController {
bool isCashConfirmPageShown = false; bool isCashConfirmPageShown = false;
bool isPaymentMethodPageShown = false; bool isPaymentMethodPageShown = false;
bool isMainBottomMenuMap = true; bool isMainBottomMenuMap = true;
double heightButtomSheetShown = 300; double heightButtomSheetShown = 0;
double cashConfirmPageShown = 250; double cashConfirmPageShown = 250;
double paymentPageShown = Get.height * .6; double paymentPageShown = Get.height * .6;
late final LatLng southwest; late final LatLng southwest;
@@ -98,14 +96,32 @@ class MapController extends GetxController {
} }
int selectedReason = -1; int selectedReason = -1;
String? cancelNote;
void selectReason(int index) { void selectReason(int index, String note) {
selectedReason = index; selectedReason = index;
cancelNote = note;
update(); update();
} }
bool rideConfirm = false; bool rideConfirm = false;
void cancelRide() async { changeConfirmRide() {
rideConfirm = true;
//TODO add ride and get ride id and details
update();
}
Future cancelRide() async {
var payload = {
"driverID": "1", // Convert to String
"passengerID":
box.read(BoxName.pasengerID).toString(), // Convert to String
"rideID": "222", // Convert to String
"note": cancelNote
};
print(rideConfirm);
print(payload);
if (rideConfirm == false) { if (rideConfirm == false) {
clearPlaces(); clearPlaces();
clearpolyline(); clearpolyline();
@@ -117,12 +133,9 @@ class MapController extends GetxController {
clearpolyline(); clearpolyline();
data = []; data = [];
changeCancelRidePageShow(); changeCancelRidePageShow();
await CRUD().post(link: AppLink.addCancelRide, payload: {
"driverID": 1, await CRUD().post(link: AppLink.addCancelRide, payload: payload);
"passengerID": box.read(BoxName.pasengerID).toString(),
"rideID": 222,
"note": "zxcz"
});
update(); update();
} }
} }
@@ -385,19 +398,25 @@ class MapController extends GetxController {
late double costDuration = 0; late double costDuration = 0;
late double cost = 0; late double cost = 0;
late double distance = 0; late double distance = 0;
late double duration = 2; late double duration = 0;
DateTime currentTime = DateTime.now(); DateTime currentTime = DateTime.now();
late Duration durationToAdd; late Duration durationToAdd;
late DateTime newTime = DateTime.now(); late DateTime newTime = DateTime.now();
void bottomSheet() { Future bottomSheet() async {
if (data.isNotEmpty) { if (data.isNotEmpty) {
String distanceText = data[0]['distance']['text']; String distanceText = await data[0]['distance']['text'];
String durationText = data[0]['duration']['text']; String durationText = await data[0]['duration']['text'];
distance = getDistanceFromText(distanceText); distance = getDistanceFromText(distanceText);
duration = getDistanceFromText(durationText); duration = getDistanceFromText(durationText);
durationToAdd = Duration(minutes: duration.toInt()); durationToAdd = Duration(minutes: duration.toInt());
DateTime currentTime = DateTime.now(); DateTime currentTime = DateTime.now();
newTime = currentTime.add(durationToAdd); newTime = currentTime.add(durationToAdd);
averageDuration = duration / distance;
costDuration = duration * averageDuration * 0.016;
totalDriver = cost + costDuration;
totalPassenger = totalDriver + (totalDriver * .16);
tax = totalPassenger * .04;
totaME = totalPassenger - totalDriver - tax;
update(); update();
if (currentTime.hour >= 21) { if (currentTime.hour >= 21) {
if (distanceText.contains('km')) { if (distanceText.contains('km')) {
@@ -407,6 +426,32 @@ class MapController extends GetxController {
cost = distance * 0.23 / 1000; cost = distance * 0.23 / 1000;
update(); update();
} }
} else if (currentTime.hour < 5) {
if (distanceText.contains('km')) {
cost = distance * 0.25;
update();
} else {
cost = distance * 0.25 / 1000;
update();
}
} else if (currentTime.hour >= 13 && currentTime.hour <= 16) {
if (averageDuration > 2.5) {
if (distanceText.contains('km')) {
cost = distance * 0.23;
update();
} else {
cost = distance * 0.25 / 1000;
update();
}
} else {
if (distanceText.contains('km')) {
cost = distance * 0.21;
update();
} else {
cost = distance * 0.21 / 1000;
update();
}
}
} else { } else {
if (distanceText.contains('km')) { if (distanceText.contains('km')) {
cost = distance * 0.21; cost = distance * 0.21;
@@ -416,12 +461,7 @@ class MapController extends GetxController {
update(); update();
} }
} }
averageDuration = duration / distance;
costDuration = duration * averageDuration * 0.016;
totalDriver = cost + costDuration;
totalPassenger = totalDriver + (totalDriver * .16);
tax = totalPassenger * .04;
totaME = totalPassenger - totalDriver - tax;
if (totalPassenger < 1) { if (totalPassenger < 1) {
totalPassenger = 1; totalPassenger = 1;
update(); update();
@@ -435,8 +475,11 @@ class MapController extends GetxController {
update(); update();
} }
} }
// buttomSheetMapPage();
changeButtomSheetShown();
} }
buttomSheetMapPage();
// Get.bottomSheet( // Get.bottomSheet(
// Container( // Container(
// height: 130, // height: 130,

View File

@@ -12,9 +12,27 @@ class LocaleController extends GetxController {
ThemeData appTheme = themeEnglish; ThemeData appTheme = themeEnglish;
changeLang(String langcode) { changeLang(String langcode) {
Locale locale = Locale(langcode); Locale locale;
switch (langcode) {
case "ar":
locale = const Locale("ar");
appTheme = themeArabic;
break;
case "en":
locale = const Locale("en");
appTheme = themeEnglish;
break;
case "tr":
locale = const Locale("tr");
appTheme = themeEnglish;
break;
default:
locale = Locale(Get.deviceLocale!.languageCode);
appTheme = themeEnglish;
break;
}
box.write(BoxName.lang, langcode); box.write(BoxName.lang, langcode);
appTheme = langcode == "ar" ? themeArabic : themeEnglish;
Get.changeTheme(appTheme); Get.changeTheme(appTheme);
Get.updateLocale(locale); Get.updateLocale(locale);
update(); update();
@@ -23,15 +41,24 @@ class LocaleController extends GetxController {
@override @override
void onInit() { void onInit() {
FirebasMessagesController().requestPermission(); FirebasMessagesController().requestPermission();
if (box.read(BoxName.lang) == "ar") { String storedLang = box.read(BoxName.lang) ?? "";
language = const Locale("ar"); switch (storedLang) {
appTheme = themeArabic; case "ar":
} else if (box.read(BoxName.lang) == "en") { language = const Locale("ar");
language = const Locale("en"); appTheme = themeArabic;
appTheme = themeEnglish; break;
} else { case "en":
language = Locale(Get.deviceLocale!.languageCode); language = const Locale("en");
appTheme = themeEnglish; appTheme = themeEnglish;
break;
case "tr":
language = const Locale("tr");
appTheme = themeEnglish;
break;
default:
language = Locale(Get.deviceLocale!.languageCode);
appTheme = themeEnglish;
break;
} }
super.onInit(); super.onInit();
} }

View File

@@ -5,12 +5,178 @@ class MyTranslation extends Translations {
Map<String, Map<String, String>> get keys => { Map<String, Map<String, String>> get keys => {
"ar": { "ar": {
"Choose Language": "اختر اللغة", "Choose Language": "اختر اللغة",
"Login": "تسجيل الدخول",
"Enter your email address": "أدخل عنوان بريدك الإلكتروني",
"Please enter Your Email.": "يرجى إدخال بريدك الإلكتروني.",
"Enter your phone number": "أدخل رقم هاتفك",
"Please enter your phone number.": "يرجى إدخال رقم هاتفك.",
"Please enter Your Password.": "يرجى إدخال كلمة المرور.",
"Submit": "إرسال",
"if you dont have account": "إذا لم يكن لديك حساب",
"Register": "تسجيل",
"Accept Ride's Terms & Review Privacy Notice":
"قبول شروط الاستخدام ومراجعة إشعار الخصوصية",
"By selecting 'I Agree' below, I have reviewed and agree to the Terms of Use and acknowledge the Privacy Notice. I am at least 18 years of age.":
"من خلال اختيار 'أوافق' أدناه، قمت بمراجعة وقبول شروط الاستخدام وأقر بإشعار الخصوصية. أنا على الأقل 18 عامًا.",
"I Agree": "أوافق",
"First name": "الاسم الأول",
"Enter your first name": "أدخل اسمك الأول",
"Please enter your first name.": "يرجى إدخال اسمك الأول.",
"Last name": "اسم العائلة",
"Enter your last name": "أدخل اسمك الأخير",
"Please enter your last name.": "يرجى إدخال اسمك الأخير.",
"City": "المدينة",
"Please enter your City.": "يرجى إدخال اسم مدينتك.",
"Male": "ذكر",
"Female": "أنثى",
"Verify Email": "تحقق من البريد الإلكتروني",
"We sent 5 digit to your Email provided":
"لقد أرسلنا رمزًا مؤلفًا من 5 أرقام إلى بريدك الإلكتروني المُدخَل",
"5 digit": "5 أرقام",
"Send Verification Code": "إرسال رمز التحقق",
"Your Ride Duration is ": "مدة رحلتك ",
"You will be thier in": "ستكون هناك في",
"You trip distance is": "مسافة الرحلة",
"Fee is": "الرسوم",
"From : ": "من: ",
"To : ": "إلى: ",
"Add Promo": "إضافة برومو",
"Confirm Selection": "تأكيد الاختيار",
"distance is": "المسافة",
"duration is": "المدة",
"I don't need a ride anymore": "لست بحاجة إلى رحلة بعد الآن",
"I was just trying the application": "كنت فقط أجرب التطبيق",
"No driver accepted my request": "لم يقبل أي سائق طلبي",
"I added the wrong pick-up/drop-off location":
"أضفت موقع الالتقاط/التسليم الخاطئ",
"I don't have a reason": "ليس لدي سبب",
"Other": "آخر",
"Can we know why you want to cancel Ride ?":
"هل يمكننا معرفة سبب رغبتك في إلغاء الرحلة؟",
"Cancel Ride": "إلغاء الرحلة",
"Add Payment Method": "إضافة طريقة الدفع",
"Your Wallet balance is ": "رصيد المحفظة الخاص بك ",
"Ride Wallet": "محفظة الرحلة",
"Payment Method": "طريقة الدفع",
"Type here Place": "اكتب هنا المكان",
"Are You sure to ride to": "هل أنت متأكد من رغبتك في الذهاب إلى",
"Confirm": "تأكيد",
"Back": "رجوع",
"You are Delete": "أنت على وشك الحذف",
"Deleted": "تم الحذف",
"You Dont Have Any places yet !": "ليس لديك أي أماكن بعد!",
"Favorite Places": "الأماكن المفضلة",
"From : Current Location": "من: الموقع الحالي",
"Where to": "إلى أين",
"Notifications": "الإشعارات",
"Profile": "الملف الشخصي",
"Home": "الصفحة الرئيسية",
"My Cared": "المهتم به",
"Add Card": "إضافة بطاقة",
"Add Credit Card": "إضافة بطاقة ائتمان",
"Please enter the cardholder name": "يرجى إدخال اسم حامل البطاقة",
"Please enter the expiry date": "يرجى إدخال تاريخ انتهاء الصلاحية",
"Please enter the CVV code": "يرجى إدخال رمز CVV",
"Go To Favorite Places": "الانتقال إلى الأماكن المفضلة",
"Go to this Target": "الانتقال إلى هذا الهدف",
"My Profile": "ملفي الشخصي",
"Sign Out": "تسجيل الخروج",
"Home Page": "الصفحة الرئيسية",
"Are you want to go to this site":
"هل ترغب في الانتقال إلى هذا الموقع",
"MyLocation": "موقعي",
"my location": "موقعي",
"Target": "هدف"
},
"tr": {
"Choose Language": "Dil Seçin",
"Login": "Giriş Yap",
"Enter your email address": "E-posta adresinizi girin",
"Please enter Your Email.": "Lütfen E-posta adresinizi girin.",
"Enter your phone number": "Telefon numaranızı girin",
"Please enter your phone number.": "Lütfen telefon numaranızı girin.",
"Please enter Your Password.": "Lütfen şifrenizi girin.",
"Submit": "Gönder",
"if you dont have account": "Hesabınız yoksa",
"Register": "Kayıt Ol",
"Accept Ride's Terms & Review Privacy Notice":
"Kullanım Koşullarını Kabul Edin ve Gizlilik Bildirimini İnceleyin",
"By selecting \"I Agree\" below, I have reviewed and agree to the Terms of Use and acknowledge the Privacy Notice. I am at least 18 years of age.":
"\"Kabul Ediyorum\" seçeneğini seçerek, Kullanım Koşullarını inceledim ve kabul ettim, Gizlilik Bildirimi'ni onaylıyorum. En az 18 yaşındayım.",
"I Agree": "Kabul Ediyorum",
"First name": "Adınız",
"Enter your first name": "Adınızı girin",
"Please enter your first name.": "Lütfen adınızı girin.",
"Last name": "Soyadınız",
"Enter your last name": "Soyadınızı girin",
"Please enter your last name.": "Lütfen soyadınızı girin.",
"City": "Şehir",
"Please enter your City.": "Lütfen şehir adınızı girin.",
"Male": "Erkek",
"Female": "Kadın",
"Verify Email": "E-postayı Doğrula",
"We sent 5 digit to your Email provided":
"E-postanıza 5 haneli bir kod gönderdik",
"5 digit": "5 haneli",
"Send Verification Code": "Doğrulama Kodunu Gönder",
"Your Ride Duration is ": "Seyir Süreniz ",
"You will be thier in": "Orada olacaksınız",
"You trip distance is": "Gezi mesafesi",
"Fee is": "Ücret",
"From : ": "Başlangıç noktası: ",
"To : ": "Varış noktası: ",
"Add Promo": "Promosyon Ekle",
"Confirm Selection": "Seçimi Onayla",
"distance is": "mesafe",
"duration is": "süre",
"I don't need a ride anymore": "Artık bir sürüşe ihtiyacım yok",
"I was just trying the application": "Sadece uygulamayı deniyordum",
"No driver accepted my request":
"Hiçbir sürücü isteğimi kabul etmedi",
"I added the wrong pick-up/drop-off location":
"Yanlış kalkış/varış konumu ekledim",
"I don't have a reason": "Bir sebebim yok",
"Other": "Diğer",
"Can we know why you want to cancel Ride ?":
"Neden sürüşü iptal etmek istediğinizi öğrenebilir miyiz?",
"Cancel Ride": "Sürüşü İptal Et",
"Add Payment Method": "Ödeme Yöntemi Ekle",
"Your Wallet balance is ": "Cüzdan bakiyeniz ",
"Ride Wallet": "Sürüş Cüzdanı",
"Payment Method": "Ödeme Yöntemi",
"Type here Place": "Buraya Yer Girin",
"Are You sure to ride to":
"Şuraya gitmek istediğinizden emin misiniz",
"Confirm": "Onayla",
"Back": "Geri",
"You are Delete": "Silmektesiniz",
"Deleted": "Silindi",
"You Dont Have Any places yet !": "Henüz hiç yeriniz yok!",
"Favorite Places": "Favori Yerler",
"From : Current Location": "Başlangıç noktası: Mevcut Konum",
"Where to": "Nereye",
"Notifications": "Bildirimler",
"Profile": "Profil",
"Home": "Ana Sayfa",
"My Cared": "İlgilendiğim",
"Add Card": "Kart Ekle",
"Add Credit Card": "Kredi Kartı Ekle",
"Please enter the cardholder name":
"Lütfen kart sahibinin adını girin",
"Please enter the expiry date": "Lütfen son kullanma tarihini girin",
"Please enter the CVV code": "Lütfen CVV kodunu girin",
"Go To Favorite Places": "Favori Yerlere Git",
"Go to this Target": "Bu Hedefe Git",
"My Profile": "Profilim",
"Sign Out": "Çıkış Yap",
"Home Page": "Ana Sayfa",
"Are you want to go to this site": "Bu siteye gitmek istiyor musunuz",
"MyLocation": "Konumum",
"my location": "konumum",
"Target": "Hedef"
}, },
"en": { "en": {
"Choose Language": "Choose Language", "Choose Language": "Choose Language",
}, },
"tr": {
"Choose Language": "Dil seç",
},
}; };
} }

View File

@@ -22,7 +22,7 @@ class LoginPage extends StatelessWidget {
Get.put(LoginController()); Get.put(LoginController());
return GetBuilder<LoginController>( return GetBuilder<LoginController>(
builder: (controller) => builder: (controller) =>
MyScafolld(title: 'Login', isleading: false, body: [ MyScafolld(title: 'Login'.tr, isleading: false, body: [
if (box.read(BoxName.agreeTerms) != 'agreed') if (box.read(BoxName.agreeTerms) != 'agreed')
agreedpage() agreedpage()
else else
@@ -116,7 +116,9 @@ class LoginPage extends StatelessWidget {
borderRadius: BorderRadius.all( borderRadius: BorderRadius.all(
Radius.circular(12))), Radius.circular(12))),
labelText: 'Password'.tr, labelText: 'Password'.tr,
hintText: 'Enter your Password'.tr, hintText:
'Please enter your phone number.'
.tr,
), ),
validator: (value) { validator: (value) {
if (value!.isEmpty || if (value!.isEmpty ||
@@ -139,7 +141,7 @@ class LoginPage extends StatelessWidget {
controller.login(); controller.login();
} }
}, },
title: 'Submit', title: 'Submit'.tr,
), ),
) )
], ],
@@ -156,7 +158,7 @@ class LoginPage extends StatelessWidget {
onTap: () => Get.to(() => const RegisterPage()), onTap: () => Get.to(() => const RegisterPage()),
animatedTexts: [ animatedTexts: [
TypewriterAnimatedText( TypewriterAnimatedText(
'Register', 'Register'.tr,
textStyle: AppStyle.headtitle2, textStyle: AppStyle.headtitle2,
speed: const Duration(milliseconds: 200), speed: const Duration(milliseconds: 200),
), ),
@@ -227,7 +229,7 @@ class LoginPage extends StatelessWidget {
], ],
), ),
MyElevatedButton( MyElevatedButton(
title: 'Submit', title: 'Submit'.tr,
onPressed: () => controller.saveAgreementTerms()) onPressed: () => controller.saveAgreementTerms())
], ],
), ),

View File

@@ -14,7 +14,7 @@ class RegisterPage extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
Get.put(RegisterController()); Get.put(RegisterController());
return MyScafolld( return MyScafolld(
title: 'Register', title: 'Register'.tr,
body: [ body: [
GetBuilder<RegisterController>( GetBuilder<RegisterController>(
builder: (controller) => Form( builder: (controller) => Form(

View File

@@ -1,4 +1,8 @@
import 'package:flutter/material.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/views/lang/languages.dart';
import 'package:ride/views/widgets/circle_container.dart'; import 'package:ride/views/widgets/circle_container.dart';
import 'package:ride/views/widgets/my_scafold.dart'; import 'package:ride/views/widgets/my_scafold.dart';
@@ -9,12 +13,52 @@ class HomePage extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return MyScafolld( return MyScafolld(
isleading: true, isleading: true,
title: 'Home Page', title: 'Home Page'.tr,
body: [ body: [
Center( Column(
child: MyCircleContainer( children: [
child: const Icon(Icons.clear), Padding(
), padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10),
child: ListTile(
title: Text(
'Settings'.tr,
style: AppStyle.title,
),
subtitle: Text('To change some Settings'.tr),
trailing: const Icon(
Icons.arrow_forward_ios,
size: 30,
color: AppColor.primaryColor,
),
leading: const Icon(
Icons.settings,
color: AppColor.primaryColor,
),
),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10),
child: ListTile(
onTap: () {
Get.to(() => Language());
},
title: Text(
'Language'.tr,
style: AppStyle.title,
),
subtitle: Text('To change Languge the App'.tr),
trailing: const Icon(
Icons.arrow_forward_ios,
size: 30,
color: AppColor.primaryColor,
),
leading: const Icon(
Icons.language_sharp,
color: AppColor.primaryColor,
),
),
)
],
), ),
], ],
); );

View File

@@ -36,7 +36,7 @@ class MapPage extends StatelessWidget {
minMaxZoomPreference: const MinMaxZoomPreference(6, 18), minMaxZoomPreference: const MinMaxZoomPreference(6, 18),
onLongPress: (argument) { onLongPress: (argument) {
Get.defaultDialog( Get.defaultDialog(
title: 'Are you want to go to this site', title: 'Are you want to go to this site'.tr,
content: Column( content: Column(
children: [ children: [
Text('${argument.latitude},${argument.longitude}'), Text('${argument.latitude},${argument.longitude}'),
@@ -59,7 +59,7 @@ class MapPage extends StatelessWidget {
controller.hidePlaces(); controller.hidePlaces();
controller.changeButtomSheetShown(); controller.changeButtomSheetShown();
controller.bottomSheet(); // controller.bottomSheet();
}, },
initialCameraPosition: CameraPosition( initialCameraPosition: CameraPosition(
target: controller.mylocation, target: controller.mylocation,
@@ -73,17 +73,17 @@ class MapPage extends StatelessWidget {
icon: controller.carIcon, icon: controller.carIcon,
markerId: MarkerId(carLocation.toString())), markerId: MarkerId(carLocation.toString())),
Marker( Marker(
markerId: const MarkerId('MyLocation'), markerId: MarkerId('MyLocation'.tr),
position: controller.mylocation, position: controller.mylocation,
draggable: true, draggable: true,
icon: controller.markerIcon, icon: controller.markerIcon,
onDragEnd: (value) { onDragEnd: (value) {
print(value); print(value);
}, },
infoWindow: const InfoWindow(title: 'my location'), infoWindow: InfoWindow(title: 'my location'.tr),
), ),
Marker( Marker(
markerId: const MarkerId('destination'), markerId: MarkerId('Target'.tr),
position: controller.mydestination, position: controller.mydestination,
draggable: true, draggable: true,
onDragEnd: (v) { onDragEnd: (v) {

View File

@@ -60,13 +60,13 @@ GetBuilder<MapController> buttomSheetMapPage() {
Text( Text(
'${'Your Ride Duration is '.tr}${controller.duration} minutes'), '${'Your Ride Duration is '.tr}${controller.duration} minutes'),
Text( Text(
'You will be thier in ${DateFormat('h:mm a').format(controller.newTime)}'), '${'You will be thier in'.tr} ${DateFormat('h:mm a').format(controller.newTime)}'),
Text( Text(
'You trip distance is ${controller.distance} KM') '${'You trip distance is'.tr} ${controller.distance} KM')
], ],
), ),
Text( Text(
'Fee is \n${controller.totalPassenger.toStringAsFixed(2)}', '${'Fee is'.tr} \n${controller.totalPassenger.toStringAsFixed(2)}',
style: AppStyle.subtitle, style: AppStyle.subtitle,
), ),
], ],
@@ -196,8 +196,9 @@ GetBuilder<MapController> buttomSheetMapPage() {
), ),
), ),
MyElevatedButton( MyElevatedButton(
title: 'Confirm Selection', title: 'Confirm Selection'.tr,
onPressed: () {}, onPressed: () =>
controller.changeConfirmRide(),
) )
], ],
), ),
@@ -225,11 +226,11 @@ class Details extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [ children: [
Text( Text(
'distance is ${controller.data[0]['distance']['text']}', '${'distance is'.tr} ${controller.data[0]['distance']['text']}',
style: AppStyle.title, style: AppStyle.title,
), ),
Text( Text(
'duration is ${controller.data[0]['duration']['text']}', '${'duration is'.tr} ${controller.data[0]['duration']['text']}',
style: AppStyle.title, style: AppStyle.title,
), ),
], ],

View File

@@ -1,5 +1,4 @@
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:ride/constant/colors.dart'; import 'package:ride/constant/colors.dart';
import 'package:ride/constant/style.dart'; import 'package:ride/constant/style.dart';
@@ -65,7 +64,11 @@ GetBuilder<MapController> cancelRidePage() {
groupValue: controller.selectedReason, groupValue: controller.selectedReason,
onChanged: (int? value) { onChanged: (int? value) {
print(value); print(value);
controller.selectReason(value!); print(reasons[index]);
controller.selectReason(
value!,
reasons[index].toString(),
);
}, },
), ),
); );
@@ -74,7 +77,7 @@ GetBuilder<MapController> cancelRidePage() {
), ),
MyElevatedButton( MyElevatedButton(
title: 'Cancel Ride'.tr, title: 'Cancel Ride'.tr,
onPressed: () async { onPressed: () {
controller.cancelRide(); controller.cancelRide();
}, },
), ),

View File

@@ -113,7 +113,7 @@ class CashConfirmPageShown extends StatelessWidget {
indent: 1, indent: 1,
), ),
MyElevatedButton( MyElevatedButton(
title: 'Add Payment Method', title: 'Add Payment Method'.tr,
onPressed: () { onPressed: () {
controller.changePaymentMethodPageShown(); controller.changePaymentMethodPageShown();
CreditCardController().openPayment(); CreditCardController().openPayment();

View File

@@ -21,7 +21,7 @@ GetBuilder<MapController> formSearchPlaces() {
child: TextField( child: TextField(
decoration: InputDecoration( decoration: InputDecoration(
suffixIcon: const Icon(Icons.search), suffixIcon: const Icon(Icons.search),
hintText: 'Type here Place', hintText: 'Type here Place'.tr,
hintMaxLines: 1, hintMaxLines: 1,
prefixIcon: IconButton( prefixIcon: IconButton(
onPressed: () { onPressed: () {
@@ -56,7 +56,8 @@ GetBuilder<MapController> formSearchPlaces() {
onTap: () { onTap: () {
controller.changeHeight(); controller.changeHeight();
Get.defaultDialog( Get.defaultDialog(
title: 'Are You sure to ride to ${res['name']}', title:
'${'Are You sure to ride to'.tr} ${res['name']}',
middleText: '', middleText: '',
confirm: MyElevatedButton( confirm: MyElevatedButton(
title: 'Confirm'.tr, title: 'Confirm'.tr,

View File

@@ -67,13 +67,13 @@ class MainBottomMenuMap extends StatelessWidget {
child: AnimatedTextKit( child: AnimatedTextKit(
animatedTexts: [ animatedTexts: [
ScaleAnimatedText( ScaleAnimatedText(
'Where to ${box.read(BoxName.name)}'), '${'Where to'.tr} ${box.read(BoxName.name)}'),
WavyAnimatedText( WavyAnimatedText(
'Where to ${box.read(BoxName.name)}'), '${'Where to'.tr} ${box.read(BoxName.name)}'),
FlickerAnimatedText( FlickerAnimatedText(
'Where to ${box.read(BoxName.name)}'), '${'Where to'.tr} ${box.read(BoxName.name)}'),
WavyAnimatedText( WavyAnimatedText(
'Where to ${box.read(BoxName.name)}'), '${'Where to'.tr} ${box.read(BoxName.name)}'),
], ],
isRepeatingAnimation: true, isRepeatingAnimation: true,
onTap: () { onTap: () {
@@ -90,7 +90,7 @@ class MainBottomMenuMap extends StatelessWidget {
controller.isMainBottomMenuMap controller.isMainBottomMenuMap
? const SizedBox() ? const SizedBox()
: Text( : Text(
'From : Current Location', 'From : Current Location'.tr,
style: AppStyle.subtitle, style: AppStyle.subtitle,
), ),
controller.isMainBottomMenuMap controller.isMainBottomMenuMap
@@ -181,8 +181,8 @@ class FavioratePlacesDialogu extends StatelessWidget {
TableName.placesFavorite, TableName.placesFavorite,
favoritePlaces[index]['id']); favoritePlaces[index]['id']);
Get.back(); Get.back();
Get.snackbar('Deleted ', Get.snackbar('Deleted'.tr,
'You are Delete ${favoritePlaces[index]['name']} from your list', '${'You are Delete'.tr} ${favoritePlaces[index]['name']} from your list',
backgroundColor: backgroundColor:
AppColor.accentColor); AppColor.accentColor);
}, },

View File

@@ -83,7 +83,7 @@ class PaymentMethodPage extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
MyElevatedButton( MyElevatedButton(
title: 'Add Credit Card', title: 'Add Credit Card'.tr,
onPressed: () async { onPressed: () async {
SecureStorage().saveData( SecureStorage().saveData(
BoxName.cardNumber, BoxName.cardNumber,
@@ -196,7 +196,8 @@ class CreditCardWidget extends StatelessWidget {
labelText: 'Cardholder Name'), labelText: 'Cardholder Name'),
validator: (value) { validator: (value) {
if (value!.isEmpty) { if (value!.isEmpty) {
return 'Please enter the cardholder name'; return 'Please enter the cardholder name'
.tr;
} }
return null; return null;
}, },
@@ -228,7 +229,8 @@ class CreditCardWidget extends StatelessWidget {
labelText: 'Expiry Date'), labelText: 'Expiry Date'),
validator: (value) { validator: (value) {
if (value!.isEmpty) { if (value!.isEmpty) {
return 'Please enter the expiry date'; return 'Please enter the expiry date'
.tr;
} }
return null; return null;
}, },
@@ -262,7 +264,7 @@ class CreditCardWidget extends StatelessWidget {
validator: (value) { validator: (value) {
if (value!.isEmpty && if (value!.isEmpty &&
value.length != 3) { value.length != 3) {
return 'Please enter the CVV code'; return 'Please enter the CVV code'.tr;
} }
return null; return null;
}, },

View File

@@ -75,7 +75,7 @@ class PickerAnimtionContainerFormPlaces extends StatelessWidget {
? InkWell( ? InkWell(
onTap: () {}, onTap: () {},
child: formSearchPlaces(), child: formSearchPlaces(),
) )
: Row( : Row(
mainAxisAlignment: mainAxisAlignment:
MainAxisAlignment.spaceEvenly, MainAxisAlignment.spaceEvenly,
@@ -165,7 +165,7 @@ class PickerAnimtionContainerFormPlaces extends StatelessWidget {
Get.back(); Get.back();
Get.snackbar( Get.snackbar(
'Deleted ', 'Deleted ',
'You are Delete ${favoritePlaces[index]['name']} from your list', '${'You are Delete'.tr} ${favoritePlaces[index]['name']} from your list',
backgroundColor: backgroundColor:
AppColor AppColor
.accentColor); .accentColor);
@@ -191,7 +191,7 @@ class PickerAnimtionContainerFormPlaces extends StatelessWidget {
if (controller.isPickerShown && if (controller.isPickerShown &&
controller.places.isEmpty) controller.places.isEmpty)
MyElevatedButton( MyElevatedButton(
title: 'Go to this Target', title: 'Go to this Target'.tr,
onPressed: () async { onPressed: () async {
await controller.getMap( await controller.getMap(
'${controller.mylocation.latitude},${controller.mylocation.longitude}', '${controller.mylocation.latitude},${controller.mylocation.longitude}',

View File

@@ -18,7 +18,7 @@ class PassengerProfilePage extends StatelessWidget {
Get.put(ProfileController()); Get.put(ProfileController());
return MyScafolld( return MyScafolld(
isleading: true, isleading: true,
title: 'My Profile', title: 'My Profile'.tr,
body: [ body: [
GetBuilder<ProfileController>( GetBuilder<ProfileController>(
builder: (controller) => controller.isloading builder: (controller) => controller.isloading
@@ -177,7 +177,7 @@ class PassengerProfilePage extends StatelessWidget {
class GenderPicker extends StatelessWidget { class GenderPicker extends StatelessWidget {
final ProfileController controller = Get.put(ProfileController()); final ProfileController controller = Get.put(ProfileController());
final List<String> genderOptions = ['Male', 'Female', 'Other']; final List<String> genderOptions = ['Male'.tr, 'Female'.tr, 'Other'.tr];
GenderPicker({super.key}); GenderPicker({super.key});

View File

@@ -6,46 +6,57 @@ import 'package:ride/views/widgets/elevated_btn.dart';
import '../../constant/box_name.dart'; import '../../constant/box_name.dart';
import '../../controller/local/local_controller.dart'; import '../../controller/local/local_controller.dart';
import '../auth/login_page.dart'; import '../auth/login_page.dart';
import '../home/home_page.dart';
import '../home/map_page.dart'; import '../home/map_page.dart';
class Language extends GetView<LocaleController> { class Language extends StatelessWidget {
const Language({Key? key}) : super(key: key); const Language({Key? key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
body: Center( body: GetBuilder<LocaleController>(
builder: (controller) => Center(
child: Container( child: Container(
padding: const EdgeInsets.all(15), padding: const EdgeInsets.all(15),
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly, mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [ children: [
Text("Choose Language".tr, Text(
style: Theme.of(context).textTheme.headlineLarge), "Choose Language".tr,
const SizedBox(height: 20), style: Theme.of(context).textTheme.headlineLarge,
MyElevatedButton( ),
title: 'Ar', const SizedBox(height: 20),
onPressed: () { MyElevatedButton(
controller.changeLang("ar"); title: 'Ar',
// main(); onPressed: () {
box.read(BoxName.email) != null controller.changeLang("ar");
? Get.offAll(() => const MapPage()) box.read(BoxName.email) != null
: Get.offAll(() => LoginPage()); ? Get.offAll(() => const MapPage())
}, : Get.offAll(() => LoginPage());
), },
MyElevatedButton( ),
title: "En", MyElevatedButton(
onPressed: () { title: "En",
controller.changeLang("en"); onPressed: () {
box.read(BoxName.email) != null controller.changeLang("en");
? Get.offAll(() => const MapPage()) box.read(BoxName.email) != null
: Get.offAll(() => LoginPage()); ? Get.offAll(() => const MapPage())
}, : Get.offAll(() => LoginPage());
), },
], ),
)), MyElevatedButton(
title: "Tr",
onPressed: () {
controller.changeLang("tr");
box.read(BoxName.email) != null
? Get.offAll(() => const MapPage())
: Get.offAll(() => LoginPage());
},
),
],
),
),
), ),
); ));
} }
} }