This commit is contained in:
Hamza-Ayed
2024-12-08 18:16:31 +03:00
parent 630d0c4afb
commit e0c242bd77
34 changed files with 1876 additions and 1345 deletions

View File

@@ -23,9 +23,9 @@ class ContactUsPage extends StatelessWidget {
body: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
child: ListView(
// crossAxisAlignment: CrossAxisAlignment.center,
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
decoration: AppStyle.boxDecoration1,

View File

@@ -1,10 +1,8 @@
import 'package:SEFER/controller/home/home_page_controller.dart';
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 'package:SEFER/views/lang/languages.dart';
import 'package:SEFER/views/widgets/my_scafold.dart';
import 'HomePage/about_page.dart';
import 'HomePage/frequentlyQuestionsPage.dart';
@@ -18,121 +16,108 @@ class HomePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
Get.put(HomePageController());
return MyScafolld(
isleading: true,
title: 'Home Page'.tr,
body: [
ListView(
return CupertinoPageScaffold(
navigationBar: CupertinoNavigationBar(
middle: Text('Home Page'.tr),
leading: CupertinoButton(
padding: EdgeInsets.zero,
child: const Icon(CupertinoIcons.back),
onPressed: () {
Navigator.pop(context);
},
),
),
child: SafeArea(
child: ListView(
children: [
ListTile(
CupertinoListTile(
onTap: () {
Get.to(() => const Language());
},
title: Text(
'Language'.tr,
style: AppStyle.headTitle2,
),
subtitle: Text(
'To change Language the App'.tr,
style: AppStyle.title,
),
trailing: const Icon(
Icons.arrow_forward_ios,
size: 30,
color: AppColor.primaryColor,
),
leading: const Icon(
Icons.language_sharp,
color: AppColor.primaryColor,
),
leading: const Icon(CupertinoIcons.globe,
color: CupertinoColors.activeBlue),
title: Text('Language'.tr),
subtitle: Text('To change Language the App'.tr),
trailing: const CupertinoListTileChevron(),
),
ListTile(
leading: const Icon(Icons.location_city_outlined),
title: Text(
'Change Country'.tr,
style: AppStyle.headTitle2,
),
subtitle: Text(
'You can change the Country to get all features'.tr,
style: AppStyle.title,
),
onTap: () => Get.to(MyScafolld(
title: 'Change Country'.tr,
body: [CountryPickerFromSetting()],
isleading: true)),
),
ListTile(
leading: const Icon(Icons.question_answer),
title: Text(
'Frequently Questions'.tr,
style: AppStyle.headTitle2,
),
subtitle: Text(
'You can change the Country to get all features'.tr,
style: AppStyle.title,
),
onTap: () => Get.to(() => const FrequentlyQuestionsPage()),
),
ListTile(
leading: const Icon(Icons.vibration),
title: GetBuilder<HomePageController>(builder: (controller) {
return SwitchListTile(
title: Text(
'Vibration'.tr,
style: AppStyle.headTitle2,
CupertinoListTile(
onTap: () {
Get.to(CupertinoPageScaffold(
navigationBar: CupertinoNavigationBar(
middle: Text('Change Country'.tr),
),
value: controller.isVibrate,
onChanged: controller.changeVibrateOption,
activeColor: AppColor.primaryColor,
);
}),
subtitle: Text(
"You can change the vibration feedback for all buttons".tr,
style: AppStyle.title,
),
onTap: () => Get.to(() => const FrequentlyQuestionsPage()),
child: SafeArea(
child: CountryPickerFromSetting(),
),
));
},
leading: const Icon(CupertinoIcons.location,
color: CupertinoColors.activeBlue),
title: Text('Change Country'.tr),
subtitle:
Text('You can change the Country to get all features'.tr),
trailing: const CupertinoListTileChevron(),
),
ListTile(
leading: const Icon(Icons.record_voice_over_outlined),
title: Text(
'Trips recorded'.tr,
style: AppStyle.headTitle2,
),
subtitle: Text(
'Here recorded trips audio'.tr,
style: AppStyle.title,
),
onTap: () async {
Get.to(() => TripsRecordedPage());
}),
ListTile(
leading: const Icon(Icons.account_balance_outlined),
title: Text(
'About Us'.tr,
style: AppStyle.headTitle2,
),
subtitle: Text(
'You can change the Country to get all features'.tr,
style: AppStyle.title,
),
onTap: () => Get.to(() => const AboutPage()),
CupertinoListTile(
onTap: () {
Get.to(() => const FrequentlyQuestionsPage());
},
leading: const Icon(CupertinoIcons.question,
color: CupertinoColors.activeBlue),
title: Text('Frequently Questions'.tr),
subtitle: Text('Find answers to common questions'.tr),
trailing: const CupertinoListTileChevron(),
),
ListTile(
leading: const Icon(Icons.share),
title: Text(
'Share App'.tr,
style: AppStyle.headTitle2,
CupertinoListTile(
leading: const Icon(Icons.vibration,
color: CupertinoColors.activeBlue),
title: Text('Vibration'.tr),
trailing: GetBuilder<HomePageController>(
builder: (controller) {
return CupertinoSwitch(
value: controller.isVibrate,
onChanged: controller.changeVibrateOption,
);
},
),
subtitle: Text(
'You can share the SEFER App with your friends and earn rewards for rides they take using your code'
.tr,
style: AppStyle.title,
),
onTap: () => Get.to(() => ShareAppPage()),
'You can change the vibration feedback for all buttons'.tr),
),
CupertinoListTile(
onTap: () {
Get.to(() => const TripsRecordedPage());
},
leading: const Icon(CupertinoIcons.mic_circle,
color: CupertinoColors.activeBlue),
title: Text('Trips recorded'.tr),
subtitle: Text('Here recorded trips audio'.tr),
trailing: const CupertinoListTileChevron(),
),
CupertinoListTile(
onTap: () {
Get.to(() => const AboutPage());
},
leading: const Icon(CupertinoIcons.info_circle,
color: CupertinoColors.activeBlue),
title: Text('About Us'.tr),
subtitle: Text('Learn more about our app and mission'.tr),
trailing: const CupertinoListTileChevron(),
),
CupertinoListTile(
onTap: () {
Get.to(() => ShareAppPage());
},
leading: const Icon(CupertinoIcons.share,
color: CupertinoColors.activeBlue),
title: Text('Share App'.tr),
subtitle: Text(
'You can share the SEFER App with your friends and earn rewards for rides they take using your code'
.tr),
trailing: const CupertinoListTileChevron(),
),
],
),
],
),
);
}
}

View File

@@ -66,6 +66,7 @@ class MapPagePassenger extends StatelessWidget {
const RideBeginPassenger(),
const VipRideBeginPassenger(),
const RideFromStartApp(),
cancelRidePage(),
const MenuIconMapPageWidget(),
PointsPageForRider()
@@ -85,7 +86,7 @@ class CancelRidePageShow extends StatelessWidget {
Widget build(BuildContext context) {
return GetBuilder<MapPassengerController>(
builder: (controller) =>
(controller.data.isNotEmpty && controller.remainingTime > 0)
(controller.data.isNotEmpty && controller.statusRide != 'Begin')
// ||
// controller.timeToPassengerFromDriverAfterApplied == 0
? Positioned(

View File

@@ -17,6 +17,21 @@ class ApplyOrderWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
Color _parseColor(String colorHex) {
if (colorHex.isEmpty) {
return Colors.grey; // Fallback for empty color
}
// Ensure the string starts with '0xff' for ARGB format
String processedHex = colorHex.replaceFirst('#', '0xff').trim();
if (!processedHex.startsWith('0xff')) {
processedHex = '0xff$processedHex'; // Add '0xff' if missing
}
return Color(int.parse(processedHex));
}
return GetBuilder<MapPassengerController>(builder: (controller) {
if (controller.statusRide == 'Apply' &&
controller.isSearchingWindow == false) {
@@ -108,36 +123,43 @@ class ApplyOrderWidget extends StatelessWidget {
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Image.asset(
box.read(BoxName.carType) == 'Comfort'
? 'assets/images/blob.png'
: box.read(BoxName.carType) == 'Lady'
? 'assets/images/lady.png' // Assuming there's an image for Lady
: box.read(BoxName.carType) == 'Speed'
? 'assets/images/carspeed.png'
: box.read(BoxName.carType) ==
'Scooter'
? 'assets/images/moto.png'
: box.read(BoxName.carType) ==
'Mishwar Vip'
? 'assets/images/freeRide.png'
: box.read(BoxName
.carType) ==
'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,
),
// ColorFiltered(
// colorFilter: ColorFilter.mode(
// _parseColor(controller.colorHex),
// BlendMode.srcIn,
// ),
// child: Image.asset(
// box.read(BoxName.carType) == 'Comfort'
// ? 'assets/images/blob.png'
// : box.read(BoxName.carType) == 'Lady'
// ? 'assets/images/lady.png' // Assuming there's an image for Lady
// : box.read(BoxName.carType) == 'Speed'
// ? 'assets/images/carspeed.png'
// : box.read(BoxName.carType) ==
// 'Scooter'
// ? 'assets/images/moto.png'
// : box.read(BoxName.carType) ==
// 'Mishwar Vip'
// ? 'assets/images/freeRide.png'
// : box.read(BoxName
// .carType) ==
// '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(
children: [
Text(
@@ -152,14 +174,31 @@ class ApplyOrderWidget extends StatelessWidget {
),
],
),
const SizedBox(
width: 10,
),
Text(
// 'Black',
controller.carColor,
controller.carColor.toString(),
style: AppStyle.title,
),
const SizedBox(
width: 10,
),
ColorFiltered(
colorFilter: ColorFilter.mode(
_parseColor(controller.colorHex),
BlendMode.srcIn,
),
child: Image.asset(
box.read(BoxName.carType) == 'Scooter' ||
box.read(BoxName.carType) ==
'Pink Bike'
? 'assets/images/moto.png'
: 'assets/images/car3.png',
width: 80,
),
),
],
),
Padding(
@@ -218,7 +257,7 @@ class ApplyOrderWidget extends StatelessWidget {
children: [
Text(
// 'fadi ahmad',
controller.firstName,
controller.driverName,
style: AppStyle.title,
),
Text(

View File

@@ -242,109 +242,127 @@ GetBuilder<MapPassengerController> formSearchPlacesDestenation() {
// )
// : const SizedBox(),
Container(
height: controller.placesDestination.isNotEmpty
? controller.height
: 0,
color: AppColor.secondaryColor,
child: ListView.builder(
itemCount: controller.placesDestination.length,
itemBuilder: (BuildContext context, int index) {
var res = controller.placesDestination[index];
return InkWell(
onTap: () async {
controller.changeHeightPlaces();
await sql.insertData({
'latitude': res['geometry']['location']['lat'],
'longitude': res['geometry']['location']['lng'],
'name': res['name'].toString(),
'rate': res['rating'].toString(),
}, TableName.recentLocations);
height: controller.placesDestination.isNotEmpty
? controller.height
: 0,
color: AppColor.secondaryColor,
child: ListView.builder(
itemCount: controller.placesDestination.length,
itemBuilder: (BuildContext context, int index) {
var res = controller.placesDestination[index];
controller.changeHeightPlaces();
// Extract fields with null safety
var title = res['title']?.toString() ?? 'Unknown Place';
var position = res['position'];
var latitude = position?['lat'];
var longitude = position?['lng'];
var address =
res['address']?['label'] ?? 'Unknown Address';
var categories = res['categories'] ?? [];
var primaryCategory = categories.isNotEmpty
? categories[0]['name']
: 'Unknown Category';
controller.passengerLocation = controller.newMyLocation;
controller.myDestination = LatLng(
double.parse(
res['geometry']['location']['lat'].toString()),
double.parse(
res['geometry']['location']['lng'].toString()),
);
controller.convertHintTextDestinationNewPlaces(index);
return InkWell(
onTap: () async {
if (latitude != null && longitude != null) {
sql.insertMapLocation({
'latitude': latitude,
'longitude': longitude,
'name': title,
'rate': 'N/A',
'createdAt': DateTime.now().toIso8601String(),
// No rating in this structure, adjust as needed
}, TableName.recentLocations);
controller.placesDestination = [];
controller.placeDestinationController.clear();
controller.changeMainBottomMenuMap();
controller.passengerStartLocationFromMap = true;
controller.isPickerShown = true;
},
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 10),
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
children: [
Image.network(
res['icon'],
width: 20,
controller.passengerLocation =
controller.newMyLocation;
controller.myDestination =
LatLng(latitude, longitude);
controller
.convertHintTextDestinationNewPlaces(index);
controller.placesDestination = [];
controller.placeDestinationController.clear();
controller.changeMainBottomMenuMap();
controller.passengerStartLocationFromMap = true;
controller.isPickerShown = true;
} else {
Toast.show(
context,
'Invalid location data',
AppColor.redColor,
);
}
},
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 10),
child: Column(
children: [
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Column(
children: [
const Icon(Icons.place,
size: 20), // Fallback icon for places
IconButton(
onPressed: () async {
if (latitude != null &&
longitude != null) {
await sql.insertMapLocation({
'latitude': latitude,
'longitude': longitude,
'name': title,
'rate': 'N/A',
}, TableName.placesFavorite);
Toast.show(
context,
'$title ${'Saved Successfully'.tr}',
AppColor.primaryColor,
);
} else {
Toast.show(
context,
'Invalid location data',
AppColor.redColor,
);
}
},
icon: const Icon(Icons.favorite_border),
),
],
),
Expanded(
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Text(
title,
style: AppStyle.title,
),
Text(
address,
style: AppStyle.subtitle,
),
Text(
primaryCategory,
style: AppStyle.subtitle,
),
],
),
IconButton(
onPressed: () async {
await sql.insertData({
'latitude': res['geometry']
['location']['lat'],
'longitude': res['geometry']
['location']['lng'],
'name': res['name'].toString(),
'rate': res['rating'].toString(),
}, TableName.placesFavorite);
Toast.show(
context,
'${res['name']} ${'Saved Sucssefully'.tr}',
AppColor.primaryColor);
},
icon: const Icon(Icons.favorite_border),
),
],
),
Column(
children: [
Text(
res['name'].toString(),
style: AppStyle.title,
),
Text(
res['vicinity'].toString(),
style: AppStyle.subtitle,
),
],
),
Column(
children: [
Text(
'rate',
style: AppStyle.subtitle,
),
Text(
res['rating'].toString(),
style: AppStyle.subtitle,
),
],
),
],
),
const Divider(
thickness: 1,
)
],
),
],
),
const Divider(thickness: 1),
],
),
),
),
);
},
),
)
);
},
))
],
));
}

View File

@@ -103,7 +103,7 @@ GetBuilder<MapPassengerController> formSearchPlacesStart() {
// controller.myLocation =
// controller.newStartPointLocation;
// }
await sql.insertData({
await sql.insertMapLocation({
'latitude': res['geometry']['location']['lat'],
'longitude': res['geometry']['location']['lng'],
'name': res['name'].toString(),
@@ -130,7 +130,7 @@ GetBuilder<MapPassengerController> formSearchPlacesStart() {
),
IconButton(
onPressed: () async {
await sql.insertData({
await sql.insertMapLocation({
'latitude': res['geometry']
['location']['lat'],
'longitude': res['geometry']

View File

@@ -109,7 +109,7 @@ GetBuilder<MapPassengerController> formSearchPlaces(int index) {
),
IconButton(
onPressed: () async {
await sql.insertData({
await sql.insertMapLocation({
'latitude': res['geometry']
['location']['lat'],
'longitude': res['geometry']

View File

@@ -8,7 +8,7 @@ import '../../../controller/home/map_passenger_controller.dart';
import '../../../controller/home/vip_waitting_page.dart';
GetBuilder<MapPassengerController> leftMainMenuIcons() {
final textToSpeechController = Get.put(TextToSpeechController());
Get.put(TextToSpeechController());
return GetBuilder<MapPassengerController>(
builder: (controller) => Positioned(
top: Get.height * .008,
@@ -108,7 +108,9 @@ GetBuilder<MapPassengerController> leftMainMenuIcons() {
// borderRadius: BorderRadius.circular(15)),
// child: IconButton(
// onPressed: () async {
// print(Get.put(MapPassengerController()).data);
// controller.statusRide == 'Apply' &&
// controller.isSearchingWindow == false;
// controller.update();
// },
// icon: const Icon(
// Octicons

View File

@@ -1,4 +1,6 @@
import 'package:SEFER/views/widgets/my_dialog.dart';
import 'package:SEFER/views/widgets/my_textField.dart';
import 'package:SEFER/views/widgets/mysnakbar.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
@@ -14,6 +16,7 @@ import '../../../constant/colors.dart';
import '../../../constant/table_names.dart';
import '../../../controller/functions/toast.dart';
import '../../../controller/functions/tts.dart';
import '../../../print.dart';
import 'form_search_start.dart';
class MainBottomMenuMap extends StatelessWidget {
@@ -46,24 +49,34 @@ class MainBottomMenuMap extends StatelessWidget {
child: Container(
width: Get.width * .8,
height: Get.height * .1,
decoration: const BoxDecoration(
boxShadow: [
BoxShadow(
color: Color.fromARGB(
255, 237, 230, 230),
blurRadius: 5,
offset: Offset(2, 4)),
BoxShadow(
color: Color.fromARGB(
255, 242, 237, 237),
blurRadius: 5,
offset: Offset(-2, -2))
],
color: AppColor.blueColor,
borderRadius: BorderRadius.all(
Radius.elliptical(15, 30),
padding: const EdgeInsets.symmetric(
horizontal: 20, vertical: 10),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
AppColor.blueColor.withOpacity(0.8),
AppColor.blueColor.withOpacity(0.6),
],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
),
boxShadow: const [
BoxShadow(
color: Color.fromARGB(
255, 237, 230, 230),
blurRadius: 8,
offset: Offset(4, 8),
),
BoxShadow(
color: Color.fromARGB(
255, 242, 237, 237),
blurRadius: 8,
offset: Offset(-4, -4),
),
],
borderRadius: BorderRadius.circular(30),
),
// decoration: AppStyle.boxDecoration1,
child: DefaultTextStyle(
style: AppStyle.title.copyWith(
@@ -350,6 +363,18 @@ class MainBottomMenuMap extends StatelessWidget {
},
));
},
onLongPress: () {
MyDialog().getDialog(
"Are you sure to delete this location?".tr, '', () {
sql.deleteData(TableName.recentLocations,
controller.recentPlaces[index]['id']);
controller.getFavioratePlaces();
controller.update();
Get.back();
mySnackbarSuccess('deleted'.tr);
});
},
child: Container(
decoration: AppStyle.boxDecoration1,
child: Padding(

View File

@@ -53,7 +53,7 @@ class RideBeginPassenger extends StatelessWidget {
Container(
decoration: AppStyle.boxDecoration,
child: Text(
controller.firstName,
controller.driverName,
style: AppStyle.title,
),
),

View File

@@ -1,4 +1,3 @@
import 'package:SEFER/views/widgets/my_dialog.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
@@ -12,11 +11,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';
import 'passenger_wallet_dialoge.dart';
class PassengerWallet extends StatelessWidget {
@@ -51,33 +47,33 @@ class PassengerWallet extends StatelessWidget {
},
),
),
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()}');
},
),
)
// Padding(
// padding:
// const EdgeInsets.symmetric(horizontal: 80, vertical: 10),
// child: MyElevatedButton(
// kolor: AppColor.yellowColor,
// title: 'Bonus 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()}');
// },
// ),
// )
],
),
),
@@ -98,7 +94,8 @@ class PassengerWallet extends StatelessWidget {
MyElevatedButton(
title: 'Show Promos to Charge'.tr,
onPressed: () {
controller.changePromoSheetDialogue();
// controller.changePromoSheetDialogue();
showPaymentBottomSheet(context);
},
),
const SizedBox(

View File

@@ -1,4 +1,6 @@
import 'package:SEFER/constant/style.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:SEFER/constant/box_name.dart';
import 'package:SEFER/constant/colors.dart';
@@ -89,6 +91,147 @@ class PassengerWalletDialog extends StatelessWidget {
);
}
}
// class PassengerWalletDialog extends StatelessWidget {
// const PassengerWalletDialog({
// super.key,
// });
// @override
// Widget build(BuildContext context) {
// return GetBuilder<PaymentController>(
// builder: (controller) {
// return Positioned(
// top: Get.height * .1,
// right: Get.width * .15,
// left: Get.width * .15,
// bottom: Get.height * .1,
// child: controller.isPromoSheetDialogue
// ? Container()
// : SizedBox
// .shrink(), // If condition is false, return an empty widget
// );
// },
// );
// }
// }
void showPaymentBottomSheet(BuildContext context) {
final controller = Get.find<PaymentController>();
showModalBottomSheet(
context: context,
isScrollControlled: true,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.vertical(top: Radius.circular(15.0)),
),
builder: (BuildContext context) {
return WillPopScope(
onWillPop: () async {
Get.back();
return false;
},
child: Container(
padding: const EdgeInsets.all(16.0),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Text(
'Select Payment Amount'.tr,
style: AppStyle.headTitle2,
textAlign: TextAlign.center,
),
const SizedBox(height: 16.0),
// Payment Options List
_buildPaymentOption(
context: context,
controller: controller,
amount: box.read(BoxName.countryCode) == 'Egypt' ? 100 : 10,
bonusAmount: 0,
currency: box.read(BoxName.countryCode) == 'Egypt'
? 'LE'.tr
: 'JOD'.tr,
),
const SizedBox(height: 8.0),
_buildPaymentOption(
context: context,
controller: controller,
amount: box.read(BoxName.countryCode) == 'Egypt' ? 200 : 20,
bonusAmount: box.read(BoxName.countryCode) == 'Egypt' ? 5 : 1,
currency: box.read(BoxName.countryCode) == 'Egypt'
? 'LE'.tr
: 'JOD'.tr,
),
const SizedBox(height: 8.0),
_buildPaymentOption(
context: context,
controller: controller,
amount: box.read(BoxName.countryCode) == 'Egypt' ? 400 : 40,
bonusAmount:
box.read(BoxName.countryCode) == 'Egypt' ? 15 : 2.5,
currency: box.read(BoxName.countryCode) == 'Egypt'
? 'LE'.tr
: 'JOD'.tr,
),
const SizedBox(height: 8.0),
_buildPaymentOption(
context: context,
controller: controller,
amount: box.read(BoxName.countryCode) == 'Egypt' ? 1000 : 50,
bonusAmount: box.read(BoxName.countryCode) == 'Egypt' ? 100 : 6,
currency: box.read(BoxName.countryCode) == 'Egypt'
? 'LE'.tr
: 'JOD'.tr,
),
const SizedBox(height: 16.0),
TextButton(
onPressed: () => Get.back(),
child: Text('Cancel'.tr),
),
],
),
),
);
},
);
}
Widget _buildPaymentOption({
required BuildContext context,
required PaymentController controller,
required int amount,
required double bonusAmount,
required String currency,
}) {
return Material(
color: Colors.transparent,
child: InkWell(
onTap: () {
controller.updateSelectedAmount(amount);
Get.back();
showPaymentOptions(context, controller);
},
child: Container(
padding: const EdgeInsets.symmetric(vertical: 12.0, horizontal: 16.0),
decoration: BoxDecoration(
border: Border.all(color: Colors.grey[300]!),
borderRadius: BorderRadius.circular(8.0),
),
child: Text(
bonusAmount > 0
? '${'Pay'.tr} $amount $currency, ${'Get'.tr} ${amount + bonusAmount} $currency'
: '$amount $currency',
style: AppStyle.title,
textAlign: TextAlign.center,
),
),
),
);
}
void showPaymentOptions(BuildContext context, PaymentController controller) {
showCupertinoModalPopup(
@@ -209,7 +352,8 @@ void showPaymentOptions(BuildContext context, PaymentController controller) {
cancelButton: CupertinoActionSheetAction(
child: Text('Cancel'.tr),
onPressed: () {
controller.changePromoSheetDialogue();
// controller.changePromoSheetDialogue();
Get.back();
},
),
),

View File

@@ -20,211 +20,211 @@ class PromosPassengerPage extends StatelessWidget {
Widget build(BuildContext context) {
Get.put(PromosController());
return MyScafolld(
title: 'Promos For today'.tr,
title: "Promos For Today".tr,
isleading: true,
body: [
GetBuilder<PromosController>(
builder: (orderHistoryController) => orderHistoryController.isLoading
? const MyCircularProgressIndicator()
: ListView.builder(
itemCount: orderHistoryController.promoList.length +
1, // Adding 1 for the ad
itemCount: orderHistoryController
.promoList.length, // Adding 1 for the ad
itemBuilder: (BuildContext context, int index) {
if (index == 0) {
// Ad at the beginning
return Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
height: 120, // Adjust the height of the ad container
decoration: BoxDecoration(
color:
Colors.grey[200], // Background color for the ad
borderRadius: BorderRadius.circular(10),
),
child: Center(
child: Container(
decoration: AppStyle.boxDecoration,
height: Get.height * .19,
child: ListView(
scrollDirection: Axis.horizontal,
children: [
PointsCaptain(
kolor: AppColor.greyColor,
pricePoint:
box.read(BoxName.countryCode) ==
'Jordan'
? 5
: 100,
countPoint:
box.read(BoxName.countryCode) ==
'Jordan'
? '300'
: '100',
),
PointsCaptain(
kolor: AppColor.bronze,
pricePoint:
box.read(BoxName.countryCode) ==
'Jordan'
? 10
: 200,
countPoint:
box.read(BoxName.countryCode) ==
'Jordan'
? '1040'
: '210',
),
PointsCaptain(
kolor: AppColor.goldenBronze,
pricePoint:
box.read(BoxName.countryCode) ==
'Jordan'
? 22
: 400,
countPoint:
box.read(BoxName.countryCode) ==
'Jordan'
? '2300'
: '450',
),
PointsCaptain(
kolor: AppColor.gold,
pricePoint:
box.read(BoxName.countryCode) ==
'Jordan'
? 50
: 1000,
countPoint:
box.read(BoxName.countryCode) ==
'Jordan'
? '55000'
: '1200',
),
],
)),
),
),
);
} else {
// Promo items
final rides = orderHistoryController.promoList[index - 1];
// if (index == 0) {
// // Ad at the beginning
// return Padding(
// padding: const EdgeInsets.all(8.0),
// child: Container(
// height: 120, // Adjust the height of the ad container
// decoration: BoxDecoration(
// color:
// Colors.grey[200], // Background color for the ad
// borderRadius: BorderRadius.circular(10),
// ),
// child: Center(
// child: Container(
// decoration: AppStyle.boxDecoration,
// height: Get.height * .19,
// child: ListView(
// scrollDirection: Axis.horizontal,
// children: [
// PointsCaptain(
// kolor: AppColor.greyColor,
// pricePoint:
// box.read(BoxName.countryCode) ==
// 'Jordan'
// ? 5
// : 100,
// countPoint:
// box.read(BoxName.countryCode) ==
// 'Jordan'
// ? '300'
// : '100',
// ),
// PointsCaptain(
// kolor: AppColor.bronze,
// pricePoint:
// box.read(BoxName.countryCode) ==
// 'Jordan'
// ? 10
// : 200,
// countPoint:
// box.read(BoxName.countryCode) ==
// 'Jordan'
// ? '1040'
// : '210',
// ),
// PointsCaptain(
// kolor: AppColor.goldenBronze,
// pricePoint:
// box.read(BoxName.countryCode) ==
// 'Jordan'
// ? 22
// : 400,
// countPoint:
// box.read(BoxName.countryCode) ==
// 'Jordan'
// ? '2300'
// : '450',
// ),
// PointsCaptain(
// kolor: AppColor.gold,
// pricePoint:
// box.read(BoxName.countryCode) ==
// 'Jordan'
// ? 50
// : 1000,
// countPoint:
// box.read(BoxName.countryCode) ==
// 'Jordan'
// ? '55000'
// : '1200',
// ),
// ],
// )),
// ),
// ),
// );
// } else {
// Promo items
final rides = orderHistoryController.promoList[index];
return Padding(
padding: const EdgeInsets.all(12.0),
child: Container(
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(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
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,
),
return Padding(
padding: const EdgeInsets.all(12.0),
child: Container(
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(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
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,
),
),
WavyAnimatedText(
rides['promo_code'],
textStyle:
AppStyle.title.copyWith(
fontSize:
32, // Increased font size for emphasis
color:
CupertinoColors.activeBlue,
fontWeight: FontWeight.bold,
),
],
isRepeatingAnimation: true,
),
),
],
isRepeatingAnimation: true,
),
const SizedBox(height: 8),
// Description Text
Text(
rides['description'],
style: AppStyle.title.copyWith(
fontSize: 22,
color: CupertinoColors.systemGrey,
),
),
],
),
Column(
children: [
// Only displaying end date
Text(
'${'Valid Until:'.tr} ${rides['validity_end_date']}',
style: AppStyle.subtitle.copyWith(
fontWeight: FontWeight.bold,
fontSize: 20,
color: CupertinoColors.systemGrey,
),
),
],
),
],
),
// 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,
),
const SizedBox(height: 8),
// Description Text
Text(
rides['description'],
style: AppStyle.title.copyWith(
fontSize: 22,
color: CupertinoColors.systemGrey,
),
),
],
),
Column(
children: [
// Only displaying end date
Text(
'${'Valid Until:'.tr} ${rides['validity_end_date']}',
style: AppStyle.subtitle.copyWith(
fontWeight: FontWeight.bold,
fontSize: 20,
color: CupertinoColors.systemGrey,
),
),
],
),
],
),
// 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,
),
),
),
],
),
),
],
),
),
);
}
),
);
// }
},
),
)