Update: 2026-06-26 02:37:10
This commit is contained in:
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -105,7 +105,7 @@ class RegisterCaptain extends StatelessWidget {
|
|||||||
onTap: onTap,
|
onTap: onTap,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
labelText: label.tr,
|
labelText: label.tr,
|
||||||
hintText: hintText,
|
hintText: hintText?.tr,
|
||||||
prefixIcon:
|
prefixIcon:
|
||||||
icon != null ? Icon(icon, color: AppColor.secondaryColor) : null,
|
icon != null ? Icon(icon, color: AppColor.secondaryColor) : null,
|
||||||
border: OutlineInputBorder(
|
border: OutlineInputBorder(
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ class PassengersCantRegister extends StatelessWidget {
|
|||||||
child: CupertinoTextFormFieldRow(
|
child: CupertinoTextFormFieldRow(
|
||||||
initialValue: passenger['created_at'],
|
initialValue: passenger['created_at'],
|
||||||
readOnly: true,
|
readOnly: true,
|
||||||
placeholder: 'Created At',
|
placeholder: 'Created At'.tr,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
CupertinoFormRow(
|
CupertinoFormRow(
|
||||||
|
|||||||
@@ -1,17 +1,18 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:siro_service/constant/colors.dart';
|
||||||
import 'package:siro_service/controller/mainController/main_controller.dart';
|
import 'package:siro_service/controller/mainController/main_controller.dart';
|
||||||
import 'package:siro_service/views/widgets/my_scafold.dart';
|
import 'package:siro_service/views/widgets/my_scafold.dart';
|
||||||
|
|
||||||
class PassengersPage extends StatelessWidget {
|
class PassengersPage extends StatelessWidget {
|
||||||
PassengersPage({super.key});
|
PassengersPage({super.key});
|
||||||
final MainController mainController = MainController();
|
final MainController mainController = Get.find<MainController>();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return GetBuilder<MainController>(
|
return GetBuilder<MainController>(
|
||||||
builder: (mainController) {
|
builder: (controller) {
|
||||||
final data = _extractPassengerData(mainController);
|
final data = _extractPassengerData(controller);
|
||||||
|
|
||||||
return MyScaffold(
|
return MyScaffold(
|
||||||
title: data != null
|
title: data != null
|
||||||
@@ -20,20 +21,46 @@ class PassengersPage extends StatelessWidget {
|
|||||||
isleading: true,
|
isleading: true,
|
||||||
body: [
|
body: [
|
||||||
if (data != null)
|
if (data != null)
|
||||||
ListView(
|
Container(
|
||||||
children: [
|
color: AppColor.surfaceColor,
|
||||||
_buildPersonalInfoCard(data),
|
child: ListView(
|
||||||
_buildLatestRideCard(data),
|
physics: const BouncingScrollPhysics(),
|
||||||
_buildWalletInfoCard(data),
|
padding: const EdgeInsets.symmetric(vertical: 12),
|
||||||
],
|
children: [
|
||||||
|
_buildPersonalInfoCard(data),
|
||||||
|
_buildCommunicationCard(data),
|
||||||
|
_buildLatestRideCard(data),
|
||||||
|
_buildWalletInfoCard(data),
|
||||||
|
const SizedBox(height: 40),
|
||||||
|
],
|
||||||
|
),
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
Center(
|
Container(
|
||||||
child: Padding(
|
color: AppColor.surfaceColor,
|
||||||
padding: const EdgeInsets.all(24.0),
|
child: Center(
|
||||||
child: Text(
|
child: Padding(
|
||||||
'No passenger data available.'.tr,
|
padding: const EdgeInsets.all(24.0),
|
||||||
style: const TextStyle(fontSize: 18, fontWeight: FontWeight.w500),
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Icon(
|
||||||
|
Icons.person_off_rounded,
|
||||||
|
size: 64,
|
||||||
|
color: AppColor.greyColor.withOpacity(0.5),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 16),
|
||||||
|
Text(
|
||||||
|
'No passenger data available.'.tr,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 18,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
color: AppColor.writeColor,
|
||||||
|
),
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -57,14 +84,46 @@ class PassengersPage extends StatelessWidget {
|
|||||||
Widget _buildPersonalInfoCard(Map data) {
|
Widget _buildPersonalInfoCard(Map data) {
|
||||||
return _buildCard(
|
return _buildCard(
|
||||||
title: 'Personal Information'.tr,
|
title: 'Personal Information'.tr,
|
||||||
|
icon: Icons.person_outline_rounded,
|
||||||
|
iconColor: AppColor.primaryColor,
|
||||||
children: [
|
children: [
|
||||||
_buildInfoRow('Phone'.tr, data['phone']),
|
_buildInfoRow('Phone'.tr, data['phone']),
|
||||||
_buildInfoRow('Email'.tr, data['email']),
|
_buildInfoRow('Email'.tr, data['email']),
|
||||||
_buildInfoRow('Gender'.tr, data['gender']),
|
_buildInfoRow('Gender'.tr, data['gender']),
|
||||||
_buildInfoRow('Birthdate'.tr, data['birthdate']),
|
_buildInfoRow('Birthdate'.tr, data['birthdate']),
|
||||||
// _buildInfoRow('Education'.tr, data['education']),
|
|
||||||
_buildInfoRow('Employment'.tr, data['employmentType']),
|
_buildInfoRow('Employment'.tr, data['employmentType']),
|
||||||
_buildInfoRow('Marital Status'.tr, data['maritalStatus']),
|
_buildInfoRow('Marital Status'.tr, data['maritalStatus'], isLast: true),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildCommunicationCard(Map data) {
|
||||||
|
String phone = data['phone'] ?? '';
|
||||||
|
String name = data['first_name'] ?? '';
|
||||||
|
return _buildCard(
|
||||||
|
title: 'Quick Communication'.tr,
|
||||||
|
icon: Icons.chat_bubble_outline_rounded,
|
||||||
|
iconColor: Colors.teal,
|
||||||
|
children: [
|
||||||
|
_buildCommunicationRow(
|
||||||
|
title: 'Call Passenger'.tr,
|
||||||
|
subtitle: phone,
|
||||||
|
icon: Icons.phone_rounded,
|
||||||
|
color: Colors.green,
|
||||||
|
onTap: () => mainController.makePhoneCall(phone),
|
||||||
|
),
|
||||||
|
_buildCommunicationRow(
|
||||||
|
title: 'WhatsApp: Support'.tr,
|
||||||
|
subtitle: 'Send technical support message'.tr,
|
||||||
|
icon: Icons.send_rounded,
|
||||||
|
color: Colors.blue,
|
||||||
|
onTap: () => mainController.launchCommunication(
|
||||||
|
'whatsapp',
|
||||||
|
phone,
|
||||||
|
'مرحباً $name، معك الدعم الفني من شركة سيرو. كيف يمكنني مساعدتك اليوم؟',
|
||||||
|
),
|
||||||
|
isLast: true,
|
||||||
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -72,6 +131,8 @@ class PassengersPage extends StatelessWidget {
|
|||||||
Widget _buildLatestRideCard(Map data) {
|
Widget _buildLatestRideCard(Map data) {
|
||||||
return _buildCard(
|
return _buildCard(
|
||||||
title: 'Latest Ride'.tr,
|
title: 'Latest Ride'.tr,
|
||||||
|
icon: Icons.directions_car_outlined,
|
||||||
|
iconColor: Colors.orange,
|
||||||
children: [
|
children: [
|
||||||
_buildInfoRow('Ride ID'.tr, data['ride_id']),
|
_buildInfoRow('Ride ID'.tr, data['ride_id']),
|
||||||
_buildInfoRow('Date'.tr, data['ride_date']),
|
_buildInfoRow('Date'.tr, data['ride_date']),
|
||||||
@@ -86,7 +147,8 @@ class PassengersPage extends StatelessWidget {
|
|||||||
'Distance'.tr,
|
'Distance'.tr,
|
||||||
data['distance'] != null
|
data['distance'] != null
|
||||||
? '${(data['distance'] as num).toStringAsFixed(2)} km'
|
? '${(data['distance'] as num).toStringAsFixed(2)} km'
|
||||||
: null),
|
: null,
|
||||||
|
isLast: true),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -94,6 +156,8 @@ class PassengersPage extends StatelessWidget {
|
|||||||
Widget _buildWalletInfoCard(Map data) {
|
Widget _buildWalletInfoCard(Map data) {
|
||||||
return _buildCard(
|
return _buildCard(
|
||||||
title: 'Wallet Information'.tr,
|
title: 'Wallet Information'.tr,
|
||||||
|
icon: Icons.account_balance_wallet_outlined,
|
||||||
|
iconColor: Colors.green,
|
||||||
children: [
|
children: [
|
||||||
_buildInfoRow(
|
_buildInfoRow(
|
||||||
'Wallet Balance'.tr,
|
'Wallet Balance'.tr,
|
||||||
@@ -106,22 +170,66 @@ class PassengersPage extends StatelessWidget {
|
|||||||
? '\$${data['passenger_payment_amount']}'
|
? '\$${data['passenger_payment_amount']}'
|
||||||
: null),
|
: null),
|
||||||
_buildInfoRow(
|
_buildInfoRow(
|
||||||
'Last Payment Method'.tr, data['passenger_payment_method']),
|
'Last Payment Method'.tr, data['passenger_payment_method'],
|
||||||
|
isLast: true),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildCard({required String title, required List<Widget> children}) {
|
Widget _buildCard({
|
||||||
return Card(
|
required String title,
|
||||||
margin: const EdgeInsets.all(16),
|
required IconData icon,
|
||||||
|
required Color iconColor,
|
||||||
|
required List<Widget> children,
|
||||||
|
}) {
|
||||||
|
return Container(
|
||||||
|
margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
borderRadius: BorderRadius.circular(20),
|
||||||
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
color: Colors.black.withOpacity(0.03),
|
||||||
|
blurRadius: 16,
|
||||||
|
offset: const Offset(0, 6),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
border: Border.all(
|
||||||
|
color: Colors.grey.shade100,
|
||||||
|
width: 1,
|
||||||
|
),
|
||||||
|
),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.all(16),
|
padding: const EdgeInsets.all(20),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text(title,
|
Row(
|
||||||
style:
|
children: [
|
||||||
const TextStyle(fontSize: 18, fontWeight: FontWeight.bold)),
|
Container(
|
||||||
|
padding: const EdgeInsets.all(8),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: iconColor.withOpacity(0.1),
|
||||||
|
borderRadius: BorderRadius.circular(10),
|
||||||
|
),
|
||||||
|
child: Icon(
|
||||||
|
icon,
|
||||||
|
color: iconColor,
|
||||||
|
size: 20,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 12),
|
||||||
|
Text(
|
||||||
|
title,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 18,
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
color: AppColor.writeColor,
|
||||||
|
letterSpacing: 0.2,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
...children,
|
...children,
|
||||||
],
|
],
|
||||||
@@ -130,17 +238,114 @@ class PassengersPage extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildInfoRow(String label, dynamic value) {
|
Widget _buildInfoRow(String label, dynamic value, {bool isLast = false}) {
|
||||||
final displayValue = value?.toString() ?? 'N/A';
|
final displayValue = value?.toString() ?? 'N/A';
|
||||||
return Padding(
|
return Column(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 4),
|
children: [
|
||||||
child: Row(
|
Padding(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
padding: const EdgeInsets.symmetric(vertical: 12),
|
||||||
children: [
|
child: Row(
|
||||||
Text(label, style: const TextStyle(fontWeight: FontWeight.bold)),
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
Flexible(child: Text(displayValue, overflow: TextOverflow.ellipsis)),
|
children: [
|
||||||
],
|
Text(
|
||||||
),
|
label,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 15,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
color: AppColor.accentColor,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 16),
|
||||||
|
Flexible(
|
||||||
|
child: Text(
|
||||||
|
displayValue,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 16,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
color: AppColor.writeColor,
|
||||||
|
),
|
||||||
|
textAlign: TextAlign.end,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
if (!isLast)
|
||||||
|
Divider(
|
||||||
|
height: 1,
|
||||||
|
thickness: 1,
|
||||||
|
color: Colors.grey.shade50,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildCommunicationRow({
|
||||||
|
required String title,
|
||||||
|
required String subtitle,
|
||||||
|
required IconData icon,
|
||||||
|
required Color color,
|
||||||
|
required VoidCallback onTap,
|
||||||
|
bool isLast = false,
|
||||||
|
}) {
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
InkWell(
|
||||||
|
onTap: onTap,
|
||||||
|
borderRadius: BorderRadius.circular(12),
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 4),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
padding: const EdgeInsets.all(10),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: color.withOpacity(0.1),
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
),
|
||||||
|
child: Icon(icon, color: color, size: 20),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 14),
|
||||||
|
Expanded(
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
title,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 16,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
color: AppColor.writeColor,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 2),
|
||||||
|
Text(
|
||||||
|
subtitle,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 13,
|
||||||
|
color: AppColor.accentColor,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Icon(
|
||||||
|
Icons.arrow_forward_ios_rounded,
|
||||||
|
color: Colors.grey.shade300,
|
||||||
|
size: 16,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
if (!isLast)
|
||||||
|
Divider(
|
||||||
|
height: 1,
|
||||||
|
thickness: 1,
|
||||||
|
color: Colors.grey.shade50,
|
||||||
|
),
|
||||||
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user