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,
|
||||
decoration: InputDecoration(
|
||||
labelText: label.tr,
|
||||
hintText: hintText,
|
||||
hintText: hintText?.tr,
|
||||
prefixIcon:
|
||||
icon != null ? Icon(icon, color: AppColor.secondaryColor) : null,
|
||||
border: OutlineInputBorder(
|
||||
|
||||
@@ -44,7 +44,7 @@ class PassengersCantRegister extends StatelessWidget {
|
||||
child: CupertinoTextFormFieldRow(
|
||||
initialValue: passenger['created_at'],
|
||||
readOnly: true,
|
||||
placeholder: 'Created At',
|
||||
placeholder: 'Created At'.tr,
|
||||
),
|
||||
),
|
||||
CupertinoFormRow(
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
import 'package:flutter/material.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/views/widgets/my_scafold.dart';
|
||||
|
||||
class PassengersPage extends StatelessWidget {
|
||||
PassengersPage({super.key});
|
||||
final MainController mainController = MainController();
|
||||
final MainController mainController = Get.find<MainController>();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GetBuilder<MainController>(
|
||||
builder: (mainController) {
|
||||
final data = _extractPassengerData(mainController);
|
||||
builder: (controller) {
|
||||
final data = _extractPassengerData(controller);
|
||||
|
||||
return MyScaffold(
|
||||
title: data != null
|
||||
@@ -20,20 +21,46 @@ class PassengersPage extends StatelessWidget {
|
||||
isleading: true,
|
||||
body: [
|
||||
if (data != null)
|
||||
ListView(
|
||||
children: [
|
||||
_buildPersonalInfoCard(data),
|
||||
_buildLatestRideCard(data),
|
||||
_buildWalletInfoCard(data),
|
||||
],
|
||||
Container(
|
||||
color: AppColor.surfaceColor,
|
||||
child: ListView(
|
||||
physics: const BouncingScrollPhysics(),
|
||||
padding: const EdgeInsets.symmetric(vertical: 12),
|
||||
children: [
|
||||
_buildPersonalInfoCard(data),
|
||||
_buildCommunicationCard(data),
|
||||
_buildLatestRideCard(data),
|
||||
_buildWalletInfoCard(data),
|
||||
const SizedBox(height: 40),
|
||||
],
|
||||
),
|
||||
)
|
||||
else
|
||||
Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(24.0),
|
||||
child: Text(
|
||||
'No passenger data available.'.tr,
|
||||
style: const TextStyle(fontSize: 18, fontWeight: FontWeight.w500),
|
||||
Container(
|
||||
color: AppColor.surfaceColor,
|
||||
child: Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(24.0),
|
||||
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) {
|
||||
return _buildCard(
|
||||
title: 'Personal Information'.tr,
|
||||
icon: Icons.person_outline_rounded,
|
||||
iconColor: AppColor.primaryColor,
|
||||
children: [
|
||||
_buildInfoRow('Phone'.tr, data['phone']),
|
||||
_buildInfoRow('Email'.tr, data['email']),
|
||||
_buildInfoRow('Gender'.tr, data['gender']),
|
||||
_buildInfoRow('Birthdate'.tr, data['birthdate']),
|
||||
// _buildInfoRow('Education'.tr, data['education']),
|
||||
_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) {
|
||||
return _buildCard(
|
||||
title: 'Latest Ride'.tr,
|
||||
icon: Icons.directions_car_outlined,
|
||||
iconColor: Colors.orange,
|
||||
children: [
|
||||
_buildInfoRow('Ride ID'.tr, data['ride_id']),
|
||||
_buildInfoRow('Date'.tr, data['ride_date']),
|
||||
@@ -86,7 +147,8 @@ class PassengersPage extends StatelessWidget {
|
||||
'Distance'.tr,
|
||||
data['distance'] != null
|
||||
? '${(data['distance'] as num).toStringAsFixed(2)} km'
|
||||
: null),
|
||||
: null,
|
||||
isLast: true),
|
||||
],
|
||||
);
|
||||
}
|
||||
@@ -94,6 +156,8 @@ class PassengersPage extends StatelessWidget {
|
||||
Widget _buildWalletInfoCard(Map data) {
|
||||
return _buildCard(
|
||||
title: 'Wallet Information'.tr,
|
||||
icon: Icons.account_balance_wallet_outlined,
|
||||
iconColor: Colors.green,
|
||||
children: [
|
||||
_buildInfoRow(
|
||||
'Wallet Balance'.tr,
|
||||
@@ -106,22 +170,66 @@ class PassengersPage extends StatelessWidget {
|
||||
? '\$${data['passenger_payment_amount']}'
|
||||
: null),
|
||||
_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}) {
|
||||
return Card(
|
||||
margin: const EdgeInsets.all(16),
|
||||
Widget _buildCard({
|
||||
required String title,
|
||||
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(
|
||||
padding: const EdgeInsets.all(16),
|
||||
padding: const EdgeInsets.all(20),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(title,
|
||||
style:
|
||||
const TextStyle(fontSize: 18, fontWeight: FontWeight.bold)),
|
||||
Row(
|
||||
children: [
|
||||
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),
|
||||
...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';
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 4),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(label, style: const TextStyle(fontWeight: FontWeight.bold)),
|
||||
Flexible(child: Text(displayValue, overflow: TextOverflow.ellipsis)),
|
||||
],
|
||||
),
|
||||
return Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 12),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
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