Initial commit

This commit is contained in:
Hamza-Ayed
2024-10-12 19:19:26 +03:00
parent 2e3ce78fe8
commit aca697578d
41 changed files with 2976 additions and 1188 deletions

View File

@@ -17,6 +17,7 @@ import '../../constant/info.dart';
import '../../controller/auth/apple_signin_controller.dart';
import '../../controller/auth/google_sign.dart';
import '../../controller/auth/login_controller.dart';
import '../home/HomePage/contact_us.dart';
import '../home/profile/passenger_profile_page.dart';
import '../widgets/mycircular.dart';
@@ -218,7 +219,7 @@ class LoginPage extends StatelessWidget {
// ),
InkWell(
onTap: () async {
await GoogleSignInHelper.signInFromLogin();
await GoogleSignInHelper().signInFromLogin();
},
child: Container(
padding: const EdgeInsets.symmetric(
@@ -303,6 +304,14 @@ class LoginPage extends StatelessWidget {
SizedBox(
height: Get.height * .1,
),
GestureDetector(
onTap: () => Get.to(() => ContactUsPage()),
child: Text(
'If you need assistance, contact us'
.tr, // Improved wording
style: AppStyle.subtitle,
),
),
// Text(
// 'if you dont have account'.tr,
// style: AppStyle.subtitle,

View File

@@ -0,0 +1,102 @@
import 'package:SEFER/constant/colors.dart';
import 'package:SEFER/constant/style.dart';
// ignore: unused_import
import 'package:SEFER/controller/functions/launch.dart';
import 'package:SEFER/views/widgets/my_scafold.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_font_icons/flutter_font_icons.dart';
import 'package:get/get.dart';
import '../../../controller/functions/tts.dart';
import '../../../controller/home/contact_us_controller.dart';
class ContactUsPage extends StatelessWidget {
ContactUsPage({super.key});
@override
Widget build(BuildContext context) {
Get.put(ContactUsController());
return GetBuilder<ContactUsController>(builder: (controller) {
return MyScafolld(
title: "Contact Us".tr,
body: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
decoration: AppStyle.boxDecoration1,
child: Column(
children: [
ClipRRect(
borderRadius: BorderRadius.circular(15),
child: Image.asset('assets/images/logo.gif')),
IconButton(
onPressed: () async {
Get.put(TextToSpeechController()).speakText(
'SEFER is the safest ride-sharing app that introduces many features for both captains and passengers. We offer the lowest commission rate of just 8%, ensuring you get the best value for your rides. Our app includes insurance for the best captains, regular maintenance of cars with top engineers, and on-road services to ensure a respectful and high-quality experience for all users.'
.tr);
},
icon: const Icon(Icons.headphones),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
'SEFER is the safest ride-sharing app that introduces many features for both captains and passengers. We offer the lowest commission rate of just 8%, ensuring you get the best value for your rides. Our app includes insurance for the best captains, regular maintenance of cars with top engineers, and on-road services to ensure a respectful and high-quality experience for all users.'
.tr,
style: AppStyle.title,
textAlign: TextAlign.center,
),
),
],
),
),
const SizedBox(
height: 30,
),
Container(
decoration: AppStyle.boxDecoration1,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
"You can contact us during working hours from 12:00 - 19:00."
.tr,
style: AppStyle.title,
textAlign: TextAlign.center,
),
),
),
InkWell(
onTap: () => controller.showContactDialog(context),
child: const Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Icon(
Icons.phone,
color: AppColor.blueColor,
),
Icon(
FontAwesome.whatsapp,
color: AppColor.greenColor,
),
Icon(
Icons.email,
color: AppColor.redColor,
),
],
),
),
const SizedBox(
height: 30,
)
],
),
)
],
isleading: true);
});
}
}

View File

