8/11/1
This commit is contained in:
127
lib/controller/mainController/pages/driver_page.dart
Normal file
127
lib/controller/mainController/pages/driver_page.dart
Normal file
@@ -0,0 +1,127 @@
|
||||
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']),
|
||||
_buildInfoRow('Name (English)'.tr, data['name_english']),
|
||||
_buildInfoRow('Phone'.tr, data['phone']),
|
||||
_buildInfoRow('Email'.tr, data['email']),
|
||||
_buildInfoRow('Gender'.tr, data['gender']),
|
||||
_buildInfoRow('Birthdate'.tr, data['birthdate']),
|
||||
_buildInfoRow('National Number'.tr, data['national_number']),
|
||||
_buildInfoRow('Religion'.tr, data['religion']),
|
||||
_buildInfoRow('Occupation'.tr, data['occupation']),
|
||||
_buildInfoRow('Education'.tr, data['education']),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
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']),
|
||||
_buildInfoRow('Plate Number'.tr, data['car_plate']),
|
||||
_buildInfoRow('Make'.tr, data['make']),
|
||||
_buildInfoRow('Model'.tr, data['model']),
|
||||
_buildInfoRow('Year'.tr, data['year']),
|
||||
_buildInfoRow('Color'.tr, data['color']),
|
||||
_buildInfoRow('Fuel Type'.tr, data['fuel']),
|
||||
_buildInfoRow('Displacement'.tr, data['displacement']),
|
||||
_buildInfoRow('Registration Date'.tr, data['registration_date']),
|
||||
_buildInfoRow('Expiration Date'.tr, data['expiration_date']),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildLicenseInfoSection(Map<String, dynamic> data) {
|
||||
return CupertinoListSection.insetGrouped(
|
||||
header: Text('License Information'.tr),
|
||||
children: [
|
||||
_buildInfoRow('License Type'.tr, data['license_type']),
|
||||
_buildInfoRow('Card ID'.tr, data['card_id']),
|
||||
_buildInfoRow('Issue Date'.tr, data['issue_date']),
|
||||
_buildInfoRow('Expiry Date'.tr, data['expiry_date']),
|
||||
_buildInfoRow('Categories'.tr, data['license_categories']),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildBankInfoSection(Map<String, dynamic> data) {
|
||||
return CupertinoListSection.insetGrouped(
|
||||
header: Text('Bank Information'.tr),
|
||||
children: [
|
||||
_buildInfoRow('Account Number'.tr, data['accountBank']),
|
||||
_buildInfoRow('Bank Code'.tr, data['bankCode']),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildInfoRow(String label, String value) {
|
||||
return CupertinoListTile(
|
||||
title: Text(label),
|
||||
trailing: Text(value,
|
||||
style: const TextStyle(color: CupertinoColors.systemGrey)),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user