25-5-30/1
This commit is contained in:
89
lib/views/home/profile/behavior_page.dart
Normal file
89
lib/views/home/profile/behavior_page.dart
Normal file
@@ -0,0 +1,89 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../../controller/home/captin/behavior_controller.dart';
|
||||
|
||||
class BehaviorPage extends StatelessWidget {
|
||||
const BehaviorPage({
|
||||
super.key,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final controller = Get.put(DriverBehaviorController());
|
||||
controller.fetchDriverBehavior();
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text('Driver Behavior'.tr),
|
||||
centerTitle: true,
|
||||
),
|
||||
body: Obx(() {
|
||||
if (controller.isLoading.value) {
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
}
|
||||
|
||||
return SingleChildScrollView(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Card(
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12)),
|
||||
elevation: 4,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Column(
|
||||
children: [
|
||||
const Text("Overall Behavior Score",
|
||||
style: TextStyle(
|
||||
fontSize: 20, fontWeight: FontWeight.bold)),
|
||||
const SizedBox(height: 10),
|
||||
Text(
|
||||
"${controller.overallScore.value.toStringAsFixed(1)} / 100",
|
||||
style: const TextStyle(
|
||||
fontSize: 28, color: Colors.blue)),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
const Text("Last 10 Trips",
|
||||
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold)),
|
||||
const SizedBox(height: 10),
|
||||
ListView.builder(
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
itemCount: controller.lastTrips.length,
|
||||
itemBuilder: (context, index) {
|
||||
var trip = controller.lastTrips[index];
|
||||
return Card(
|
||||
elevation: 3,
|
||||
child: ListTile(
|
||||
leading: CircleAvatar(
|
||||
backgroundColor: Colors.blue,
|
||||
child: Text("${index + 1}",
|
||||
style: const TextStyle(color: Colors.white)),
|
||||
),
|
||||
title: Text("Trip ID: ${trip['trip_id']}"),
|
||||
subtitle: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text("Behavior Score: ${trip['behavior_score']}"),
|
||||
Text("Max Speed: ${trip['max_speed']} km/h"),
|
||||
Text("Hard Brakes: ${trip['hard_brakes']}"),
|
||||
Text("Distance: ${trip['total_distance']} km"),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -74,9 +74,7 @@ class CaptainsCars extends StatelessWidget {
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 4),
|
||||
child: Text(
|
||||
EncryptionHelper.instance
|
||||
.decryptData(
|
||||
car['car_plate']),
|
||||
(car['car_plate']),
|
||||
style: AppStyle.title,
|
||||
),
|
||||
),
|
||||
|
||||
@@ -94,11 +94,8 @@ GetBuilder<AI> egyptCarLicenceFront() {
|
||||
style: AppStyle.headTitle2),
|
||||
IconButton(
|
||||
onPressed: () async {
|
||||
ai.allMethodForAI(
|
||||
EncryptionHelper.instance.decryptData(
|
||||
ai.prompts[3]['prompt'].toString()),
|
||||
AppLink.uploadEgypt,
|
||||
'car_front');
|
||||
ai.allMethodForAI((ai.prompts[3]['prompt'].toString()),
|
||||
AppLink.uploadEgypt, 'car_front');
|
||||
},
|
||||
icon: const Icon(Icons.refresh),
|
||||
),
|
||||
@@ -142,12 +139,8 @@ GetBuilder<AI> egyptCarLicenceFront() {
|
||||
return Card(
|
||||
child: InkWell(
|
||||
onTap: () async {
|
||||
ai.allMethodForAINewCar(
|
||||
EncryptionHelper.instance
|
||||
.decryptData(ai.prompts[3]['prompt'].toString()),
|
||||
AppLink.uploadEgypt1,
|
||||
'car_front',
|
||||
'carId'); //todo
|
||||
ai.allMethodForAINewCar((ai.prompts[3]['prompt'].toString()),
|
||||
AppLink.uploadEgypt1, 'car_front', 'carId'); //todo
|
||||
},
|
||||
child: Column(
|
||||
children: [
|
||||
@@ -213,11 +206,8 @@ GetBuilder<AI> egyptCarLicenceBack() {
|
||||
Text('Vehicle Details Back'.tr, style: AppStyle.headTitle2),
|
||||
IconButton(
|
||||
onPressed: () async {
|
||||
ai.allMethodForAI(
|
||||
EncryptionHelper.instance.decryptData(
|
||||
ai.prompts[4]['prompt'].toString()),
|
||||
AppLink.uploadEgypt,
|
||||
'car_back');
|
||||
ai.allMethodForAI((ai.prompts[4]['prompt'].toString()),
|
||||
AppLink.uploadEgypt, 'car_back');
|
||||
},
|
||||
icon: const Icon(Icons.refresh),
|
||||
),
|
||||
@@ -286,11 +276,8 @@ GetBuilder<AI> egyptCarLicenceBack() {
|
||||
return Card(
|
||||
child: InkWell(
|
||||
onTap: () async {
|
||||
ai.allMethodForAI(
|
||||
EncryptionHelper.instance
|
||||
.decryptData(ai.prompts[4]['prompt'].toString()),
|
||||
AppLink.uploadEgypt,
|
||||
'car_back');
|
||||
ai.allMethodForAI((ai.prompts[4]['prompt'].toString()),
|
||||
AppLink.uploadEgypt, 'car_back');
|
||||
},
|
||||
child: Column(
|
||||
children: [
|
||||
|
||||
@@ -10,6 +10,7 @@ import 'package:sefer_driver/controller/profile/captain_profile_controller.dart'
|
||||
import 'package:sefer_driver/views/widgets/my_scafold.dart';
|
||||
|
||||
import '../my_wallet/walet_captain.dart';
|
||||
import 'behavior_page.dart';
|
||||
import 'captains_cars.dart';
|
||||
|
||||
class ProfileCaptain extends StatelessWidget {
|
||||
@@ -33,19 +34,38 @@ class ProfileCaptain extends StatelessWidget {
|
||||
Material(
|
||||
elevation: 2,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
child: InkWell(
|
||||
onTap: () async {
|
||||
addBankCodeEgypt(captainWalletController);
|
||||
},
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 16, horizontal: 16),
|
||||
child: Text(
|
||||
'Add bank Account'.tr,
|
||||
style: AppStyle.title,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
InkWell(
|
||||
onTap: () async {
|
||||
addBankCodeEgypt(captainWalletController);
|
||||
},
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 16, horizontal: 16),
|
||||
child: Text(
|
||||
'Add bank Account'.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
InkWell(
|
||||
onTap: () async {
|
||||
Get.to(() => BehaviorPage());
|
||||
},
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 16, horizontal: 16),
|
||||
child: Text(
|
||||
'Show behavior page'.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 15),
|
||||
@@ -73,41 +93,28 @@ class ProfileCaptain extends StatelessWidget {
|
||||
driverId:
|
||||
controller.captainProfileData['driverID'] ??
|
||||
'',
|
||||
name: EncryptionHelper.instance.decryptData(
|
||||
(controller.captainProfileData[
|
||||
'first_name']) ??
|
||||
'') +
|
||||
' ' +
|
||||
EncryptionHelper.instance.decryptData(
|
||||
(controller.captainProfileData[
|
||||
'last_name']) ??
|
||||
''),
|
||||
phoneNumber: EncryptionHelper.instance
|
||||
.decryptData(controller
|
||||
.captainProfileData['phone']) ??
|
||||
name:
|
||||
'${((controller.captainProfileData['first_name']) ?? '')} ${((controller.captainProfileData['last_name']) ?? '')}',
|
||||
phoneNumber:
|
||||
(controller.captainProfileData['phone']) ??
|
||||
'',
|
||||
email: (controller.captainProfileData['email']) ??
|
||||
'',
|
||||
email: EncryptionHelper.instance.decryptData(
|
||||
controller.captainProfileData['email']) ??
|
||||
birthdate: (controller
|
||||
.captainProfileData['birthdate']) ??
|
||||
'',
|
||||
birthdate: EncryptionHelper.instance.decryptData(
|
||||
controller
|
||||
.captainProfileData['birthdate']) ??
|
||||
'',
|
||||
gender: EncryptionHelper.instance.decryptData(
|
||||
controller
|
||||
.captainProfileData['gender']) ??
|
||||
'',
|
||||
education: EncryptionHelper.instance.decryptData(
|
||||
controller
|
||||
.captainProfileData['education']) ??
|
||||
gender:
|
||||
(controller.captainProfileData['gender']) ??
|
||||
'',
|
||||
education: (controller
|
||||
.captainProfileData['education']) ??
|
||||
'',
|
||||
carMake:
|
||||
controller.captainProfileData['make'] ?? '',
|
||||
carModel:
|
||||
controller.captainProfileData['model'] ?? '',
|
||||
carPlate: EncryptionHelper.instance.decryptData(
|
||||
controller
|
||||
.captainProfileData['car_plate']) ??
|
||||
carPlate: (controller
|
||||
.captainProfileData['car_plate']) ??
|
||||
'',
|
||||
carColor:
|
||||
controller.captainProfileData['color'] ?? '',
|
||||
|
||||
Reference in New Issue
Block a user