@@ -51,6 +51,7 @@ class MapPagePassenger extends StatelessWidget {
CarDetailsTypeToChoose(),
const HeaderDestination(),
const BurcMoney(),
const PromoCode(),
const ApplyOrderWidget(), const MapMenuWidget(),
// hexagonClipper(),
const CancelRidePageShow(),

View File

@@ -33,6 +33,7 @@ class ApplyOrderWidget extends StatelessWidget {
InkWell(
onTap: () {
if (box.read(BoxName.carType) == 'Speed' ||
box.read(BoxName.carType) == 'Awfar Car' ||
box.read(BoxName.carType) == 'Delivery') {
Get.snackbar(
'This price is'.tr +
@@ -117,16 +118,24 @@ class ApplyOrderWidget extends StatelessWidget {
: box.read(BoxName.carType) == 'Speed'
? 'assets/images/carspeed.png'
: box.read(BoxName.carType) ==
'Delivery'
'Scooter'
? 'assets/images/moto.png'
: box.read(BoxName.carType) ==
'Mashwari'
'Mishwar Vip'
? 'assets/images/freeRide.png'
: box.read(BoxName
.carType) ==
'Rayeh Gai'
? 'assets/images/roundtrip.png'
: 'assets/images/carspeed.png', // Default image if none of the above
'Awfar Car'
? 'assets/images/balash.png'
: box.read(BoxName
.carType) ==
'Pink Bike'
? 'assets/images/pinkBike.png'
: box.read(BoxName
.carType) ==
'Rayeh Gai'
? 'assets/images/roundtrip.png'
: 'assets/images/carspeed.png', // Default image if none of the above
width: 80,
),
Column(
@@ -159,11 +168,51 @@ class ApplyOrderWidget extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
CircleAvatar(
radius: 30,
radius: 25,
backgroundImage: NetworkImage(
// '',
// ),
'${AppLink.server}/portrate_captain_image/${controller.driverId}.jpg'),
'${AppLink.server}/portrate_captain_image/${controller.driverId}.jpg',
),
child: Builder(
builder: (context) {
return Image.network(
'${AppLink.server}/portrate_captain_image/${controller.driverId}.jpg',
fit: BoxFit.cover,
loadingBuilder: (BuildContext context,
Widget child,
ImageChunkEvent? loadingProgress) {
if (loadingProgress == null) {
return child; // Image is loaded
} else {
return Center(
child: CircularProgressIndicator(
value: loadingProgress
.expectedTotalBytes !=
null
? loadingProgress
.cumulativeBytesLoaded /
(loadingProgress
.expectedTotalBytes ??
1)
: null,
),
);
}
},
errorBuilder: (BuildContext context,
Object error,
StackTrace? stackTrace) {
return const Icon(
Icons
.person, // Icon to show when image fails to load
size:
25, // Adjust the size as needed
color: AppColor
.blueColor, // Color for the error icon
);
},
);
},
),
),
Column(
children: [
@@ -196,7 +245,8 @@ class ApplyOrderWidget extends StatelessWidget {
'message From passenger',
'Hello, I\'m at the agreed-upon location'
.tr,
controller.driverToken,
controller.driverToken
.toString(),
'ding.wav',
);
Get.back();

View File

@@ -1,11 +1,14 @@
import 'package:SEFER/constant/box_name.dart';
import 'package:SEFER/constant/colors.dart';
import 'package:SEFER/constant/style.dart';
import 'package:SEFER/controller/home/blinking_promo_controller.dart.dart';
import 'package:SEFER/main.dart';
import 'package:SEFER/views/home/profile/passenger_profile_page.dart';
import 'package:SEFER/views/widgets/elevated_btn.dart';
import 'package:SEFER/views/widgets/my_dialog.dart';
import 'package:SEFER/views/widgets/my_textField.dart';
import 'package:flutter/material.dart';
import 'package:flutter_confetti/flutter_confetti.dart';
import 'package:get/get.dart';
import '../../../constant/info.dart';
@@ -158,35 +161,35 @@ class CarDetailsTypeToChoose extends StatelessWidget {
carType.carType == 'Comfort'
? mapPassengerController
.totalPassengerComfort
.toStringAsFixed(2)
.toStringAsFixed(1)
: carType.carType == 'Speed'
? mapPassengerController
.totalPassengerSpeed
.toStringAsFixed(2)
.toStringAsFixed(1)
: carType.carType == 'Awfar Car'
? mapPassengerController
.totalPassengerBalash
.toStringAsFixed(2)
.toStringAsFixed(1)
: carType.carType == 'Scooter'
? mapPassengerController
.totalPassengerScooter
.toStringAsFixed(2)
.toStringAsFixed(1)
: carType.carType == 'Lady'
? mapPassengerController
.totalPassengerLady
.toStringAsFixed(2)
.toStringAsFixed(1)
: carType.carType ==
'Pink Bike'
? mapPassengerController
.totalPassengerScooter
.toStringAsFixed(
2)
1)
: carType.carType ==
'Rayeh Gai'
? mapPassengerController
.totalPassengerRayehGai
.toStringAsFixed(
2)
1)
: '50',
style:
AppStyle.title.copyWith(fontSize: 20),
@@ -203,7 +206,18 @@ class CarDetailsTypeToChoose extends StatelessWidget {
decoration:
AppStyle.boxDecoration1,
child: Text(
'-12%',
mapPassengerController
.promoTaken
? mapPassengerController
.totalPassengerComfortDiscount
.toStringAsFixed(
1)
: (mapPassengerController
.totalPassengerComfortDiscount -
mapPassengerController
.totalPassengerComfort)
.toStringAsFixed(
1),
style: AppStyle.subtitle
.copyWith(
color: AppColor
@@ -214,8 +228,15 @@ class CarDetailsTypeToChoose extends StatelessWidget {
),
Text(
mapPassengerController
.totalPassengerComfortDiscount
.toStringAsFixed(2),
.promoTaken
? (mapPassengerController
.totalPassengerComfortDiscount +
mapPassengerController
.totalPassengerComfort)
.toStringAsFixed(1)
: mapPassengerController
.totalPassengerComfortDiscount
.toStringAsFixed(1),
style:
AppStyle.title.copyWith(
color: AppColor.redColor,
@@ -235,7 +256,18 @@ class CarDetailsTypeToChoose extends StatelessWidget {
decoration: AppStyle
.boxDecoration1,
child: Text(
'-10%',
mapPassengerController
.promoTaken
? mapPassengerController
.totalPassengerSpeedDiscount
.toStringAsFixed(
1)
: (mapPassengerController
.totalPassengerSpeedDiscount -
mapPassengerController
.totalPassengerSpeed)
.toStringAsFixed(
1),
style: AppStyle
.subtitle
.copyWith(
@@ -247,8 +279,17 @@ class CarDetailsTypeToChoose extends StatelessWidget {
),
Text(
mapPassengerController
.totalPassengerSpeedDiscount
.toStringAsFixed(2),
.promoTaken
? (mapPassengerController
.totalPassengerSpeedDiscount +
mapPassengerController
.totalPassengerSpeed)
.toStringAsFixed(
1)
: mapPassengerController
.totalPassengerSpeedDiscount
.toStringAsFixed(
1),
style: AppStyle.title
.copyWith(
color:
@@ -263,14 +304,25 @@ class CarDetailsTypeToChoose extends StatelessWidget {
'Awfar Car' &&
(mapPassengerController
.totalPassengerBalash >
15)
20)
? Row(
children: [
Container(
decoration: AppStyle
.boxDecoration1,
child: Text(
'-10%',
mapPassengerController
.promoTaken
? mapPassengerController
.totalPassengerBalashDiscount
.toStringAsFixed(
1)
: (mapPassengerController
.totalPassengerBalashDiscount -
mapPassengerController
.totalPassengerBalash)
.toStringAsFixed(
1),
style: AppStyle
.subtitle
.copyWith(
@@ -282,9 +334,17 @@ class CarDetailsTypeToChoose extends StatelessWidget {
),
Text(
mapPassengerController
.totalPassengerBalashDiscount
.toStringAsFixed(
2),
.promoTaken
? (mapPassengerController
.totalPassengerBalashDiscount +
mapPassengerController
.totalPassengerBalash)
.toStringAsFixed(
1)
: mapPassengerController
.totalPassengerBalashDiscount
.toStringAsFixed(
1),
style: AppStyle.title
.copyWith(
color: AppColor
@@ -306,7 +366,15 @@ class CarDetailsTypeToChoose extends StatelessWidget {
decoration: AppStyle
.boxDecoration1,
child: Text(
'-10%',
mapPassengerController
.promoTaken
? mapPassengerController
.totalPassengerLadyDiscount
.toStringAsFixed(
1)
: (mapPassengerController.totalPassengerLadyDiscount -
mapPassengerController.totalPassengerLady)
.toStringAsFixed(0),
style: AppStyle
.subtitle
.copyWith(
@@ -318,9 +386,17 @@ class CarDetailsTypeToChoose extends StatelessWidget {
),
Text(
mapPassengerController
.totalPassengerLadyDiscount
.toStringAsFixed(
2),
.promoTaken
? (mapPassengerController
.totalPassengerLadyDiscount +
mapPassengerController
.totalPassengerLady)
.toStringAsFixed(
0)
: mapPassengerController
.totalPassengerLadyDiscount
.toStringAsFixed(
1),
style: AppStyle
.title
.copyWith(
@@ -624,11 +700,88 @@ class CarDetailsTypeToChoose extends StatelessWidget {
title: 'Next'.tr,
onPressed: () {
Get.back();
mapPassengerController
.isBottomSheetShown = false;
mapPassengerController.update();
mapPassengerController
.changeCashConfirmPageShown();
Get.defaultDialog(
barrierDismissible: false,
title:
"Select betweeen types".tr,
content: Row(
mainAxisAlignment:
MainAxisAlignment
.spaceBetween,
children: [
Container(
decoration: AppStyle
.boxDecoration1,
child: Padding(
padding:
const EdgeInsets
.all(8.0),
child: Column(
children: [
Text('Awfar Car'
.tr),
Text(mapPassengerController
.totalPassengerRayehGaiBalash
.toStringAsFixed(
0)),
],
),
)),
Container(
decoration: AppStyle
.boxDecoration1,
child: Padding(
padding:
const EdgeInsets
.all(8.0),
child: Column(
children: [
Text('Speed'.tr),
Text(mapPassengerController
.totalPassengerRayehGai
.toStringAsFixed(
0)),
],
),
)),
Container(
decoration: AppStyle
.boxDecoration1,
child: Padding(
padding:
const EdgeInsets
.all(8.0),
child: Column(
children: [
Text(
'Comfort'.tr),
Text(mapPassengerController
.totalPassengerRayehGaiComfort
.toStringAsFixed(
0)),
],
),
))
],
),
cancel: MyElevatedButton(
kolor: AppColor.redColor,
title: 'Cancel'.tr,
onPressed: () =>
Get.back()),
confirm: MyElevatedButton(
kolor: AppColor.greenColor,
title: 'Next'.tr,
onPressed: () {
mapPassengerController
.isBottomSheetShown =
false;
mapPassengerController
.update();
mapPassengerController
.changeCashConfirmPageShown();
}));
}),
cancel: MyElevatedButton(
title: 'Cancel'.tr,
@@ -656,6 +809,87 @@ class CarDetailsTypeToChoose extends StatelessWidget {
}
}
class PromoCode extends StatelessWidget {
const PromoCode({super.key});
@override
Widget build(BuildContext context) {
Get.put(BlinkingController());
return GetBuilder<MapPassengerController>(
builder: (mapPassengerController) {
return mapPassengerController.data.isNotEmpty &&
mapPassengerController.isBottomSheetShown &&
mapPassengerController.rideConfirm == false &&
mapPassengerController.promoTaken == false
? GetBuilder<BlinkingController>(builder: (blinkingController) {
blinkingController.startBlinking();
return Positioned(
right: 5,
bottom: Get.height * 0.5,
child: Obx(() {
return AnimatedContainer(
duration: const Duration(milliseconds: 500),
width: 70, // Circle size
height: 70,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: blinkingController.isLightOn.value
? Colors.yellow
: Colors.grey, // Light on/off effect
border: Border.all(
color: blinkingController
.borderColor.value, // Animated border color
width: 3,
),
),
child: IconButton(
onPressed: () {
Get.defaultDialog(
title: 'Insert Your Promo Code'.tr,
content: Form(
key: mapPassengerController.promoFormKey,
child: MyTextForm(
controller: mapPassengerController.promo,
label: 'Insert Your Promo Code'.tr,
hint: 'Enter promo code here'.tr,
type: TextInputType.name,
),
),
confirm: MyElevatedButton(
title: 'Ok'.tr,
onPressed: () {
if (mapPassengerController
.promoFormKey.currentState!
.validate()) {
mapPassengerController
.applyPromoCodeToPassenger(context);
Get.back();
}
}));
},
icon: const Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(Icons.local_offer, size: 24), // Promo icon
SizedBox(height: 4),
Text(
"Promo",
style: TextStyle(
fontSize: 12, fontWeight: FontWeight.bold),
),
],
),
),
);
}),
);
})
: const SizedBox();
},
);
}
}
class BurcMoney extends StatelessWidget {
const BurcMoney({super.key});

View File

@@ -168,7 +168,8 @@ class CashConfirmPageShown extends StatelessWidget {
paymentController.update();
controller.changeCashConfirmPageShown();
controller.isSearchingWindow = true;
controller.confirmRideForFirstDriver();
controller
.confirmRideForAllDriverAvailable();
controller.update();
},
),
@@ -179,7 +180,7 @@ class CashConfirmPageShown extends StatelessWidget {
onPressed: () {
controller.changeCashConfirmPageShown();
controller.isSearchingWindow = true;
controller.confirmRideForFirstDriver();
controller.confirmRideForAllDriverAvailable();
controller.update();
},
), // Add a fallback widget if none of the conditions are met

View File

@@ -318,7 +318,7 @@ class GoogleMapPassengerWidget extends StatelessWidget {
// icon: controller.endIcon,
// ),
// },
polygons: controller.polygons,
polylines: {
Polyline(
zIndex: 2,

View File

@@ -9,6 +9,7 @@ import '../../../controller/firebase/firbase_messge.dart';
import '../../../controller/functions/audio_record1.dart';
import '../../../controller/functions/tts.dart';
import '../../../controller/home/map_passenger_controller.dart';
import '../../../print.dart';
GetBuilder<MapPassengerController> leftMainMenuIcons() {
final textToSpeechController = Get.put(TextToSpeechController());
@@ -121,50 +122,58 @@ GetBuilder<MapPassengerController> leftMainMenuIcons() {
// borderRadius: BorderRadius.circular(15)),
// child: IconButton(
// onPressed: () async {
// // Get.to(SmsSignupEgypt());
// List<String> d = [
// "30.003028,31.2419628",
// "30.0955661,31.2665336",
// "160.00",
// "25.92",
// "1488",
// "16.93",
// "114243034311436865474",
// "113172279072358305645",
// "hamza ayed",
// "rlMbi4Hc8L1STMPE99iPKqK4Gddwv8r9qZOCadsz9qTEJZ6KLEE9ruTJI6N8dKfK4CXez5pme5WIs14-1QGo29s07fQOniZgIlJV5XFL3yqzPRSUmn3",
// "+201023248456",
// "1 min",
// "1 m",
// "false",
// "QwUMoyUtZ0J3oR6yXKUavrB_gBl9npUZe-qZtax-Raq4QBbdKv0AmtLKm0BfBd6N_592HBv4CVa41ii4122W3hr-BCUKKzJhzZcK8m0YjbWbtpvgJRD8uD_nuMk9",
// "0",
// "238",
// "false",
// "114243034311436865474",
// "1488",
// "startEnd",
// "30.049307749732176,31.274291574954987",
// "",
// "",
// "",
// "",
// "17.73",
// "0",
// "hamzaayedflutter@gmail.com",
// "الفسطاط، حي مصر القديمة، مصر",
// " الزاوية الحمراء، محافظة القاهرة، مصر",
// "Speed",
// "8",
// "5.00"
// ];
// FirebaseMessagesController().sendNotificationToDriverMAP(
// 'Order'.tr,
// 'from: ',
// // jsonDecode(value)['message'].toString(),
// 'd3JaCCFAQeu8QTxRnlC1sB:APA91bFuRjbVK32obIFYXFTI4iwsZEPrrgwvPouob2bXivID-W4aXz51J_OIJ2nHpNU2ocOvGLD1Ip65rLViAFx5qHVE-c8FabBwBi5fSQ-lDTQfe36xxKsc9DU-sTyj_FoYrrMnLNVi',
// d,
// 'order.wav');
// Get.to(SmsSignupEgypt());
// List<String> d = [
// "30.003028,31.2419628",
// "30.0955661,31.2665336",
// "160.00",
// "25.92",
// "1488",
// "16.93",
// "114243034311436865474",
// "113172279072358305645",
// "hamza ayed",
// "rlMbi4Hc8L1STMPE99iPKqK4Gddwv8r9qZOCadsz9qTEJZ6KLEE9ruTJI6N8dKfK4CXez5pme5WIs14-1QGo29s07fQOniZgIlJV5XFL3yqzPRSUmn3",
// "+201023248456",
// "1 min",
// "1 m",
// "false",
// "QwUMoyUtZ0J3oR6yXKUavrB_gBl9npUZe-qZtax-Raq4QBbdKv0AmtLKm0BfBd6N_592HBv4CVa41ii4122W3hr-BCUKKzJhzZcK8m0YjbWbtpvgJRD8uD_nuMk9",
// "0",
// "238",
// "false",
// "114243034311436865474",
// "1488",
// "startEnd",
// "30.049307749732176,31.274291574954987",
// "",
// "",
// "",
// "",
// "17.73",
// "0",
// "hamzaayedflutter@gmail.com",
// "الفسطاط، حي مصر القديمة، مصر",
// " الزاوية الحمراء، محافظة القاهرة، مصر",
// "Speed",
// "8",
// "5.00"
// ];
// FirebaseMessagesController()
// .sendNotificationToAnyWithoutData(
// 'Cancel'.tr,
// "How much longer will you be?".tr,
// 'fKBBB4_1R0q18-byySHUeG:APA91bHk2RmjjMt6eKr7KQnqh4CK02yW3H5E8g_beVcQFgiCG50j9KCtSU1O8PtvS_gA5xuJLhaorDV9AeslcyLFJFf302tICKMiKgsDP5pWkF5WXNw0-4NsoD-BnJxf0-Do9Vs1Zbpq',
// // d,
// 'ding.wav',
// );
// Get.to(SmsSignupEgypt());
// Log.print(
// 'getUpdatedRideForDriverApply: ${Get.find<MapPassengerController>().driverToken}');
// Get.find<MapPassengerController>()
// .firstTimeRunToGetCoupon('SEFER25', '1 WEEEK', '25%');
// },
// icon: const Icon(
// Icons.chat,

View File

@@ -1,3 +1,4 @@
import 'package:SEFER/views/home/HomePage/contact_us.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_font_icons/flutter_font_icons.dart';
@@ -110,10 +111,10 @@ class MapMenuWidget extends StatelessWidget {
),
IconMainPageMap(
onTap: () {
Get.to(() => const TaarifPage());
Get.to(() => ContactUsPage());
},
title: 'Tariff'.tr,
icon: Icons.money,
title: "Contact Us".tr,
icon: Icons.contact_page,
),
],
),

View File

@@ -7,6 +7,7 @@ import 'package:flutter/material.dart';
import 'package:get/get.dart';
import '../../../constant/api_key.dart';
import '../../../constant/links.dart';
class CupertinoDriverListWidget extends StatelessWidget {
MapPassengerController mapPassengerController =
@@ -30,9 +31,39 @@ class CupertinoDriverListWidget extends StatelessWidget {
leading: CircleAvatar(
radius: 25,
backgroundImage: NetworkImage(
'${AK.serverPHP}/portrate_captain_image/${driver['id']}.jpg',
'${AppLink.seferCairoServer}/portrate_captain_image/${driver['id']}.jpg',
),
child: Builder(
builder: (context) {
return Image.network(
'${AppLink.seferCairoServer}/portrate_captain_image/${driver['id']}.jpg',
fit: BoxFit.cover,
loadingBuilder: (BuildContext context, Widget child,
ImageChunkEvent? loadingProgress) {
if (loadingProgress == null) {
return child; // Image is loaded
} else {
return Center(
child: CircularProgressIndicator(
value: loadingProgress.expectedTotalBytes != null
? loadingProgress.cumulativeBytesLoaded /
(loadingProgress.expectedTotalBytes ?? 1)
: null,
),
);
}
},
errorBuilder: (BuildContext context, Object error,
StackTrace? stackTrace) {
return const Icon(
Icons.person, // Icon to show when image fails to load
size: 25, // Adjust the size as needed
color: AppColor.blueColor, // Color for the error icon
);
},
);
},
),
backgroundColor: CupertinoColors.systemGrey5,
),
title: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
@@ -65,12 +96,12 @@ class CupertinoDriverListWidget extends StatelessWidget {
Text('${'Plate'.tr}: ${driver['car_plate']}'),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text('${'Education'.tr}: ${driver['education']}'),
],
),
// Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: [
// Text('${'Education'.tr}: ${driver['education']}'),
// ],
// ),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [

View File

@@ -1,3 +1,5 @@
import 'package:SEFER/views/widgets/my_dialog.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
@@ -10,6 +12,8 @@ import '../../../controller/functions/toast.dart';
import '../../../controller/home/payment/credit_card_controller.dart';
import '../../../controller/payment/payment_controller.dart';
import '../../../main.dart';
import '../../../models/model/painter_copoun.dart';
import '../../../print.dart';
import '../../widgets/elevated_btn.dart';
import '../../widgets/my_scafold.dart';
import '../../widgets/my_textField.dart';
@@ -29,25 +33,49 @@ class PassengerWallet extends StatelessWidget {
GetBuilder<PaymentController>(
builder: (controller) => Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
const CardSeferWallet(),
const SizedBox(
height: 20,
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 30),
child: Row(
children: [
MyElevatedButton(
kolor: AppColor.blueColor,
title: 'Payment History'.tr,
onPressed: () {
Get.to(() => const PaymentHistoryPassengerPage(),
transition: Transition.size);
},
),
],
padding:
const EdgeInsets.symmetric(horizontal: 80, vertical: 10),
child: MyElevatedButton(
kolor: AppColor.blueColor,
title: 'Payment History'.tr,
onPressed: () {
Get.to(() => const PaymentHistoryPassengerPage(),
transition: Transition.size);
},
),
),
Padding(
padding:
const EdgeInsets.symmetric(horizontal: 80, vertical: 10),
child: MyElevatedButton(
kolor: AppColor.yellowColor,
title: 'Bounus gift'.tr,
onPressed: () {
Get.dialog(
AlertDialog(
contentPadding: EdgeInsets
.zero, // Removes the padding around the content
content: SizedBox(
width: 300, // Match the width of PromoBanner
// height: 250, // Match the height of PromoBanner
child: PromoBanner(
promoCode: box.read(BoxName.promo),
discountPercentage: box.read(BoxName.discount),
validity: box.read(BoxName.validity),
),
),
),
);
Log.print(
'box.read(BoxName.isGiftToken).toString(): ${box.read(BoxName.isGiftToken).toString()}');
},
),
)
],
@@ -65,6 +93,7 @@ class PassengerWallet extends StatelessWidget {
left: Get.width * .2,
right: Get.width * .2,
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
MyElevatedButton(
title: 'Show Promos to Charge'.tr,
@@ -79,36 +108,58 @@ class PassengerWallet extends StatelessWidget {
kolor: AppColor.deepPurpleAccent,
title: "Add wallet phone you use".tr,
onPressed: () {
Get.defaultDialog(
barrierDismissible: false,
title: 'Insert Wallet phone number'.tr,
content: Form(
key: controller.formKey,
child: MyTextForm(
Get.dialog(
CupertinoAlertDialog(
title: Text('Insert Wallet phone number'.tr),
content: Column(
children: [
const SizedBox(height: 10),
Form(
key: controller.formKey,
child: CupertinoTextField(
controller:
controller.walletphoneController,
label: 'Insert Wallet phone number'.tr,
hint: 'Insert Wallet phone number'.tr,
type: TextInputType.phone)),
confirm: MyElevatedButton(
kolor: AppColor.greenColor,
title: 'OK'.tr,
onPressed: () async {
Get.back();
box.write(BoxName.phoneWallet,
controller.walletphoneController.text);
Toast.show(
context,
'Phone Wallet Saved Successfully'.tr,
AppColor.greenColor);
},
placeholder:
'Insert Wallet phone number'.tr,
keyboardType: TextInputType.phone,
padding: const EdgeInsets.symmetric(
vertical: 12, horizontal: 10),
),
),
],
),
cancel: MyElevatedButton(
title: 'Cancel'.tr,
kolor: AppColor.redColor,
actions: <Widget>[
CupertinoDialogAction(
child: Text('Cancel'.tr,
style: const TextStyle(
color: CupertinoColors
.destructiveRed)),
onPressed: () {
Get.back();
}));
Get.back(); // Dismiss the dialog
},
),
CupertinoDialogAction(
child: Text('OK'.tr,
style: const TextStyle(
color:
CupertinoColors.activeGreen)),
onPressed: () async {
Get.back(); // Close the dialog
box.write(
BoxName.phoneWallet,
controller
.walletphoneController.text);
Toast.show(
context,
'Phone Wallet Saved Successfully'.tr,
AppColor.greenColor);
},
),
],
),
barrierDismissible:
false, // Set to prevent dismissing by tapping outside
);
})
],
),
@@ -120,70 +171,71 @@ class PassengerWallet extends StatelessWidget {
}
class CardSeferWallet extends StatelessWidget {
const CardSeferWallet({
super.key,
});
const CardSeferWallet({super.key});
@override
Widget build(BuildContext context) {
return GetBuilder<PaymentController>(builder: (paymentController) {
return Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
width: Get.width * .85,
height: Get.height * .3,
decoration: BoxDecoration(
color: AppColor.twitterColor.withOpacity(.8),
borderRadius: const BorderRadius.all(Radius.circular(12)),
gradient: const LinearGradient(colors: [
AppColor.redColor,
AppColor.yellowColor,
AppColor.yellowColor,
]),
),
return GetBuilder<PaymentController>(
builder: (paymentController) {
return Container(
width: Get.width * 0.9,
height: Get.height * 0.25,
margin: const EdgeInsets.all(16.0),
decoration: BoxDecoration(
color: CupertinoColors.extraLightBackgroundGray,
borderRadius: BorderRadius.circular(12),
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.1),
offset: const Offset(0, 10),
blurRadius: 20,
),
],
),
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Row(
children: [
Text(
'${AppInformation.appName} Wallet',
style: AppStyle.headTitle
.copyWith(color: AppColor.writeColor),
)
],
// Wallet Title
Text(
'${AppInformation.appName} Wallet',
style: AppStyle.headTitle.copyWith(
color: CupertinoColors.label,
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
'${box.read(BoxName.passengerWalletTotal)} \$' ??
'0.0 \$',
style: AppStyle.headTitle2,
)
],
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Text(
box.read(BoxName.name),
style: AppStyle.title,
)
],
// Wallet Balance
Center(
child: Text(
'${box.read(BoxName.passengerWalletTotal) ?? '0.0'} ${'LE'.tr}',
style: AppStyle.headTitle2.copyWith(
color: CupertinoColors.label,
fontSize: 36,
fontWeight: FontWeight.w600,
),
),
)
),
// User Name (Bottom Right)
Align(
alignment: Alignment.bottomRight,
child: Text(
box.read(BoxName.name),
style: AppStyle.title.copyWith(
color: CupertinoColors.secondaryLabel,
fontSize: 16,
),
),
),
],
),
),
],
);
});
);
},
);
}
}

View File

@@ -1,6 +1,6 @@
import 'package:SEFER/constant/box_name.dart';
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:get/get.dart';
import 'package:SEFER/constant/box_name.dart';
import 'package:SEFER/constant/colors.dart';
import 'package:SEFER/constant/style.dart';
import 'package:SEFER/controller/functions/toast.dart';
@@ -8,7 +8,6 @@ import 'package:SEFER/controller/payment/payment_controller.dart';
import 'package:SEFER/views/widgets/elevated_btn.dart';
import '../../../main.dart';
import '../../widgets/my_textField.dart';
class PassengerWalletDialog extends StatelessWidget {
const PassengerWalletDialog({
@@ -19,294 +18,198 @@ class PassengerWalletDialog extends StatelessWidget {
Widget build(BuildContext context) {
return GetBuilder<PaymentController>(
builder: (controller) => Positioned(
top: Get.height * .1,
right: Get.width * .15,
left: Get.width * .15,
bottom: Get.height * .1,
child: controller.isPromoSheetDialogue
? Container(
decoration: const BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(12)),
color: AppColor.secondaryColor,
boxShadow: [
BoxShadow(
color: AppColor.accentColor,
offset: Offset(-1, -1),
blurRadius: 0,
spreadRadius: 0,
blurStyle: BlurStyle.normal),
BoxShadow(
color: AppColor.accentColor,
offset: Offset(3, 3),
blurRadius: 1,
spreadRadius: 0,
blurStyle: BlurStyle.normal)
]),
child: Padding(
padding: const EdgeInsets.all(6),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
GestureDetector(
onTap: () {
controller.updateSelectedAmount(10);
},
child: Row(
children: [
Radio(
value: box.read(BoxName.countryCode) == 'Egypt'
? 100
: 10,
groupValue: controller.selectedAmount,
onChanged: (value) {
controller.updateSelectedAmount(value as int);
},
),
Text(
box.read(BoxName.countryCode) == 'Egypt'
? '100 ${'LE'.tr}'.tr
: '10 ${'JOD'.tr}'.tr,
style: AppStyle.title,
),
],
top: Get.height * .1,
right: Get.width * .15,
left: Get.width * .15,
bottom: Get.height * .1,
child: controller.isPromoSheetDialogue
? CupertinoActionSheet(
title: Text('Select Payment Amount'.tr),
actions: [
CupertinoActionSheetAction(
onPressed: () {
controller.updateSelectedAmount(
box.read(BoxName.countryCode) == 'Egypt' ? 100 : 10,
);
showPaymentOptions(context, controller);
},
child: Text(
box.read(BoxName.countryCode) == 'Egypt'
? '100 ${'LE'.tr}'
: '10 ${'JOD'.tr}',
),
),
CupertinoActionSheetAction(
onPressed: () {
controller.updateSelectedAmount(
box.read(BoxName.countryCode) == 'Egypt' ? 200 : 20,
);
showPaymentOptions(context, controller);
},
child: Text(
box.read(BoxName.countryCode) == 'Egypt'
? '200 ${'LE'.tr} = 205 ${'LE'.tr}'
: '20 ${'JOD'.tr}',
),
),
CupertinoActionSheetAction(
onPressed: () {
controller.updateSelectedAmount(
box.read(BoxName.countryCode) == 'Egypt' ? 400 : 40,
);
showPaymentOptions(context, controller);
},
child: Text(
box.read(BoxName.countryCode) == 'Egypt'
? '400 ${'LE'.tr} = 415 ${'LE'.tr}'
: '40 ${'JOD'.tr}',
),
),
CupertinoActionSheetAction(
onPressed: () {
controller.updateSelectedAmount(
box.read(BoxName.countryCode) == 'Egypt' ? 1000 : 50,
);
showPaymentOptions(context, controller);
},
child: Text(
box.read(BoxName.countryCode) == 'Egypt'
? '1000 ${'LE'.tr} = 1100 ${'LE'.tr}'
: '50 ${'JOD'.tr}',
),
),
],
cancelButton: CupertinoActionSheetAction(
onPressed: () {
controller.changePromoSheetDialogue();
},
child: Text('Cancel'.tr),
),
)
: const SizedBox(),
),
);
}
}
void showPaymentOptions(BuildContext context, PaymentController controller) {
showCupertinoModalPopup(
context: context,
builder: (context) => CupertinoActionSheet(
title: Text('Payment Options'.tr),
actions: [
box.read(BoxName.countryCode) == 'Egypt'
? CupertinoActionSheetAction(
child: Text('💳 Pay with Credit Card'.tr),
onPressed: () {
if (controller.selectedAmount != 0) {
controller.payWithPayMob(
context,
controller.selectedAmount.toString(),
box.read(BoxName.countryCode) == 'Egypt' ? 'EGP' : 'JOD',
() async {
await controller.addPassengerWallet();
controller.changePromoSheetDialogue();
await controller.getPassengerWallet();
},
);
} else {
Toast.show(context, '⚠️ You need to choose an amount!'.tr,
AppColor.redColor);
}
},
)
: const SizedBox(),
box.read(BoxName.countryCode) != 'Egypt'
? CupertinoActionSheetAction(
child: Text('Pay with PayPal'.tr),
onPressed: () {
if (controller.selectedAmount != 0) {
controller.makePaymentPayPal(context);
} else {
Toast.show(context, 'You will choose one of above!'.tr,
AppColor.redColor);
}
},
)
: const SizedBox(),
box.read(BoxName.phoneWallet) != null
? CupertinoActionSheetAction(
child: Text('💰 Pay with Wallet'.tr),
onPressed: () {
if (controller.selectedAmount != 0) {
controller.payWithPayMobWallet(
context,
controller.selectedAmount.toString(),
box.read(BoxName.countryCode) == 'Egypt' ? 'EGP' : 'JOD',
() async {
await controller.addPassengerWallet();
controller.changePromoSheetDialogue();
await controller.getPassengerWallet();
},
);
} else {
Toast.show(context, '⚠️ You need to choose an amount!'.tr,
AppColor.redColor);
}
},
)
: CupertinoActionSheetAction(
child: Text('Add wallet phone you use'.tr),
onPressed: () {
Get.dialog(
CupertinoAlertDialog(
title: Text('Insert Wallet phone number'.tr),
content: Column(
children: [
const SizedBox(height: 10),
CupertinoTextField(
controller: controller.walletphoneController,
placeholder: 'Insert Wallet phone number'.tr,
keyboardType: TextInputType.phone,
padding: const EdgeInsets.symmetric(
vertical: 12,
horizontal: 10,
),
),
),
GestureDetector(
onTap: () {
controller.updateSelectedAmount(20);
},
child: Row(
children: [
Radio(
value:
box.read(BoxName.countryCode) == 'Egypt'
? 210
: 20,
groupValue: controller.selectedAmount,
onChanged: (value) {
controller
.updateSelectedAmount(value as int);
},
),
Text(
box.read(BoxName.countryCode) == 'Egypt'
? '${'200 ${'LE'.tr} '.tr} = 205 ${'LE'.tr}'
: '20 ${'JOD'.tr}'.tr,
style: AppStyle.title,
),
],
)),
GestureDetector(
onTap: () {
controller.updateSelectedAmount(40);
},
child: Row(
children: [
Radio(
value:
box.read(BoxName.countryCode) == 'Egypt'
? 415
: 40,
groupValue: controller.selectedAmount,
onChanged: (value) {
controller
.updateSelectedAmount(value as int);
},
),
Text(
box.read(BoxName.countryCode) == 'Egypt'
? '${'400 ${'LE'.tr} '.tr} = 415 ${'LE'.tr}'
: '40 ${'JOD'.tr}'.tr,
style: AppStyle.title,
),
],
)),
GestureDetector(
onTap: () {
controller.updateSelectedAmount(100);
},
child: Row(
children: [
Radio(
value:
box.read(BoxName.countryCode) == 'Egypt'
? 1100
: 50,
groupValue: controller.selectedAmount,
onChanged: (value) {
controller
.updateSelectedAmount(value as int);
},
),
Text(
box.read(BoxName.countryCode) == 'Egypt'
? '${'1000 ${'LE'.tr} '.tr} = 1100 ${'LE'.tr}'
: '50 ${'JOD'.tr}'.tr,
style: AppStyle.title,
),
],
)),
const Spacer(),
box.read(BoxName.countryCode) == 'Egypt'
? const SizedBox()
: MyElevatedButton(
kolor: AppColor.blueColor,
title: '${'Pay with Your'.tr} PayPal',
onPressed: () {
if (controller.selectedAmount != 0) {
controller.makePaymentPayPal(context);
} else {
Toast.show(
context,
'You will choose one of above !'.tr,
AppColor.redColor);
}
},
),
box.read(BoxName.countryCode) == 'Egypt'
? box.read(BoxName.phoneWallet) != null
? Column(
children: [
MyElevatedButton(
title: '💳 Pay with Credit Card'.tr,
onPressed: () {
if (controller.selectedAmount != 0) {
controller.payWithPayMob(
context,
controller.selectedAmount
.toString(), // Convert int to double
box.read(BoxName.countryCode) ==
'Egypt'
? 'EGP'
: 'JOD',
() async {
await controller
.addPassengerWallet();
controller
.changePromoSheetDialogue();
await controller
.getPassengerWallet();
},
);
} else {
Toast.show(
context,
'⚠️ You need to choose an amount!'
.tr,
AppColor.redColor,
);
}
},
),
// Add some spacing between buttons
MyElevatedButton(
kolor: AppColor.yellowColor,
title: '💰 Pay with Wallet'.tr,
onPressed: () {
if (controller.selectedAmount != 0) {
controller.payWithPayMobWallet(
context,
controller.selectedAmount
.toString(), // Convert int to double
box.read(BoxName.countryCode) ==
'Egypt'
? 'EGP'
: 'JOD',
() async {
await controller
.addPassengerWallet();
controller
.changePromoSheetDialogue();
await controller
.getPassengerWallet();
},
);
} else {
Toast.show(
context,
'⚠️ You need to choose an amount!'
.tr,
AppColor.redColor,
);
}
},
),
],
)
: MyElevatedButton(
title: 'Pay with Credit Card'.tr,
onPressed: () {
if (controller.selectedAmount != 0) {
controller.makePaymentStripe(
controller.selectedAmount!
.toDouble(), // Convert int to double
box.read(BoxName.countryCode) !=
'Egypt'
? 'usd'
: 'jod', () {
controller.addPassengerWallet();
controller.changePromoSheetDialogue();
controller.getPassengerWallet();
});
} else {
Toast.show(
context,
'You will choose one of above !'.tr,
AppColor.redColor);
}
})
: MyElevatedButton(
kolor: AppColor.deepPurpleAccent,
title: "Add wallet phone you use".tr,
onPressed: () {
Get.defaultDialog(
barrierDismissible: false,
title: 'Insert Wallet phone number'.tr,
content: Form(
key: controller.formKey,
child: MyTextForm(
controller: controller
.walletphoneController,
label:
'Insert Wallet phone number'
.tr,
hint: 'Insert Wallet phone number'
.tr,
type: TextInputType.phone)),
confirm: MyElevatedButton(
kolor: AppColor.greenColor,
title: 'OK'.tr,
onPressed: () async {
Get.back();
box.write(
BoxName.phoneWallet,
controller
.walletphoneController.text);
Toast.show(
context,
'Phone Wallet Saved Successfully'
.tr,
AppColor.greenColor);
},
),
cancel: MyElevatedButton(
title: 'Cancel'.tr,
kolor: AppColor.redColor,
onPressed: () {
Get.back();
}));
}),
MyElevatedButton(
title: 'Cancel'.tr,
kolor: AppColor.redColor,
],
),
actions: [
CupertinoDialogAction(
child: Text('Cancel'.tr,
style: const TextStyle(
color: CupertinoColors.destructiveRed)),
onPressed: () {
controller.changePromoSheetDialogue();
Get.back();
},
),
CupertinoDialogAction(
child: Text('OK'.tr,
style: const TextStyle(
color: CupertinoColors.activeGreen)),
onPressed: () async {
Get.back();
box.write(BoxName.phoneWallet,
controller.walletphoneController.text);
Toast.show(
context,
'Phone Wallet Saved Successfully'.tr,
AppColor.greenColor);
},
),
],
),
))
: const SizedBox()),
);
}
barrierDismissible: false,
);
},
),
],
cancelButton: CupertinoActionSheetAction(
child: Text('Cancel'.tr),
onPressed: () {
controller.changePromoSheetDialogue();
},
),
),
);
}

View File

@@ -1,3 +1,4 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:SEFER/constant/colors.dart';
@@ -17,7 +18,7 @@ class PaymentHistoryPassengerPage extends StatelessWidget {
body: [
GetBuilder<PassengerWalletHistoryController>(
builder: (controller) => controller.isLoading
? const MyCircularProgressIndicator()
? const MyCircularProgressIndicator() // iOS-style loading indicator
: controller.archive.isEmpty
? Center(
child: Text(
@@ -25,37 +26,33 @@ class PaymentHistoryPassengerPage extends StatelessWidget {
style: AppStyle.title,
),
)
: ListView.builder(
itemCount: controller.archive.length,
itemBuilder: (BuildContext context, int index) {
var list = controller.archive[index];
return Padding(
padding: const EdgeInsets.all(4),
child: Container(
decoration: BoxDecoration(
color: double.parse(list['balance']) < 0
? AppColor.redColor.withOpacity(.4)
: AppColor.greenColor.withOpacity(.4)),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Text(
list['balance'],
style: AppStyle.title,
),
Text(
list['created_at'],
style: AppStyle.title,
),
],
: CupertinoListSection.insetGrouped(
children: List.generate(
controller.archive.length,
(index) {
var list = controller.archive[index];
return CupertinoListTile(
backgroundColor: double.parse(list['balance']) < 0
? AppColor.redColor.withOpacity(.2)
: AppColor.greenColor.withOpacity(.2),
title: Text(
list['balance'],
style: AppStyle.title.copyWith(
color: CupertinoColors.black,
),
),
),
);
},
additionalInfo: Text(
list['created_at'],
style: AppStyle.title.copyWith(
fontSize: 12,
color: CupertinoColors.systemGrey,
),
),
padding: const EdgeInsets.symmetric(
vertical: 8, horizontal: 16),
);
},
),
),
)
],

View File

@@ -1,5 +1,7 @@
import 'package:animated_text_kit/animated_text_kit.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:get/get.dart';
import 'package:SEFER/controller/home/profile/promos_controller.dart';
import 'package:SEFER/views/widgets/my_scafold.dart';
@@ -106,13 +108,26 @@ class PromosPassengerPage extends StatelessWidget {
} else {
// Promo items
final rides = orderHistoryController.promoList[index - 1];
return Padding(
padding: const EdgeInsets.all(8.0),
padding: const EdgeInsets.all(12.0),
child: Container(
decoration: AppStyle.boxDecoration,
decoration: BoxDecoration(
color: CupertinoColors.systemGrey6,
borderRadius: BorderRadius.circular(16),
boxShadow: [
BoxShadow(
color:
CupertinoColors.systemGrey.withOpacity(0.5),
blurRadius: 8,
offset: Offset(0, 4),
),
],
),
child: Padding(
padding: const EdgeInsets.all(8.0),
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment:
@@ -122,50 +137,88 @@ class PromosPassengerPage extends StatelessWidget {
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
AnimatedTextKit(
animatedTexts: [
ScaleAnimatedText(
rides['promo_code'],
textStyle: AppStyle.title),
WavyAnimatedText(
rides['promo_code'],
textStyle: AppStyle.title),
FlickerAnimatedText(
rides['promo_code'],
textStyle: AppStyle.title),
WavyAnimatedText(
rides['promo_code'],
textStyle: AppStyle.title),
],
isRepeatingAnimation: true,
GestureDetector(
onTap: () {},
child: AnimatedTextKit(
animatedTexts: [
ScaleAnimatedText(
rides['promo_code'],
textStyle:
AppStyle.title.copyWith(
fontSize:
32, // Increased font size for emphasis
color: CupertinoColors
.activeBlue,
fontWeight: FontWeight.bold,
),
),
WavyAnimatedText(
rides['promo_code'],
textStyle:
AppStyle.title.copyWith(
fontSize:
32, // Increased font size for emphasis
color: CupertinoColors
.activeBlue,
fontWeight: FontWeight.bold,
),
),
],
isRepeatingAnimation: true,
),
),
const SizedBox(height: 8),
// Description Text
Text(
rides['description'],
style: AppStyle.title,
style: AppStyle.title.copyWith(
fontSize: 22,
color: CupertinoColors.systemGrey,
),
),
],
),
Column(
children: [
// Only displaying end date
Text(
rides['validity_start_date'],
style: AppStyle.title,
),
Text(
rides['validity_end_date'],
style: AppStyle.title,
'${'Valid Until:'.tr} ${rides['validity_end_date']}',
style: AppStyle.subtitle.copyWith(
fontWeight: FontWeight.bold,
fontSize: 20,
color: CupertinoColors.systemGrey,
),
),
],
),
],
),
Text(
'Copy this Promo to use it in your Ride!'.tr,
textAlign: TextAlign.center,
style: AppStyle.headTitle2
.copyWith(color: AppColor.accentColor),
)
// const SizedBox(height: 16),
// Copy Promo Text
Center(
child: GestureDetector(
onTap: () {
Clipboard.setData(ClipboardData(
text: rides['promo_code']));
Get.snackbar(
'Promo Copied!'.tr,
'You have copied the promo code.'.tr,
snackPosition: SnackPosition.BOTTOM,
backgroundColor:
CupertinoColors.systemGrey,
colorText: CupertinoColors.white,
);
},
child: Text(
'Copy Code'.tr,
textAlign: TextAlign.center,
style: AppStyle.headTitle2.copyWith(
color: CupertinoColors.systemBlue,
fontWeight: FontWeight.bold,
),
),
),
),
],
),
),

View File

@@ -1,10 +1,10 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:SEFER/constant/colors.dart';
import 'package:SEFER/constant/style.dart';
import '../../controller/notification/passenger_notification_controller.dart';
import '../widgets/elevated_btn.dart';
import '../widgets/my_scafold.dart';
import '../widgets/mycircular.dart';
@@ -19,64 +19,82 @@ class NotificationPage extends StatelessWidget {
title: 'Notifications',
body: [
GetBuilder<PassengerNotificationController>(
builder: (notificationCaptainController) =>
notificationCaptainController.isloading
? const MyCircularProgressIndicator()
: SafeArea(
child: ListView.builder(
itemCount: notificationCaptainController
.notificationData['message'].length,
itemBuilder: (BuildContext context, int index) {
if (notificationCaptainController
.notificationData['message'] ==
"No notification data found") {
Get.defaultDialog();
}
var res = notificationCaptainController
.notificationData['message'][index];
return Card(
elevation: 4,
color: res['isShown'] == 'true'
? AppColor.secondaryColor.withOpacity(.5)
: AppColor.secondaryColor.withOpacity(.9),
child: ListTile(
onTap: () {
Get.defaultDialog(
title: res['title'],
titleStyle: AppStyle.title,
content: SizedBox(
width: Get.width * .8,
// height: Get.height * .4,
child: Text(
res['body'],
style: AppStyle.title,
),
),
confirm: MyElevatedButton(
title: 'Ok',
onPressed: () {
notificationCaptainController
.updateNotification(
res['id'].toString());
}));
},
leading: res['isShown'] == 'true'
? const Icon(
Icons.notifications_off_outlined)
: const Icon(Icons.notifications_active),
title: Text(
res['title'],
style: AppStyle.title,
),
subtitle: Text(
res['body'],
style: AppStyle.subtitle,
),
),
builder: (notificationCaptainController) => notificationCaptainController
.isloading
? const MyCircularProgressIndicator() // iOS-style loading indicator
: SafeArea(
child: ListView.builder(
itemCount: notificationCaptainController
.notificationData['message'].length,
itemBuilder: (BuildContext context, int index) {
if (notificationCaptainController
.notificationData['message'] ==
"No notification data found") {
Get.defaultDialog(
title: 'No Notifications'.tr,
content: Text(
'No notification data found.'.tr,
),
);
}
var res = notificationCaptainController
.notificationData['message'][index];
return Padding(
padding: const EdgeInsets.symmetric(
horizontal: 8, vertical: 4),
child: CupertinoListTile(
backgroundColor: res['isShown'] == 'true'
? AppColor.secondaryColor.withOpacity(.2)
: AppColor.secondaryColor.withOpacity(.8),
leading: res['isShown'] == 'true'
? const Icon(CupertinoIcons.bell_slash_fill)
: const Icon(CupertinoIcons.bell_fill),
title: Text(
res['title'],
style: AppStyle.title.copyWith(
color: CupertinoColors.black,
),
),
subtitle: Text(
res['body'],
style: AppStyle.subtitle.copyWith(
color: CupertinoColors.systemGrey,
),
),
onTap: () {
showCupertinoDialog(
context: context,
builder: (BuildContext context) {
return CupertinoAlertDialog(
title: Text(
res['title'],
style: AppStyle.title,
),
content: Text(
res['body'],
style: AppStyle.subtitle,
),
actions: [
CupertinoDialogAction(
child: const Text('Ok'),
onPressed: () {
notificationCaptainController
.updateNotification(
res['id'].toString());
Get.back();
},
),
],
);
},
);
},
),
))
);
},
),
),
)
],
);
}

View File

@@ -1,5 +1,6 @@
import 'dart:ui';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
@@ -11,34 +12,98 @@ import 'elevated_btn.dart';
class MyDialog extends GetxController {
void getDialog(String title, String? midTitle, VoidCallback onPressed) {
final textToSpeechController = Get.put(TextToSpeechController());
Get.defaultDialog(
title: title,
titleStyle: AppStyle.title,
barrierDismissible: false,
middleTextStyle: AppStyle.title,
content: Column(
children: [
IconButton(
Get.dialog(
BackdropFilter(
filter: ImageFilter.blur(sigmaX: 5, sigmaY: 5),
child: CupertinoAlertDialog(
title: Text(
title,
style: AppStyle.title.copyWith(
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
content: Column(
children: [
CupertinoButton(
onPressed: () async {
await textToSpeechController.speakText(title ?? midTitle!);
},
icon: const Icon(Icons.headphones)),
Text(
midTitle!,
style: AppStyle.title,
)
child: const Icon(CupertinoIcons.headphones,
color: AppColor.primaryColor),
),
Text(
midTitle!,
style: AppStyle.title.copyWith(fontSize: 16),
),
],
),
actions: [
CupertinoDialogAction(
child: const Text('Cancel',
style: TextStyle(color: AppColor.redColor)),
onPressed: () {
Get.back();
},
),
CupertinoDialogAction(
onPressed: onPressed,
child: Text('OK'.tr,
style: const TextStyle(color: AppColor.greenColor)),
),
],
),
confirm: MyElevatedButton(
title: 'Ok'.tr,
onPressed: onPressed,
kolor: AppColor.greenColor,
),
cancel: MyElevatedButton(
title: 'Cancel',
kolor: AppColor.redColor,
onPressed: () {
Get.back();
}));
),
barrierDismissible: false,
);
}
}
class MyDialogContent extends GetxController {
void getDialog(String title, Widget? content, VoidCallback onPressed) {
final textToSpeechController = Get.put(TextToSpeechController());
Get.dialog(
BackdropFilter(
filter: ImageFilter.blur(sigmaX: 5, sigmaY: 5),
child: CupertinoAlertDialog(
title: Text(
title,
style: AppStyle.title.copyWith(
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
content: Column(
children: [
CupertinoButton(
onPressed: () async {
await textToSpeechController.speakText(title);
},
child: const Icon(CupertinoIcons.headphones,
color: AppColor.primaryColor),
),
content!
],
),
actions: [
CupertinoDialogAction(
child: const Text('Cancel',
style: TextStyle(color: AppColor.redColor)),
onPressed: () {
Get.back();
},
),
CupertinoDialogAction(
onPressed: onPressed,
child: Text('OK'.tr,
style: const TextStyle(color: AppColor.greenColor)),
),
],
),
),
barrierDismissible: false,
);
}
}