first commit
This commit is contained in:
71
siro_rider/lib/views/home/profile/budgets_ads.dart
Normal file
71
siro_rider/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:siro_rider/constant/colors.dart';
|
||||
import 'package:siro_rider/constant/style.dart';
|
||||
import 'package:siro_rider/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,
|
||||
),
|
||||
],
|
||||
),
|
||||
)),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
229
siro_rider/lib/views/home/profile/complaint_page.dart
Normal file
229
siro_rider/lib/views/home/profile/complaint_page.dart
Normal file
@@ -0,0 +1,229 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:siro_rider/constant/style.dart';
|
||||
import 'package:siro_rider/controller/home/profile/complaint_controller.dart';
|
||||
import 'package:siro_rider/views/widgets/my_scafold.dart'; // سنستخدم السكافولد الخاص بك
|
||||
import 'package:siro_rider/views/widgets/mycircular.dart';
|
||||
import 'package:siro_rider/views/widgets/mydialoug.dart';
|
||||
import 'package:siro_rider/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 && controller.feedBack.isEmpty) {
|
||||
// عرض التحميل المبدئي فقط
|
||||
return const MyCircularProgressIndicator();
|
||||
}
|
||||
return Stack(
|
||||
children: [
|
||||
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,
|
||||
validator: (value) {
|
||||
if (value == null || value.isEmpty) {
|
||||
return 'Please enter a description of the issue.'
|
||||
.tr;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
),
|
||||
),
|
||||
|
||||
// --- 2. بطاقة إرفاق التسجيل الصوتي ---
|
||||
_buildSectionCard(
|
||||
title: '2. Attach Recorded Audio (Optional)'.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.redColor),
|
||||
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?['body']
|
||||
?.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 {
|
||||
// --- تعديل: استدعاء الدالة الجديدة فقط ---
|
||||
await controller.submitComplaintToServer();
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 24), // مسافة إضافية بالأسفل
|
||||
],
|
||||
),
|
||||
),
|
||||
// --- عرض مؤشر التحميل فوق كل شيء ---
|
||||
if (controller.isLoading)
|
||||
Container(
|
||||
color: Colors.black.withOpacity(0.5),
|
||||
child: const MyCircularProgressIndicator(),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
// --- ويدجت مساعدة لبناء البطاقات ---
|
||||
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)),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
599
siro_rider/lib/views/home/profile/order_history.dart
Normal file
599
siro_rider/lib/views/home/profile/order_history.dart
Normal file
@@ -0,0 +1,599 @@
|
||||
import 'dart:math' as math;
|
||||
import 'dart:typed_data';
|
||||
|
||||
import 'package:siro_rider/env/env.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:intaleq_maps/intaleq_maps.dart';
|
||||
|
||||
import '../../../constant/colors.dart';
|
||||
import '../../../constant/style.dart';
|
||||
import '../../../controller/functions/launch.dart';
|
||||
import '../../../controller/home/profile/order_history_controller.dart';
|
||||
import '../../widgets/my_scafold.dart';
|
||||
import '../../widgets/mycircular.dart';
|
||||
|
||||
// ─────────────────────────────────────────────────────────────────────────────
|
||||
// Main Screen
|
||||
// ─────────────────────────────────────────────────────────────────────────────
|
||||
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.route_outlined,
|
||||
size: 80, color: AppColor.writeColor.withOpacity(0.3)),
|
||||
const SizedBox(height: 16),
|
||||
Text('No trip history found'.tr,
|
||||
style: AppStyle.headTitle2),
|
||||
const SizedBox(height: 6),
|
||||
Text('Your past trips will appear here.'.tr,
|
||||
style: AppStyle.subtitle),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
return ListView.separated(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 20),
|
||||
itemCount: controller.orderHistoryListPassenger.length,
|
||||
separatorBuilder: (_, __) => const SizedBox(height: 14),
|
||||
itemBuilder: (context, index) {
|
||||
final ride = controller.orderHistoryListPassenger[index];
|
||||
return _HistoryCard(
|
||||
key: ValueKey(ride['id'] ?? index),
|
||||
ride: ride,
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// ─────────────────────────────────────────────────────────────────────────────
|
||||
// Coordinate helpers
|
||||
// ─────────────────────────────────────────────────────────────────────────────
|
||||
LatLng _parseLatLng(String raw, LatLng fallback) {
|
||||
try {
|
||||
final parts = raw.split(',');
|
||||
return LatLng(double.parse(parts[0]), double.parse(parts[1]));
|
||||
} catch (_) {
|
||||
return fallback;
|
||||
}
|
||||
}
|
||||
|
||||
const LatLng _kDamascus = LatLng(33.5, 36.3);
|
||||
|
||||
// ─────────────────────────────────────────────────────────────────────────────
|
||||
// Lightweight card — NO native map in the list
|
||||
// ─────────────────────────────────────────────────────────────────────────────
|
||||
class _HistoryCard extends StatelessWidget {
|
||||
final Map<String, dynamic> ride;
|
||||
const _HistoryCard({Key? key, required this.ride}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final start = _parseLatLng(ride['start_location'] ?? '', _kDamascus);
|
||||
final end = _parseLatLng(ride['end_location'] ?? '', _kDamascus);
|
||||
final status = ride['status'] ?? '';
|
||||
|
||||
return Material(
|
||||
color: Colors.transparent,
|
||||
child: InkWell(
|
||||
onTap: () => _openDetail(context, ride, start, end),
|
||||
borderRadius: BorderRadius.circular(18),
|
||||
child: Ink(
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.secondaryColor,
|
||||
borderRadius: BorderRadius.circular(18),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withOpacity(0.12),
|
||||
blurRadius: 10,
|
||||
offset: const Offset(0, 4),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// ── Lightweight route preview (pure Flutter, zero native cost) ──
|
||||
ClipRRect(
|
||||
borderRadius: const BorderRadius.only(
|
||||
topLeft: Radius.circular(18),
|
||||
topRight: Radius.circular(18),
|
||||
),
|
||||
child: SizedBox(
|
||||
height: 130,
|
||||
width: double.infinity,
|
||||
child: CustomPaint(
|
||||
painter: _RoutePainter(start: start, end: end),
|
||||
child: Align(
|
||||
alignment: Alignment.bottomRight,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 8, vertical: 4),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.black.withOpacity(0.45),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
const Icon(Icons.map_outlined,
|
||||
color: Colors.white, size: 13),
|
||||
const SizedBox(width: 4),
|
||||
Text('View Map'.tr,
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 11,
|
||||
fontWeight: FontWeight.w600)),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
// ── Details ──────────────────────────────────────────────────
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(14, 10, 14, 14),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Icon(Icons.access_time_rounded,
|
||||
size: 14,
|
||||
color: AppColor.writeColor.withOpacity(0.5)),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
'${ride['date']} · ${ride['time']}',
|
||||
style: AppStyle.subtitle.copyWith(
|
||||
fontSize: 12,
|
||||
color: AppColor.writeColor.withOpacity(0.6)),
|
||||
),
|
||||
],
|
||||
),
|
||||
_StatusChip(status: status),
|
||||
],
|
||||
),
|
||||
const Divider(height: 16),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text('Total Price'.tr,
|
||||
style: AppStyle.title.copyWith(fontSize: 15)),
|
||||
Text(
|
||||
'${ride['price']} ${'SYP'.tr}',
|
||||
style: AppStyle.headTitle.copyWith(
|
||||
fontSize: 20, color: AppColor.primaryColor),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void _openDetail(BuildContext context, Map<String, dynamic> ride,
|
||||
LatLng start, LatLng end) {
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
isScrollControlled: true,
|
||||
backgroundColor: Colors.transparent,
|
||||
builder: (_) => _RideDetailSheet(ride: ride, start: start, end: end),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// ─────────────────────────────────────────────────────────────────────────────
|
||||
// Pure-Flutter route painter — grid background + animated dashed line
|
||||
// ─────────────────────────────────────────────────────────────────────────────
|
||||
class _RoutePainter extends CustomPainter {
|
||||
final LatLng start;
|
||||
final LatLng end;
|
||||
|
||||
const _RoutePainter({required this.start, required this.end});
|
||||
|
||||
@override
|
||||
void paint(Canvas canvas, Size size) {
|
||||
// Background gradient
|
||||
final bgPaint = Paint()
|
||||
..shader = LinearGradient(
|
||||
colors: [
|
||||
AppColor.primaryColor.withOpacity(0.08),
|
||||
AppColor.primaryColor.withOpacity(0.18),
|
||||
],
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
).createShader(Rect.fromLTWH(0, 0, size.width, size.height));
|
||||
canvas.drawRect(Rect.fromLTWH(0, 0, size.width, size.height), bgPaint);
|
||||
|
||||
// Subtle grid
|
||||
final gridPaint = Paint()
|
||||
..color = AppColor.primaryColor.withOpacity(0.06)
|
||||
..strokeWidth = 1;
|
||||
const step = 20.0;
|
||||
for (double x = 0; x < size.width; x += step) {
|
||||
canvas.drawLine(Offset(x, 0), Offset(x, size.height), gridPaint);
|
||||
}
|
||||
for (double y = 0; y < size.height; y += step) {
|
||||
canvas.drawLine(Offset(0, y), Offset(size.width, y), gridPaint);
|
||||
}
|
||||
|
||||
// Map lat/lng to canvas — simple linear projection
|
||||
final minLat = math.min(start.latitude, end.latitude);
|
||||
final maxLat = math.max(start.latitude, end.latitude);
|
||||
final minLng = math.min(start.longitude, end.longitude);
|
||||
final maxLng = math.max(start.longitude, end.longitude);
|
||||
|
||||
final latRange = maxLat - minLat;
|
||||
final lngRange = maxLng - minLng;
|
||||
|
||||
final pad = 32.0;
|
||||
|
||||
Offset project(LatLng p) {
|
||||
double x, y;
|
||||
if (lngRange < 0.0005) {
|
||||
x = size.width / 2;
|
||||
} else {
|
||||
x = pad + ((p.longitude - minLng) / lngRange) * (size.width - 2 * pad);
|
||||
}
|
||||
if (latRange < 0.0005) {
|
||||
y = size.height / 2;
|
||||
} else {
|
||||
// Invert y (latitude grows up, canvas grows down)
|
||||
y = size.height -
|
||||
pad -
|
||||
((p.latitude - minLat) / latRange) * (size.height - 2 * pad);
|
||||
}
|
||||
return Offset(x, y);
|
||||
}
|
||||
|
||||
final startPt = project(start);
|
||||
final endPt = project(end);
|
||||
|
||||
// Dashed route line
|
||||
final linePaint = Paint()
|
||||
..color = AppColor.primaryColor
|
||||
..strokeWidth = 2.5
|
||||
..strokeCap = StrokeCap.round
|
||||
..style = PaintingStyle.stroke;
|
||||
|
||||
_drawDashedLine(canvas, startPt, endPt, linePaint, 8, 5);
|
||||
|
||||
// Glow behind markers
|
||||
final glowPaint = Paint()
|
||||
..color = AppColor.primaryColor.withOpacity(0.2)
|
||||
..maskFilter = const MaskFilter.blur(BlurStyle.normal, 8);
|
||||
canvas.drawCircle(startPt, 14, glowPaint);
|
||||
canvas.drawCircle(endPt, 14, glowPaint);
|
||||
|
||||
// Start dot (A)
|
||||
_drawMarker(canvas, startPt, AppColor.primaryColor, 'A');
|
||||
|
||||
// End dot (B)
|
||||
_drawMarker(canvas, endPt, AppColor.redColor, 'B');
|
||||
}
|
||||
|
||||
void _drawDashedLine(Canvas canvas, Offset p1, Offset p2, Paint paint,
|
||||
double dashLen, double gapLen) {
|
||||
final dx = p2.dx - p1.dx;
|
||||
final dy = p2.dy - p1.dy;
|
||||
final dist = math.sqrt(dx * dx + dy * dy);
|
||||
if (dist == 0) return;
|
||||
final ux = dx / dist;
|
||||
final uy = dy / dist;
|
||||
double traveled = 0;
|
||||
bool drawing = true;
|
||||
while (traveled < dist) {
|
||||
final segLen = drawing ? dashLen : gapLen;
|
||||
final next = math.min(traveled + segLen, dist);
|
||||
if (drawing) {
|
||||
canvas.drawLine(
|
||||
Offset(p1.dx + ux * traveled, p1.dy + uy * traveled),
|
||||
Offset(p1.dx + ux * next, p1.dy + uy * next),
|
||||
paint,
|
||||
);
|
||||
}
|
||||
traveled = next;
|
||||
drawing = !drawing;
|
||||
}
|
||||
}
|
||||
|
||||
void _drawMarker(Canvas canvas, Offset center, Color color, String label) {
|
||||
// Outer ring
|
||||
canvas.drawCircle(center, 12, Paint()..color = color.withOpacity(0.25));
|
||||
// Solid circle
|
||||
canvas.drawCircle(center, 8, Paint()..color = color);
|
||||
// White inner
|
||||
canvas.drawCircle(center, 4, Paint()..color = Colors.white);
|
||||
// Label text
|
||||
final tp = TextPainter(
|
||||
text: TextSpan(
|
||||
text: label,
|
||||
style: TextStyle(
|
||||
color: color, fontSize: 7, fontWeight: FontWeight.w900)),
|
||||
textDirection: TextDirection.ltr,
|
||||
)..layout();
|
||||
tp.paint(canvas, center - Offset(tp.width / 2, tp.height / 2));
|
||||
}
|
||||
|
||||
@override
|
||||
bool shouldRepaint(_RoutePainter old) => old.start != start || old.end != end;
|
||||
}
|
||||
|
||||
// ─────────────────────────────────────────────────────────────────────────────
|
||||
// Status chip
|
||||
// ─────────────────────────────────────────────────────────────────────────────
|
||||
class _StatusChip extends StatelessWidget {
|
||||
final String status;
|
||||
const _StatusChip({required this.status});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Color color;
|
||||
IconData icon;
|
||||
|
||||
if (status == 'Canceled'.tr) {
|
||||
color = AppColor.redColor;
|
||||
icon = Icons.cancel_outlined;
|
||||
} else if (status == 'Finished'.tr) {
|
||||
color = AppColor.greenColor;
|
||||
icon = Icons.check_circle_outline;
|
||||
} else {
|
||||
color = AppColor.yellowColor;
|
||||
icon = Icons.hourglass_empty_rounded;
|
||||
}
|
||||
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
|
||||
decoration: BoxDecoration(
|
||||
color: color.withOpacity(0.12),
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
border: Border.all(color: color.withOpacity(0.3), width: 1),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(icon, color: color, size: 13),
|
||||
const SizedBox(width: 4),
|
||||
Text(status,
|
||||
style: AppStyle.subtitle.copyWith(
|
||||
color: color, fontWeight: FontWeight.bold, fontSize: 11)),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// ─────────────────────────────────────────────────────────────────────────────
|
||||
// Detail bottom sheet — ONE MapLibre instance, only when user requests it
|
||||
// ─────────────────────────────────────────────────────────────────────────────
|
||||
class _RideDetailSheet extends StatefulWidget {
|
||||
final Map<String, dynamic> ride;
|
||||
final LatLng start;
|
||||
final LatLng end;
|
||||
const _RideDetailSheet(
|
||||
{required this.ride, required this.start, required this.end});
|
||||
|
||||
@override
|
||||
State<_RideDetailSheet> createState() => _RideDetailSheetState();
|
||||
}
|
||||
|
||||
class _RideDetailSheetState extends State<_RideDetailSheet> {
|
||||
IntaleqMapController? _mc;
|
||||
Set<Marker> _markers = {};
|
||||
Set<Polyline> _polylines = {};
|
||||
|
||||
LatLngBounds? get _bounds {
|
||||
final latDiff = (widget.start.latitude - widget.end.latitude).abs();
|
||||
final lngDiff = (widget.start.longitude - widget.end.longitude).abs();
|
||||
if (latDiff < 0.0005 && lngDiff < 0.0005) return null;
|
||||
return LatLngBounds(
|
||||
northeast: LatLng(
|
||||
math.max(widget.start.latitude, widget.end.latitude),
|
||||
math.max(widget.start.longitude, widget.end.longitude),
|
||||
),
|
||||
southwest: LatLng(
|
||||
math.min(widget.start.latitude, widget.end.latitude),
|
||||
math.min(widget.start.longitude, widget.end.longitude),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void _onMapCreated(IntaleqMapController c) => _mc = c;
|
||||
|
||||
Future<void> _onStyleLoaded() async {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
||||
await Future.delayed(const Duration(milliseconds: 400));
|
||||
if (!mounted || _mc == null) return;
|
||||
await _draw();
|
||||
});
|
||||
}
|
||||
|
||||
Future<void> _draw() async {
|
||||
if (!mounted) return;
|
||||
|
||||
setState(() {
|
||||
_polylines = {
|
||||
Polyline(
|
||||
polylineId: const PolylineId('route'),
|
||||
points: [widget.start, widget.end],
|
||||
color: AppColor.primaryColor,
|
||||
width: 4,
|
||||
),
|
||||
};
|
||||
|
||||
_markers = {
|
||||
Marker(
|
||||
markerId: const MarkerId('start'),
|
||||
position: widget.start,
|
||||
icon: InlqBitmap.fromAsset('assets/images/A.png'),
|
||||
anchor: const Offset(0.5, 1.0),
|
||||
),
|
||||
Marker(
|
||||
markerId: const MarkerId('end'),
|
||||
position: widget.end,
|
||||
icon: InlqBitmap.fromAsset('assets/images/b.png'),
|
||||
anchor: const Offset(0.5, 1.0),
|
||||
),
|
||||
};
|
||||
});
|
||||
|
||||
final b = _bounds;
|
||||
if (b != null) {
|
||||
await _mc?.animateCamera(CameraUpdate.newLatLngBounds(b,
|
||||
left: 60, top: 60, right: 60, bottom: 60));
|
||||
} else {
|
||||
await _mc?.animateCamera(CameraUpdate.newLatLngZoom(widget.start, 14));
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final ride = widget.ride;
|
||||
final center = LatLng(
|
||||
(widget.start.latitude + widget.end.latitude) / 2,
|
||||
(widget.start.longitude + widget.end.longitude) / 2,
|
||||
);
|
||||
|
||||
return DraggableScrollableSheet(
|
||||
initialChildSize: 0.88,
|
||||
minChildSize: 0.5,
|
||||
maxChildSize: 0.95,
|
||||
builder: (_, scrollController) => Container(
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.secondaryColor,
|
||||
borderRadius: const BorderRadius.vertical(top: Radius.circular(24)),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
// Handle
|
||||
Container(
|
||||
margin: const EdgeInsets.symmetric(vertical: 10),
|
||||
width: 40,
|
||||
height: 4,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.writeColor.withOpacity(0.2),
|
||||
borderRadius: BorderRadius.circular(2),
|
||||
),
|
||||
),
|
||||
|
||||
// Map — only ONE instance, created on demand
|
||||
Expanded(
|
||||
child: ClipRRect(
|
||||
borderRadius: const BorderRadius.only(
|
||||
topLeft: Radius.circular(16),
|
||||
topRight: Radius.circular(16),
|
||||
),
|
||||
child: IntaleqMap(
|
||||
apiKey: Env.mapSaasKey,
|
||||
styleUrl: Get.isDarkMode
|
||||
? 'assets/style_dark.json'
|
||||
: 'assets/style.json',
|
||||
initialCameraPosition:
|
||||
CameraPosition(target: center, zoom: 12),
|
||||
onMapCreated: (c) {
|
||||
_mc = c;
|
||||
_onStyleLoaded();
|
||||
},
|
||||
myLocationEnabled: false,
|
||||
markers: _markers,
|
||||
polylines: _polylines,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
// Trip info strip
|
||||
Container(
|
||||
padding: const EdgeInsets.fromLTRB(20, 14, 20, 20),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text('${ride['date']} · ${ride['time']}',
|
||||
style: AppStyle.subtitle.copyWith(
|
||||
fontSize: 12,
|
||||
color:
|
||||
AppColor.writeColor.withOpacity(0.55))),
|
||||
const SizedBox(height: 2),
|
||||
Text('${ride['price']} ${'SYP'.tr}',
|
||||
style: AppStyle.headTitle.copyWith(
|
||||
fontSize: 22, color: AppColor.primaryColor)),
|
||||
],
|
||||
),
|
||||
_StatusChip(status: ride['status'] ?? ''),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 14),
|
||||
// Open in Google Maps
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
child: ElevatedButton.icon(
|
||||
onPressed: () {
|
||||
final url =
|
||||
'https://www.google.com/maps/dir/${ride['start_location']}/${ride['end_location']}/';
|
||||
showInBrowser(url);
|
||||
},
|
||||
icon: const Icon(Icons.open_in_new, size: 16),
|
||||
label: Text('Open in Google Maps'.tr),
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: AppColor.primaryColor,
|
||||
foregroundColor: Colors.white,
|
||||
padding: const EdgeInsets.symmetric(vertical: 13),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12)),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
1065
siro_rider/lib/views/home/profile/passenger_profile_page.dart
Normal file
1065
siro_rider/lib/views/home/profile/passenger_profile_page.dart
Normal file
File diff suppressed because it is too large
Load Diff
157
siro_rider/lib/views/home/profile/profile_captain.dart
Normal file
157
siro_rider/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:siro_rider/constant/box_name.dart';
|
||||
import 'package:siro_rider/constant/style.dart';
|
||||
import 'package:siro_rider/controller/profile/captain_profile_controller.dart';
|
||||
import 'package:siro_rider/main.dart';
|
||||
import 'package:siro_rider/views/widgets/elevated_btn.dart';
|
||||
import 'package:siro_rider/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
siro_rider/lib/views/home/profile/promos_passenger_page.dart
Normal file
206
siro_rider/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:siro_rider/controller/home/profile/promos_controller.dart';
|
||||
import 'package:siro_rider/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
siro_rider/lib/views/home/profile/taarif_page.dart
Normal file
88
siro_rider/lib/views/home/profile/taarif_page.dart
Normal file
@@ -0,0 +1,88 @@
|
||||
import 'package:siro_rider/constant/box_name.dart';
|
||||
import 'package:siro_rider/main.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:siro_rider/constant/style.dart';
|
||||
import 'package:siro_rider/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