25-7-26-1
This commit is contained in:
71
lib/views/home/profile/budgets_ads.dart
Normal file
71
lib/views/home/profile/budgets_ads.dart
Normal file
@@ -0,0 +1,71 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:Intaleq/constant/colors.dart';
|
||||
import 'package:Intaleq/constant/style.dart';
|
||||
import 'package:Intaleq/controller/payment/payment_controller.dart';
|
||||
|
||||
import '../../../constant/box_name.dart';
|
||||
import '../../../main.dart';
|
||||
import '../my_wallet/passenger_wallet.dart';
|
||||
|
||||
class PointsCaptain extends StatelessWidget {
|
||||
PaymentController paymentController = Get.put(PaymentController());
|
||||
|
||||
PointsCaptain({
|
||||
super.key,
|
||||
required this.kolor,
|
||||
required this.countPoint,
|
||||
required this.pricePoint,
|
||||
});
|
||||
final Color kolor;
|
||||
final String countPoint;
|
||||
double pricePoint;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: () async {
|
||||
Get.to(() => const PassengerWallet());
|
||||
paymentController.changePromoSheetDialogue();
|
||||
},
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 3, vertical: 8),
|
||||
child: Container(
|
||||
width: Get.width * .21,
|
||||
height: Get.width * .29,
|
||||
margin: const EdgeInsets.all(4),
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [
|
||||
kolor.withOpacity(0.3),
|
||||
kolor,
|
||||
kolor.withOpacity(0.7),
|
||||
kolor,
|
||||
],
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
),
|
||||
border: Border.all(color: AppColor.accentColor),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
shape: BoxShape.rectangle,
|
||||
),
|
||||
child: Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
Text(
|
||||
'$countPoint ${'LE'.tr}',
|
||||
style: AppStyle.subtitle,
|
||||
),
|
||||
Text(
|
||||
'$pricePoint ${box.read(BoxName.countryCode) == 'Jordan' ? 'JOD'.tr : 'LE'.tr}',
|
||||
style: AppStyle.title,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
],
|
||||
),
|
||||
)),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
228
lib/views/home/profile/complaint_page.dart
Normal file
228
lib/views/home/profile/complaint_page.dart
Normal file
@@ -0,0 +1,228 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:Intaleq/constant/style.dart';
|
||||
import 'package:Intaleq/controller/home/profile/complaint_controller.dart';
|
||||
import 'package:Intaleq/views/widgets/my_scafold.dart'; // سنستخدم السكافولد الخاص بك
|
||||
import 'package:Intaleq/views/widgets/mycircular.dart';
|
||||
import 'package:Intaleq/views/widgets/mydialoug.dart';
|
||||
import 'package:Intaleq/views/widgets/elevated_btn.dart'; // سنستخدم الزر الخاص بك
|
||||
|
||||
import '../../../constant/colors.dart';
|
||||
import '../../../controller/functions/audio_record1.dart';
|
||||
|
||||
// --- الويدجت الرئيسية بالتصميم الجديد ---
|
||||
class ComplaintPage extends StatelessWidget {
|
||||
ComplaintPage({super.key});
|
||||
|
||||
final ComplaintController complaintController =
|
||||
Get.put(ComplaintController());
|
||||
final AudioRecorderController audioRecorderController =
|
||||
Get.put(AudioRecorderController());
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MyScafolld(
|
||||
title: 'Submit a Complaint'.tr,
|
||||
isleading: true,
|
||||
body: [
|
||||
GetBuilder<ComplaintController>(
|
||||
builder: (controller) {
|
||||
if (controller.isLoading) {
|
||||
return const MyCircularProgressIndicator();
|
||||
}
|
||||
return Form(
|
||||
key: controller.formKey,
|
||||
child: ListView(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
children: [
|
||||
// --- 1. بطاقة إدخال نص الشكوى ---
|
||||
_buildSectionCard(
|
||||
title: '1. Describe Your Issue'.tr,
|
||||
child: TextFormField(
|
||||
controller: controller.complaintController,
|
||||
decoration: InputDecoration(
|
||||
hintText: 'Enter your complaint here...'.tr,
|
||||
filled: true,
|
||||
fillColor: AppColor.secondaryColor.withOpacity(0.5),
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderSide: BorderSide.none,
|
||||
),
|
||||
contentPadding: const EdgeInsets.all(16),
|
||||
),
|
||||
maxLines: 6,
|
||||
style: AppStyle.subtitle,
|
||||
),
|
||||
),
|
||||
|
||||
// --- 2. بطاقة إرفاق التسجيل الصوتي ---
|
||||
_buildSectionCard(
|
||||
title: '2. Attach Recorded Audio'.tr,
|
||||
child: FutureBuilder<List<String>>(
|
||||
future: audioRecorderController.getRecordedFiles(),
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.connectionState ==
|
||||
ConnectionState.waiting) {
|
||||
return const Center(
|
||||
child: CircularProgressIndicator());
|
||||
}
|
||||
if (snapshot.hasError ||
|
||||
!snapshot.hasData ||
|
||||
snapshot.data!.isEmpty) {
|
||||
return Center(
|
||||
child: Text('No audio files found.'.tr,
|
||||
style: AppStyle.subtitle));
|
||||
}
|
||||
return Column(
|
||||
children: snapshot.data!.map((audioFilePath) {
|
||||
final audioFile = File(audioFilePath);
|
||||
final isUploaded = controller
|
||||
.audioLink.isNotEmpty &&
|
||||
controller.audioLink
|
||||
.contains(audioFilePath.split('/').last);
|
||||
return ListTile(
|
||||
leading: Icon(
|
||||
isUploaded ? Icons.check_circle : Icons.mic,
|
||||
color: isUploaded
|
||||
? AppColor.greenColor
|
||||
: AppColor.primaryColor),
|
||||
title: Text(audioFilePath.split('/').last,
|
||||
style: AppStyle.subtitle,
|
||||
overflow: TextOverflow.ellipsis),
|
||||
subtitle: isUploaded
|
||||
? Text('Uploaded'.tr,
|
||||
style: const TextStyle(
|
||||
color: AppColor.greenColor))
|
||||
: null,
|
||||
onTap: isUploaded
|
||||
? null
|
||||
: () {
|
||||
// --- نفس منطقك القديم ---
|
||||
MyDialogContent().getDialog(
|
||||
'Confirm Attachment'.tr,
|
||||
Text('Attach this audio file?'.tr),
|
||||
() async {
|
||||
await controller
|
||||
.uploadAudioFile(audioFile);
|
||||
});
|
||||
},
|
||||
);
|
||||
}).toList(),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
|
||||
// --- 3. بطاقة تفاصيل الرحلة والرد ---
|
||||
_buildSectionCard(
|
||||
title: '3. Review Details & Response'.tr,
|
||||
child: Column(
|
||||
children: [
|
||||
if (controller.feedBack.isNotEmpty) ...[
|
||||
_buildDetailRow(Icons.calendar_today_outlined,
|
||||
'Date'.tr, controller.feedBack[0]['date']),
|
||||
_buildDetailRow(Icons.monetization_on_outlined,
|
||||
'Price'.tr, '${controller.feedBack[0]['price']}'),
|
||||
],
|
||||
const Divider(height: 24),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.support_agent_outlined,
|
||||
color: AppColor.primaryColor),
|
||||
title: Text("Intaleq's Response".tr,
|
||||
style: AppStyle.title),
|
||||
subtitle: Text(
|
||||
controller.passengerReport?['solution']
|
||||
?.toString() ??
|
||||
'Awaiting response...'.tr,
|
||||
style: AppStyle.subtitle.copyWith(height: 1.5),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
// --- 4. زر الإرسال ---
|
||||
const SizedBox(height: 24),
|
||||
MyElevatedButton(
|
||||
kolor: AppColor.blueColor,
|
||||
title: 'Submit Complaint'.tr,
|
||||
onPressed: () async {
|
||||
// --- نفس منطقك القديم بالكامل ---
|
||||
if (controller.formKey.currentState!.validate()) {
|
||||
if (controller.audioLink.toString() == '') {
|
||||
MyDialogContent().getDialog(
|
||||
'Audio file not attached'.tr,
|
||||
Text(
|
||||
'The audio file is not uploaded yet.\nDo you want to submit without it?'
|
||||
.tr), () async {
|
||||
await controller.geminiAudio(
|
||||
jsonEncode(controller.feedBack),
|
||||
controller.audioLink,
|
||||
controller.complaintController.text);
|
||||
Get.back(); // إغلاق الدايالوج
|
||||
controller.formKey.currentState!.reset();
|
||||
});
|
||||
} else {
|
||||
await controller.geminiAudio(
|
||||
jsonEncode(controller.feedBack),
|
||||
controller.audioLink,
|
||||
controller.complaintController.text);
|
||||
controller.formKey.currentState!.reset();
|
||||
}
|
||||
// هذه الدالة كانت مكررة في else، يجب أن تكون هنا لتنفذ في كلتا الحالتين
|
||||
controller.addComplaint();
|
||||
}
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
// --- ويدجت مساعدة لبناء البطاقات ---
|
||||
Widget _buildSectionCard({required String title, required Widget child}) {
|
||||
return Card(
|
||||
margin: const EdgeInsets.only(bottom: 20),
|
||||
elevation: 4,
|
||||
shadowColor: Colors.black.withOpacity(0.1),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(title, style: AppStyle.headTitle.copyWith(fontSize: 18)),
|
||||
const SizedBox(height: 12),
|
||||
child,
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// --- ويدجت مساعدة لعرض صفوف التفاصيل ---
|
||||
Widget _buildDetailRow(IconData icon, String label, String value) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 4.0),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(icon, color: AppColor.writeColor.withOpacity(0.6), size: 20),
|
||||
const SizedBox(width: 12),
|
||||
Text('${label.tr}:',
|
||||
style: AppStyle.subtitle
|
||||
.copyWith(color: AppColor.writeColor.withOpacity(0.7))),
|
||||
const Spacer(),
|
||||
Text(value,
|
||||
style: AppStyle.title.copyWith(fontWeight: FontWeight.bold)),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
233
lib/views/home/profile/order_history.dart
Normal file
233
lib/views/home/profile/order_history.dart
Normal file
@@ -0,0 +1,233 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:Intaleq/constant/style.dart';
|
||||
import 'package:Intaleq/views/widgets/my_scafold.dart';
|
||||
import 'package:Intaleq/views/widgets/mycircular.dart';
|
||||
import 'package:google_maps_flutter/google_maps_flutter.dart';
|
||||
|
||||
import '../../../constant/colors.dart';
|
||||
import '../../../controller/functions/launch.dart';
|
||||
import '../../../controller/home/profile/order_history_controller.dart';
|
||||
|
||||
// --- الويدجت الرئيسية بالتصميم الجديد ---
|
||||
class OrderHistory extends StatelessWidget {
|
||||
const OrderHistory({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// نفس منطق استدعاء الكنترولر
|
||||
Get.put(OrderHistoryController());
|
||||
|
||||
return MyScafolld(
|
||||
title: 'Order History'.tr,
|
||||
isleading: true,
|
||||
body: [
|
||||
GetBuilder<OrderHistoryController>(
|
||||
builder: (controller) {
|
||||
// --- نفس منطق التحميل والحالة الفارغة ---
|
||||
if (controller.isloading) {
|
||||
return const MyCircularProgressIndicator();
|
||||
}
|
||||
if (controller.orderHistoryListPassenger.isEmpty) {
|
||||
return Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(Icons.map_outlined,
|
||||
size: 80, color: AppColor.writeColor.withOpacity(0.4)),
|
||||
const SizedBox(height: 16),
|
||||
Text('No trip history found'.tr,
|
||||
style: AppStyle.headTitle2),
|
||||
Text("Your past trips will appear here.".tr,
|
||||
style: AppStyle.subtitle),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
// --- استخدام ListView.separated لفصل البطاقات ---
|
||||
return ListView.separated(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
itemCount: controller.orderHistoryListPassenger.length,
|
||||
separatorBuilder: (context, index) => const SizedBox(height: 16),
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
final ride = controller.orderHistoryListPassenger[index];
|
||||
// --- استدعاء ويدجت البطاقة الجديدة ---
|
||||
return _buildHistoryCard(context, ride);
|
||||
},
|
||||
);
|
||||
},
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
// --- ويدجت بناء بطاقة الرحلة ---
|
||||
Widget _buildHistoryCard(BuildContext context, Map<String, dynamic> ride) {
|
||||
// --- نفس منطق حساب إحداثيات الخريطة ---
|
||||
final LatLng startLocation = LatLng(
|
||||
double.parse(ride['start_location'].toString().split(',')[0]),
|
||||
double.parse(ride['start_location'].toString().split(',')[1]),
|
||||
);
|
||||
final LatLng endLocation = LatLng(
|
||||
double.parse(ride['end_location'].toString().split(',')[0]),
|
||||
double.parse(ride['end_location'].toString().split(',')[1]),
|
||||
);
|
||||
final LatLngBounds bounds = LatLngBounds(
|
||||
northeast: LatLng(
|
||||
startLocation.latitude > endLocation.latitude
|
||||
? startLocation.latitude
|
||||
: endLocation.latitude,
|
||||
startLocation.longitude > endLocation.longitude
|
||||
? startLocation.longitude
|
||||
: endLocation.longitude,
|
||||
),
|
||||
southwest: LatLng(
|
||||
startLocation.latitude < endLocation.latitude
|
||||
? startLocation.latitude
|
||||
: endLocation.latitude,
|
||||
startLocation.longitude < endLocation.longitude
|
||||
? startLocation.longitude
|
||||
: endLocation.longitude,
|
||||
),
|
||||
);
|
||||
|
||||
return InkWell(
|
||||
// --- نفس دالة onTap القديمة ---
|
||||
onTap: () {
|
||||
String mapUrl =
|
||||
'https://www.google.com/maps/dir/${ride['start_location']}/${ride['end_location']}/';
|
||||
showInBrowser(mapUrl);
|
||||
},
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.secondaryColor,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withOpacity(0.15),
|
||||
blurRadius: 8,
|
||||
offset: const Offset(0, 4),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// --- 1. قسم الخريطة ---
|
||||
ClipRRect(
|
||||
borderRadius: const BorderRadius.only(
|
||||
topLeft: Radius.circular(16),
|
||||
topRight: Radius.circular(16),
|
||||
),
|
||||
child: SizedBox(
|
||||
height: 150, // ارتفاع ثابت للخريطة
|
||||
child: AbsorbPointer(
|
||||
// لمنع التفاعل المباشر مع الخريطة داخل القائمة
|
||||
child: GoogleMap(
|
||||
initialCameraPosition:
|
||||
CameraPosition(target: startLocation, zoom: 12),
|
||||
// --- نفس منطق الخريطة والخطوط ---
|
||||
onMapCreated: (GoogleMapController controller) {
|
||||
controller.animateCamera(
|
||||
CameraUpdate.newLatLngBounds(bounds, 60));
|
||||
},
|
||||
polylines: {
|
||||
Polyline(
|
||||
polylineId: const PolylineId('route'),
|
||||
points: [startLocation, endLocation],
|
||||
color: AppColor.primaryColor,
|
||||
width: 4,
|
||||
),
|
||||
},
|
||||
markers: {
|
||||
Marker(
|
||||
markerId: const MarkerId('start'),
|
||||
position: startLocation),
|
||||
Marker(
|
||||
markerId: const MarkerId('end'),
|
||||
position: endLocation),
|
||||
},
|
||||
mapToolbarEnabled: false,
|
||||
zoomControlsEnabled: false,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
// --- 2. قسم تفاصيل الرحلة ---
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(12.0),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'${ride['date']} - ${ride['time']}',
|
||||
style: AppStyle.subtitle.copyWith(
|
||||
color: AppColor.writeColor.withOpacity(0.7)),
|
||||
),
|
||||
// --- ويدجت جديدة لعرض حالة الرحلة ---
|
||||
_buildStatusChip(ride['status']),
|
||||
],
|
||||
),
|
||||
const Divider(height: 20),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text('Total Price'.tr,
|
||||
style: AppStyle.title.copyWith(fontSize: 16)),
|
||||
Text(
|
||||
'${ride['price']} ${'SYP'.tr}',
|
||||
style: AppStyle.headTitle.copyWith(
|
||||
fontSize: 20, color: AppColor.primaryColor),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// --- ويدجت مساعدة لعرض حالة الرحلة بشكل أنيق ---
|
||||
Widget _buildStatusChip(String status) {
|
||||
Color chipColor;
|
||||
IconData chipIcon;
|
||||
|
||||
// --- نفس منطق تحديد اللون ---
|
||||
if (status == 'Canceled'.tr) {
|
||||
chipColor = AppColor.redColor;
|
||||
chipIcon = Icons.cancel_outlined;
|
||||
} else if (status == 'Finished'.tr) {
|
||||
chipColor = AppColor.greenColor;
|
||||
chipIcon = Icons.check_circle_outline;
|
||||
} else {
|
||||
chipColor = AppColor.yellowColor;
|
||||
chipIcon = Icons.hourglass_empty_rounded;
|
||||
}
|
||||
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
|
||||
decoration: BoxDecoration(
|
||||
color: chipColor.withOpacity(0.15),
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(chipIcon, color: chipColor, size: 16),
|
||||
const SizedBox(width: 6),
|
||||
Text(
|
||||
status,
|
||||
style: AppStyle.subtitle.copyWith(
|
||||
color: chipColor, fontWeight: FontWeight.bold, fontSize: 12),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
488
lib/views/home/profile/passenger_profile_page.dart
Normal file
488
lib/views/home/profile/passenger_profile_page.dart
Normal file
@@ -0,0 +1,488 @@
|
||||
import 'package:Intaleq/controller/functions/encrypt_decrypt.dart';
|
||||
import 'package:Intaleq/views/auth/login_page.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:Intaleq/constant/box_name.dart';
|
||||
import 'package:Intaleq/constant/colors.dart';
|
||||
import 'package:Intaleq/constant/style.dart';
|
||||
import 'package:Intaleq/controller/profile/profile_controller.dart';
|
||||
import 'package:Intaleq/main.dart';
|
||||
import 'package:Intaleq/views/widgets/elevated_btn.dart';
|
||||
import 'package:Intaleq/views/widgets/my_scafold.dart';
|
||||
import 'package:Intaleq/views/widgets/my_textField.dart';
|
||||
import 'package:Intaleq/views/widgets/mycircular.dart';
|
||||
|
||||
import '../../../controller/auth/login_controller.dart';
|
||||
import '../../../controller/functions/log_out.dart';
|
||||
|
||||
class PassengerProfilePage extends StatelessWidget {
|
||||
PassengerProfilePage({super.key});
|
||||
LogOutController logOutController = Get.put(LogOutController());
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Get.put(ProfileController());
|
||||
|
||||
return MyScafolld(
|
||||
isleading: true,
|
||||
title: 'My Profile'.tr,
|
||||
body: [
|
||||
GetBuilder<ProfileController>(
|
||||
builder: (controller) => controller.isloading
|
||||
? const MyCircularProgressIndicator()
|
||||
: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 15),
|
||||
child: SizedBox(
|
||||
height: Get.height,
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Edit Profile'.tr,
|
||||
style: AppStyle.headTitle2,
|
||||
),
|
||||
ListTile(
|
||||
title: Text(
|
||||
'Name'.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
leading: const Icon(
|
||||
Icons.person_pin_rounded,
|
||||
size: 35,
|
||||
),
|
||||
trailing: const Icon(Icons.arrow_forward_ios),
|
||||
subtitle: Text(
|
||||
'${(controller.prfoileData['first_name'])} ${(controller.prfoileData['last_name'])}'),
|
||||
onTap: () {
|
||||
controller.updatField(
|
||||
'first_name', TextInputType.name);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
title: Text(
|
||||
'Gender'.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
leading: Image.asset(
|
||||
'assets/images/gender.png',
|
||||
width: 35,
|
||||
),
|
||||
trailing: const Icon(Icons.arrow_forward_ios),
|
||||
subtitle: Text((controller.prfoileData['gender']
|
||||
.toString())),
|
||||
onTap: () {
|
||||
Get.defaultDialog(
|
||||
title: 'Update Gender'.tr,
|
||||
content: Column(
|
||||
children: [
|
||||
GenderPicker(),
|
||||
MyElevatedButton(
|
||||
title: 'Update'.tr,
|
||||
onPressed: () {
|
||||
controller.updateColumn({
|
||||
'id': controller.prfoileData['id']
|
||||
.toString(),
|
||||
'gender': (controller.gender),
|
||||
});
|
||||
Get.back();
|
||||
},
|
||||
)
|
||||
],
|
||||
));
|
||||
// controller.updatField('gender');
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
title: Text(
|
||||
'Education'.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
leading: Image.asset(
|
||||
'assets/images/education.png',
|
||||
width: 35,
|
||||
),
|
||||
trailing: const Icon(Icons.arrow_forward_ios),
|
||||
subtitle: Text(controller.prfoileData['education']
|
||||
.toString()),
|
||||
onTap: () {
|
||||
Get.defaultDialog(
|
||||
barrierDismissible: true,
|
||||
title: 'Update Education'.tr,
|
||||
content: SizedBox(
|
||||
height: 200,
|
||||
child: Column(
|
||||
children: [
|
||||
EducationDegreePicker(),
|
||||
],
|
||||
),
|
||||
),
|
||||
confirm: MyElevatedButton(
|
||||
title: 'Update Education'.tr,
|
||||
onPressed: () {
|
||||
controller.updateColumn({
|
||||
'id': controller.prfoileData['id']
|
||||
.toString(),
|
||||
'education':
|
||||
controller.selectedDegree,
|
||||
});
|
||||
Get.back();
|
||||
},
|
||||
));
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
title: Text(
|
||||
'Employment Type'.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
leading: Image.asset(
|
||||
'assets/images/employmentType.png',
|
||||
width: 35,
|
||||
),
|
||||
trailing: const Icon(Icons.arrow_forward_ios),
|
||||
subtitle: Text(controller
|
||||
.prfoileData['employmentType']
|
||||
.toString()),
|
||||
onTap: () {
|
||||
controller.updatField(
|
||||
'employmentType', TextInputType.name);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
title: Text(
|
||||
'Marital Status'.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
leading: Image.asset(
|
||||
'assets/images/maritalStatus.png',
|
||||
width: 35,
|
||||
),
|
||||
trailing: const Icon(Icons.arrow_forward_ios),
|
||||
subtitle: Text(controller
|
||||
.prfoileData['maritalStatus']
|
||||
.toString()),
|
||||
onTap: () {
|
||||
controller.updatField(
|
||||
'maritalStatus', TextInputType.name);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
title: Text(
|
||||
'SOS Phone'.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
leading: const Icon(
|
||||
Icons.sos,
|
||||
color: AppColor.redColor,
|
||||
size: 35,
|
||||
),
|
||||
trailing: const Icon(Icons.arrow_forward_ios),
|
||||
subtitle: Text(
|
||||
(controller.prfoileData['sosPhone'])
|
||||
.toString()),
|
||||
onTap: () async {
|
||||
await controller.updatField(
|
||||
'sosPhone', TextInputType.phone);
|
||||
box.write(BoxName.sosPhonePassenger,
|
||||
controller.prfoileData['sosPhone']);
|
||||
},
|
||||
),
|
||||
// const Spacer(),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
MyElevatedButton(
|
||||
title: 'Sign Out'.tr,
|
||||
onPressed: () {
|
||||
LogOutController().logOutPassenger();
|
||||
}),
|
||||
GetBuilder<LogOutController>(
|
||||
builder: (logOutController) {
|
||||
return MyElevatedButton(
|
||||
title: 'Delete My Account'.tr,
|
||||
onPressed: () {
|
||||
Get.defaultDialog(
|
||||
title:
|
||||
'Are you sure to delete your account?'
|
||||
.tr,
|
||||
content: Form(
|
||||
key: logOutController.formKey1,
|
||||
child: MyTextForm(
|
||||
controller: logOutController
|
||||
.emailTextController,
|
||||
label: 'Type your Email'.tr,
|
||||
hint: 'Type your Email'.tr,
|
||||
type:
|
||||
TextInputType.emailAddress,
|
||||
),
|
||||
),
|
||||
confirm: MyElevatedButton(
|
||||
title: 'Delete My Account'.tr,
|
||||
kolor: AppColor.redColor,
|
||||
onPressed: () async {
|
||||
await logOutController
|
||||
.deletePassengerAccount();
|
||||
}),
|
||||
cancel: MyElevatedButton(
|
||||
title: 'No I want'.tr,
|
||||
onPressed: () {
|
||||
logOutController
|
||||
.emailTextController
|
||||
.clear();
|
||||
logOutController.update();
|
||||
Get.back();
|
||||
}));
|
||||
});
|
||||
}),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
)),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class GenderPicker extends StatelessWidget {
|
||||
final ProfileController controller = Get.put(ProfileController());
|
||||
|
||||
final List<String> genderOptions = ['Male'.tr, 'Female'.tr, 'Other'.tr];
|
||||
|
||||
GenderPicker({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SizedBox(
|
||||
height: 100,
|
||||
child: CupertinoPicker(
|
||||
itemExtent: 32.0,
|
||||
onSelectedItemChanged: (int index) {
|
||||
controller.setGender(genderOptions[index]);
|
||||
},
|
||||
children: genderOptions.map((String value) {
|
||||
return Text(value);
|
||||
}).toList(),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class EducationDegreePicker extends StatelessWidget {
|
||||
final ProfileController controller = Get.put(ProfileController());
|
||||
|
||||
final List<String> degreeOptions = [
|
||||
'High School Diploma'.tr,
|
||||
'Associate Degree'.tr,
|
||||
'Bachelor\'s Degree'.tr,
|
||||
'Master\'s Degree'.tr,
|
||||
'Doctoral Degree'.tr,
|
||||
];
|
||||
|
||||
EducationDegreePicker({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SizedBox(
|
||||
height: 200,
|
||||
child: CupertinoPicker(
|
||||
// backgroundColor: AppColor.accentColor,
|
||||
// looping: true,
|
||||
squeeze: 2,
|
||||
// diameterRatio: 5,
|
||||
itemExtent: 32,
|
||||
onSelectedItemChanged: (int index) {
|
||||
controller.setDegree(degreeOptions[index]);
|
||||
},
|
||||
children: degreeOptions.map((String value) {
|
||||
return Text(value);
|
||||
}).toList(),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class CountryPicker extends StatelessWidget {
|
||||
final ProfileController controller = Get.put(ProfileController());
|
||||
|
||||
final List<String> countryOptions = [
|
||||
'Jordan',
|
||||
'Syria',
|
||||
'Egypt',
|
||||
'Turkey',
|
||||
'Saudi Arabia',
|
||||
'Qatar',
|
||||
'Bahrain',
|
||||
'Kuwait',
|
||||
'USA'
|
||||
];
|
||||
|
||||
CountryPicker({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GetBuilder<ProfileController>(builder: (controller) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(20),
|
||||
child: ListView(
|
||||
children: [
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
Text(
|
||||
"Select Your Country".tr,
|
||||
style: AppStyle.headTitle2,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
// const SizedBox(
|
||||
// height: 20,
|
||||
// ),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(10),
|
||||
child: Text(
|
||||
"To ensure you receive the most accurate information for your location, please select your country below. This will help tailor the app experience and content to your country."
|
||||
.tr,
|
||||
style: AppStyle.title,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 200,
|
||||
child: CupertinoPicker(
|
||||
itemExtent: 32,
|
||||
onSelectedItemChanged: (int index) {
|
||||
controller.setCountry(countryOptions[index]);
|
||||
box.write(BoxName.countryCode,
|
||||
countryOptions[index]); // Save in English
|
||||
},
|
||||
children: List.generate(
|
||||
countryOptions.length,
|
||||
(index) => Center(
|
||||
child: Text(
|
||||
countryOptions[index]
|
||||
.tr, // Display translated if not English
|
||||
style: AppStyle.title,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
MyElevatedButton(
|
||||
title: 'Select Country'.tr, // Use translated text for button
|
||||
onPressed: () {
|
||||
Get.find<LoginController>().saveCountryCode(controller
|
||||
.selectedCountry
|
||||
.toString()); // No conversion needed
|
||||
box.write(
|
||||
BoxName.countryCode, //
|
||||
controller.selectedCountry); // Already saved in English
|
||||
if (controller.selectedCountry == null) {
|
||||
Get.snackbar("You should select your country".tr, '');
|
||||
} else {
|
||||
Get.snackbar(controller.selectedCountry.toString().tr, '');
|
||||
Get.off(LoginPage());
|
||||
}
|
||||
},
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
class CountryPickerFromSetting extends StatelessWidget {
|
||||
final ProfileController controller = Get.put(ProfileController());
|
||||
final LoginController loginController = Get.put(LoginController());
|
||||
|
||||
final List<String> countryOptions = [
|
||||
'Jordan',
|
||||
'USA',
|
||||
'Egypt',
|
||||
'Turkey',
|
||||
'Saudi Arabia',
|
||||
'Qatar',
|
||||
'Bahrain',
|
||||
'Kuwait',
|
||||
];
|
||||
|
||||
CountryPickerFromSetting({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GetBuilder<ProfileController>(builder: (controller) {
|
||||
return CupertinoPageScaffold(
|
||||
navigationBar: CupertinoNavigationBar(
|
||||
middle: Text('Select Your Country'.tr),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(20.0),
|
||||
child: ListView(
|
||||
children: [
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
// Text(
|
||||
// "Select Your Country".tr,
|
||||
// style: AppStyle.headTitle2,
|
||||
// textAlign: TextAlign.center,
|
||||
// ),
|
||||
// const SizedBox(
|
||||
// height: 20,
|
||||
// ),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(10),
|
||||
child: Text(
|
||||
"To ensure you receive the most accurate information for your location, please select your country below. This will help tailor the app experience and content to your country."
|
||||
.tr,
|
||||
style: AppStyle.headTitle2,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 200,
|
||||
child: CupertinoPicker(
|
||||
itemExtent: 32,
|
||||
onSelectedItemChanged: (int index) {
|
||||
controller.setCountry(countryOptions[index]);
|
||||
box.write(BoxName.countryCode,
|
||||
countryOptions[index]); // Save in English
|
||||
},
|
||||
children: List.generate(
|
||||
countryOptions.length,
|
||||
(index) => Center(
|
||||
child: Text(
|
||||
countryOptions[index]
|
||||
.tr, // Display translated if not English
|
||||
style: AppStyle.title,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
MyElevatedButton(
|
||||
title: 'Select Country'.tr, // Use translated text for button
|
||||
onPressed: () async {
|
||||
loginController.saveCountryCode(controller.selectedCountry
|
||||
.toString()); // No conversion needed
|
||||
box.write(
|
||||
BoxName.countryCode, //
|
||||
controller.selectedCountry); // Already saved in English
|
||||
Get.snackbar(controller.selectedCountry.toString().tr, '',
|
||||
backgroundColor: AppColor.greenColor);
|
||||
// Get.back();//
|
||||
// Get.back();
|
||||
},
|
||||
)
|
||||
],
|
||||
)),
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
157
lib/views/home/profile/profile_captain.dart
Normal file
157
lib/views/home/profile/profile_captain.dart
Normal file
@@ -0,0 +1,157 @@
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:Intaleq/constant/box_name.dart';
|
||||
import 'package:Intaleq/constant/style.dart';
|
||||
import 'package:Intaleq/controller/profile/captain_profile_controller.dart';
|
||||
import 'package:Intaleq/main.dart';
|
||||
import 'package:Intaleq/views/widgets/elevated_btn.dart';
|
||||
import 'package:Intaleq/views/widgets/my_scafold.dart';
|
||||
|
||||
import '../../../constant/api_key.dart';
|
||||
import '../../widgets/my_textField.dart';
|
||||
|
||||
class ProfileCaptain extends StatelessWidget {
|
||||
const ProfileCaptain({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Get.put(CaptainProfileController());
|
||||
return MyScafolld(
|
||||
title: 'My Profile'.tr,
|
||||
body: [
|
||||
GetBuilder<CaptainProfileController>(
|
||||
builder: (controller) => Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: SingleChildScrollView(
|
||||
child: Center(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
CircleAvatar(
|
||||
radius: Get.width * 0.26,
|
||||
backgroundColor: Colors.white,
|
||||
backgroundImage: CachedNetworkImageProvider(
|
||||
'${AK.serverPHP}/portrate_captain_image/${box.read(BoxName.driverID)}.jpg',
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8.0),
|
||||
Text(
|
||||
box.read(BoxName.nameDriver) +
|
||||
' ' +
|
||||
box.read(BoxName.lastNameDriver).toString(),
|
||||
style: AppStyle.title),
|
||||
const SizedBox(height: 8.0),
|
||||
Text('${'Email is'.tr} :${box.read(BoxName.emailDriver)}',
|
||||
style: AppStyle.title),
|
||||
const SizedBox(height: 8.0),
|
||||
Text(
|
||||
'${'Phone Number is'.tr} :${box.read(BoxName.phoneDriver)}',
|
||||
style: AppStyle.title),
|
||||
const SizedBox(height: 8.0),
|
||||
Text(
|
||||
'${'Date of Birth is'.tr} :${box.read(BoxName.dobDriver)}',
|
||||
style: AppStyle.title),
|
||||
const SizedBox(height: 8.0),
|
||||
Text('${'Sex is '.tr}:${box.read(BoxName.sexDriver)}',
|
||||
style: AppStyle.title),
|
||||
const SizedBox(height: 8.0),
|
||||
const Divider(
|
||||
// height: 2,
|
||||
endIndent: 1,
|
||||
indent: 2,
|
||||
thickness: 2,
|
||||
),
|
||||
const SizedBox(height: 8.0),
|
||||
Text('Car Details'.tr, style: AppStyle.headTitle2),
|
||||
const SizedBox(height: 8.0),
|
||||
Text('${'VIN is'.tr} :${box.read(BoxName.vin)}',
|
||||
style: AppStyle.title),
|
||||
const SizedBox(height: 8.0),
|
||||
Text('${'Color is '.tr} :${box.read(BoxName.color)}',
|
||||
style: AppStyle.title),
|
||||
const SizedBox(height: 8.0),
|
||||
Text(
|
||||
'${'Car Plate is '.tr} :${box.read(BoxName.carPlate)}',
|
||||
style: AppStyle.title),
|
||||
const SizedBox(height: 8.0),
|
||||
Text('${'Make is '.tr}:${box.read(BoxName.make)}',
|
||||
style: AppStyle.title),
|
||||
const SizedBox(height: 8.0),
|
||||
Text('${'Model is'.tr} :${box.read(BoxName.model)}',
|
||||
style: AppStyle.title),
|
||||
const SizedBox(height: 8.0),
|
||||
Text('${'Year is'.tr} :${box.read(BoxName.year)}',
|
||||
style: AppStyle.title),
|
||||
const SizedBox(height: 8.0),
|
||||
Text(
|
||||
'${'Expiration Date '.tr} :${box.read(BoxName.expirationDate)}',
|
||||
style: AppStyle.title),
|
||||
const SizedBox(height: 8.0),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
isleading: true,
|
||||
action: GetBuilder<CaptainProfileController>(
|
||||
builder: (controller) => IconButton(
|
||||
onPressed: () {
|
||||
Get.defaultDialog(
|
||||
title: 'Edit Your data'.tr,
|
||||
titleStyle: AppStyle.title,
|
||||
content: SizedBox(
|
||||
height: Get.height * .4,
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
MyTextForm(
|
||||
controller: controller.vin,
|
||||
hint: 'write vin for your car'.tr,
|
||||
label: 'VIN'.tr,
|
||||
type: TextInputType.emailAddress,
|
||||
),
|
||||
MyTextForm(
|
||||
controller: controller.color,
|
||||
hint: 'write Color for your car'.tr,
|
||||
label: 'Color'.tr,
|
||||
type: TextInputType.emailAddress,
|
||||
),
|
||||
MyTextForm(
|
||||
controller: controller.make,
|
||||
hint: 'write Make for your car'.tr,
|
||||
label: 'Make'.tr,
|
||||
type: TextInputType.emailAddress,
|
||||
),
|
||||
MyTextForm(
|
||||
controller: controller.model,
|
||||
hint: 'write Model for your car'.tr,
|
||||
label: 'Model'.tr,
|
||||
type: TextInputType.emailAddress,
|
||||
),
|
||||
MyTextForm(
|
||||
controller: controller.year,
|
||||
hint: 'write Year for your car'.tr,
|
||||
label: 'Year'.tr,
|
||||
type: TextInputType.number,
|
||||
),
|
||||
MyTextForm(
|
||||
controller: controller.expirationDate,
|
||||
hint: 'write Expiration Date for your car'.tr,
|
||||
label: 'Expiration Date'.tr,
|
||||
type: TextInputType.datetime),
|
||||
MyElevatedButton(
|
||||
title: 'Update'.tr,
|
||||
onPressed: () => controller.updateFields())
|
||||
],
|
||||
),
|
||||
),
|
||||
));
|
||||
},
|
||||
icon: const Icon(Icons.edit),
|
||||
),
|
||||
));
|
||||
}
|
||||
}
|
||||
206
lib/views/home/profile/promos_passenger_page.dart
Normal file
206
lib/views/home/profile/promos_passenger_page.dart
Normal file
@@ -0,0 +1,206 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:Intaleq/controller/home/profile/promos_controller.dart';
|
||||
import 'package:Intaleq/views/widgets/my_scafold.dart';
|
||||
import 'dart:ui'; // لاستخدامه في الفاصل
|
||||
|
||||
import '../../../constant/colors.dart';
|
||||
import '../../../constant/style.dart';
|
||||
import '../../widgets/mycircular.dart';
|
||||
import 'package:dotted_line/dotted_line.dart'; // ستحتاج لإضافة هذا الباكج
|
||||
|
||||
// ملاحظة: ستحتاج لإضافة هذا الباكج إلى ملف pubspec.yaml الخاص بك
|
||||
// flutter pub add dotted_line
|
||||
|
||||
// --- الويدجت الرئيسية بالتصميم الجديد ---
|
||||
class PromosPassengerPage extends StatelessWidget {
|
||||
const PromosPassengerPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Get.put(PromosController()); // نفس منطقك القديم
|
||||
return MyScafolld(
|
||||
title: "Today's Promos".tr, // عنوان أكثر جاذبية
|
||||
isleading: true,
|
||||
body: [
|
||||
GetBuilder<PromosController>(
|
||||
builder: (controller) {
|
||||
if (controller.isLoading) {
|
||||
return const MyCircularProgressIndicator();
|
||||
}
|
||||
if (controller.promoList.isEmpty) {
|
||||
return Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const Icon(Icons.local_offer_outlined,
|
||||
size: 80, color: Colors.grey),
|
||||
const SizedBox(height: 16),
|
||||
Text("No promos available right now.".tr,
|
||||
style: AppStyle.headTitle2),
|
||||
Text("Check back later for new offers!".tr,
|
||||
style: AppStyle.subtitle),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
return ListView.builder(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
itemCount: controller.promoList.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
final promo = controller.promoList[index];
|
||||
// --- استدعاء ويدجت الكوبون الجديدة ---
|
||||
return _buildPromoTicket(context, promo);
|
||||
},
|
||||
);
|
||||
},
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
// --- ويدجت بناء كوبون الخصم ---
|
||||
Widget _buildPromoTicket(BuildContext context, Map<String, dynamic> promo) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(bottom: 20.0),
|
||||
child: Container(
|
||||
height: 140, // ارتفاع ثابت للكوبون
|
||||
decoration: BoxDecoration(
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withOpacity(0.15),
|
||||
blurRadius: 12,
|
||||
offset: const Offset(0, 6),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: ClipPath(
|
||||
clipper: TicketClipper(), // Clipper مخصص لرسم شكل التذكرة
|
||||
child: Container(
|
||||
color: AppColor.secondaryColor,
|
||||
child: Row(
|
||||
children: [
|
||||
// --- الجزء الأيسر: تفاصيل العرض ---
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
promo['description'],
|
||||
style: AppStyle.headTitle.copyWith(fontSize: 18),
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
const Spacer(),
|
||||
Row(
|
||||
children: [
|
||||
const Icon(Icons.calendar_today_outlined,
|
||||
size: 14, color: Colors.grey),
|
||||
const SizedBox(width: 6),
|
||||
Text(
|
||||
'${'Valid Until:'.tr} ${promo['validity_end_date']}',
|
||||
style: AppStyle.subtitle
|
||||
.copyWith(fontSize: 12, color: Colors.grey),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
// --- الفاصل المنقط ---
|
||||
SizedBox(
|
||||
height: 110,
|
||||
child: DottedLine(
|
||||
direction: Axis.vertical,
|
||||
lineThickness: 2.0,
|
||||
dashLength: 8.0,
|
||||
dashColor: AppColor.writeColor.withOpacity(0.2),
|
||||
dashGapLength: 4.0,
|
||||
),
|
||||
),
|
||||
// --- الجزء الأيمن: كود الخصم وزر النسخ ---
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
// --- نفس منطقك القديم للنسخ ---
|
||||
Clipboard.setData(
|
||||
ClipboardData(text: promo['promo_code']));
|
||||
Get.snackbar(
|
||||
'Promo Copied!'.tr,
|
||||
'${'Code'.tr} ${promo['promo_code']} ${'copied to clipboard'.tr}',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
backgroundColor: AppColor.greenColor,
|
||||
colorText: Colors.white,
|
||||
);
|
||||
},
|
||||
child: Container(
|
||||
color: AppColor.primaryColor.withOpacity(0.1),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
'CODE'.tr,
|
||||
style: AppStyle.subtitle.copyWith(
|
||||
color: AppColor.primaryColor, letterSpacing: 2),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
promo['promo_code'],
|
||||
style: AppStyle.headTitle.copyWith(
|
||||
fontSize: 24, color: AppColor.primaryColor),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const Icon(Icons.copy,
|
||||
size: 14, color: AppColor.primaryColor),
|
||||
const SizedBox(width: 4),
|
||||
Text('Copy'.tr,
|
||||
style: AppStyle.subtitle
|
||||
.copyWith(color: AppColor.primaryColor)),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// --- كلاس مخصص لرسم شكل التذكرة ---
|
||||
class TicketClipper extends CustomClipper<Path> {
|
||||
@override
|
||||
Path getClip(Size size) {
|
||||
Path path = Path();
|
||||
|
||||
path.lineTo(0.0, size.height);
|
||||
path.lineTo(size.width, size.height);
|
||||
path.lineTo(size.width, 0.0);
|
||||
|
||||
double radius = 10;
|
||||
path.addOval(
|
||||
Rect.fromCircle(center: Offset(0, size.height / 2), radius: radius));
|
||||
path.addOval(Rect.fromCircle(
|
||||
center: Offset(size.width, size.height / 2), radius: radius));
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
@override
|
||||
bool shouldReclip(CustomClipper<Path> oldClipper) => false;
|
||||
}
|
||||
88
lib/views/home/profile/taarif_page.dart
Normal file
88
lib/views/home/profile/taarif_page.dart
Normal file
@@ -0,0 +1,88 @@
|
||||
import 'package:Intaleq/constant/box_name.dart';
|
||||
import 'package:Intaleq/main.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:Intaleq/constant/style.dart';
|
||||
import 'package:Intaleq/views/widgets/my_scafold.dart';
|
||||
|
||||
class TaarifPage extends StatelessWidget {
|
||||
const TaarifPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MyScafolld(isleading: true, title: 'Tariffs'.tr, body: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 4),
|
||||
child: ListView(
|
||||
// mainAxisAlignment: MainAxisAlignment.start,
|
||||
// crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
clipBehavior: Clip.hardEdge,
|
||||
children: [
|
||||
Table(
|
||||
defaultVerticalAlignment: TableCellVerticalAlignment.middle,
|
||||
border: TableBorder.symmetric(),
|
||||
textBaseline: TextBaseline.alphabetic,
|
||||
children: [
|
||||
TableRow(
|
||||
// decoration: AppStyle.boxDecoration,
|
||||
children: [
|
||||
Text('Minimum fare'.tr, style: AppStyle.title),
|
||||
box.read(BoxName.countryCode) == 'Jordan'
|
||||
? Text('1 ${'JOD'.tr}', style: AppStyle.title)
|
||||
: Text('20 ${'LE'.tr}', style: AppStyle.title),
|
||||
],
|
||||
),
|
||||
TableRow(
|
||||
children: [
|
||||
Text('Maximum fare'.tr, style: AppStyle.title),
|
||||
box.read(BoxName.countryCode) == 'Jordan'
|
||||
? Text('200 ${'JOD'.tr}', style: AppStyle.title)
|
||||
: Text('15000 ${'LE'.tr}', style: AppStyle.title),
|
||||
],
|
||||
),
|
||||
TableRow(
|
||||
children: [
|
||||
Text('Flag-down fee'.tr, style: AppStyle.title),
|
||||
box.read(BoxName.countryCode) == 'Jordan'
|
||||
? Text('0.47 ${'JOD'.tr}', style: AppStyle.title)
|
||||
: Text('15 ${'LE'.tr}', style: AppStyle.title),
|
||||
],
|
||||
),
|
||||
TableRow(
|
||||
children: [
|
||||
box.read(BoxName.countryCode) == 'Jordan'
|
||||
? Text('0.05 ${'JOD'.tr}/min and 0.21 ${'JOD'.tr}/km',
|
||||
style: AppStyle.title)
|
||||
: Text('1 ${'LE'.tr}/min and 4 ${'LE'.tr}/km',
|
||||
style: AppStyle.title),
|
||||
Text('Including Tax'.tr, style: AppStyle.title),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Text('BookingFee'.tr, style: AppStyle.headTitle2),
|
||||
const SizedBox(height: 10),
|
||||
Text('10%', style: AppStyle.title),
|
||||
const SizedBox(height: 20),
|
||||
Text('Morning'.tr, style: AppStyle.headTitle2),
|
||||
const SizedBox(height: 10),
|
||||
Text(
|
||||
'from 07:30 till 10:30 (Thursday, Friday, Saturday, Monday)'.tr,
|
||||
style: AppStyle.title),
|
||||
const SizedBox(height: 20),
|
||||
Text('Evening'.tr, style: AppStyle.headTitle2),
|
||||
const SizedBox(height: 10),
|
||||
Text(
|
||||
'from 12:00 till 15:00 (Thursday, Friday, Saturday, Monday)'.tr,
|
||||
style: AppStyle.title),
|
||||
const SizedBox(height: 20),
|
||||
Text('Night'.tr, style: AppStyle.headTitle2),
|
||||
const SizedBox(height: 10),
|
||||
Text('from 23:59 till 05:30'.tr, style: AppStyle.title),
|
||||
],
|
||||
),
|
||||
),
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user