129 lines
5.1 KiB
Dart
129 lines
5.1 KiB
Dart
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:get/get.dart';
|
|
import 'package:service/views/widgets/my_scafold.dart';
|
|
|
|
import '../main_controller.dart';
|
|
|
|
class DriverPage extends StatelessWidget {
|
|
DriverPage({super.key});
|
|
MainController mainController = MainController();
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
body: GetBuilder<MainController>(builder: (mainController) {
|
|
Map data = mainController.driverData['message'][0];
|
|
return CupertinoPageScaffold(
|
|
navigationBar: CupertinoNavigationBar(
|
|
middle: Text('${data['first_name']} ${data['last_name']}'),
|
|
),
|
|
child: SafeArea(
|
|
child: CupertinoScrollbar(
|
|
child: ListView(
|
|
children: [
|
|
_buildDriverInfoSection(
|
|
mainController.driverData['message'][0]),
|
|
_buildStatisticsSection(
|
|
mainController.driverData['message'][0]),
|
|
_buildCarInfoSection(mainController.driverData['message'][0]),
|
|
_buildLicenseInfoSection(
|
|
mainController.driverData['message'][0]),
|
|
_buildBankInfoSection(
|
|
mainController.driverData['message'][0]),
|
|
// buildCarInfo(mainController.driverData['message'][0]),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}),
|
|
);
|
|
}
|
|
|
|
Widget _buildDriverInfoSection(Map<String, dynamic> data) {
|
|
return CupertinoListSection.insetGrouped(
|
|
header: Text('Driver Information'.tr),
|
|
children: [
|
|
_buildInfoRow('Name'.tr, data['name_arabic'].toString()),
|
|
_buildInfoRow('Name (English)'.tr, data['name_english'].toString()),
|
|
_buildInfoRow('Phone'.tr, data['phone'].toString()),
|
|
_buildInfoRow('Email'.tr, data['email'].toString()),
|
|
_buildInfoRow('Gender'.tr, data['gender'].toString()),
|
|
_buildInfoRow('Birthdate'.tr, data['birthdate'].toString()),
|
|
_buildInfoRow('National Number'.tr, data['national_number'].toString()),
|
|
_buildInfoRow('Religion'.tr, data['religion'].toString()),
|
|
_buildInfoRow('Occupation'.tr, data['occupation'].toString()),
|
|
_buildInfoRow('Education'.tr, data['education'].toString()),
|
|
],
|
|
);
|
|
}
|
|
|
|
Widget _buildStatisticsSection(Map<String, dynamic> data) {
|
|
return CupertinoListSection.insetGrouped(
|
|
header: Text('Driver Statistics'.tr),
|
|
children: [
|
|
_buildInfoRow('Total Rides'.tr, data['countRide'].toString()),
|
|
_buildInfoRow('Average Rating'.tr, data['rating'].toString()),
|
|
_buildInfoRow('Total Payments'.tr, '\$${data['totalPayment']}'),
|
|
_buildInfoRow('Wallet Balance'.tr, '\$${data['totalDriverWallet']}'),
|
|
_buildInfoRow('Complaints'.tr, data['countComplaint'].toString()),
|
|
_buildInfoRow('Scam Reports'.tr, data['countScam'].toString()),
|
|
_buildInfoRow(
|
|
'Passengers Rated'.tr, data['DRatingPassengersCount'].toString()),
|
|
_buildInfoRow(
|
|
'Avg Passenger Rating'.tr, data['avgDRatingPassenger'].toString()),
|
|
],
|
|
);
|
|
}
|
|
|
|
Widget _buildCarInfoSection(Map<String, dynamic> data) {
|
|
return CupertinoListSection.insetGrouped(
|
|
header: Text('Vehicle Information'.tr),
|
|
children: [
|
|
_buildInfoRow('VIN'.tr, data['vin'].toString()),
|
|
_buildInfoRow('Plate Number'.tr, data['car_plate'].toString()),
|
|
_buildInfoRow('Make'.tr, data['make'].toString()),
|
|
_buildInfoRow('Model'.tr, data['model'].toString()),
|
|
_buildInfoRow('Year'.tr, data['year'].toString()),
|
|
_buildInfoRow('Color'.tr, data['color'].toString()),
|
|
_buildInfoRow('Fuel Type'.tr, data['fuel'].toString()),
|
|
_buildInfoRow('Displacement'.tr, data['displacement'].toString()),
|
|
_buildInfoRow(
|
|
'Registration Date'.tr, data['registration_date'].toString()),
|
|
_buildInfoRow('Expiration Date'.tr, data['expiration_date'].toString()),
|
|
],
|
|
);
|
|
}
|
|
|
|
Widget _buildLicenseInfoSection(Map<String, dynamic> data) {
|
|
return CupertinoListSection.insetGrouped(
|
|
header: Text('License Information'.tr),
|
|
children: [
|
|
_buildInfoRow('License Type'.tr, data['license_type'].toString()),
|
|
_buildInfoRow('Card ID'.tr, data['card_id'].toString()),
|
|
_buildInfoRow('Issue Date'.tr, data['issue_date'].toString()),
|
|
_buildInfoRow('Expiry Date'.tr, data['expiry_date'].toString()),
|
|
_buildInfoRow('Categories'.tr, data['license_categories'].toString()),
|
|
],
|
|
);
|
|
}
|
|
|
|
Widget _buildBankInfoSection(Map<String, dynamic> data) {
|
|
return CupertinoListSection.insetGrouped(
|
|
header: Text('Bank Information'.tr),
|
|
children: [
|
|
_buildInfoRow('Account Number'.tr, data['accountBank'].toString()),
|
|
_buildInfoRow('Bank Code'.tr, data['bankCode'].toString()),
|
|
],
|
|
);
|
|
}
|
|
|
|
Widget _buildInfoRow(String label, String value) {
|
|
return CupertinoListTile(
|
|
title: Text(label),
|
|
trailing: Text(value,
|
|
style: const TextStyle(color: CupertinoColors.systemGrey)),
|
|
);
|
|
}
|
|
}
|