This commit is contained in:
Hamza-Ayed
2024-09-14 23:19:25 +03:00
parent ba3a9850c2
commit 02bb9fc7f7
23 changed files with 2407 additions and 1020 deletions

View File

@@ -143,6 +143,7 @@ class CRUD {
Log.print('payload: ${payload}');
Log.print('response.request: ${response.request}');
Log.print('response.body: ${response.body}');
Log.print('response.reasonPhrase: ${response.reasonPhrase}');
// print(response.statusCode);
var jsonData = jsonDecode(response.body);
if (response.statusCode == 200) {
@@ -150,6 +151,7 @@ class CRUD {
return response.body;
} else {
String errorMessage = jsonData['message'];
Log.print('errorMessage: ${errorMessage}');
// Get.snackbar('Error'.tr, errorMessage.tr,
// backgroundColor: AppColor.redColor);
return (jsonData['status']);

View File

@@ -14,19 +14,24 @@ class MyTranslation extends Translations {
"orange": "برتقالي",
"pink": "وردي",
"brown": "بني",
"gray": "رمادي", "Eggplant": "باذنجان",
"Dark Red": "نبيتي",
"Sky Blue": "ازرق سماوي",
"Mocha": "موكا",
"gray": "رمادي",
"cyan": "سماوي",
"magenta": "أرجواني داكن",
"magenta": "بنفسجي",
"lime": "ليموني",
"indigo": "نيلي",
"violet": "بنفسجي",
"raw gray": "رمادي ",
"gold": "ذهبي",
"silver": "فضي",
"teal": "تركوازي",
"navy": "كحلي",
"Eggplant": "باذنجان",
"Dark Red": "نبيتي",
"Sky Blue": "أزرق سماوي",
"Mocha": "موكا",
"Champagne": "شامبان",
"Bronze": "برونزي",
"Maroon": "ماروني",
"Capture an Image of Your Criminal Record":
"التقط صورة لسجلك الجنائي",
"IssueDate": "تاريخ الإصدار",

View File

@@ -2,32 +2,40 @@ import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:service/constant/api_key.dart';
import 'package:service/constant/box_name.dart';
import 'package:service/constant/links.dart';
import 'package:service/controller/functions/crud.dart';
import 'package:service/main.dart';
import '../views/home/main.dart';
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
class LoginController extends GetxController {
var email = TextEditingController();
var password = TextEditingController();
final formKey = GlobalKey<FormState>();
// Use FlutterSecureStorage instead of GetStorage
final FlutterSecureStorage storage = const FlutterSecureStorage();
void login() async {
if (box.read(BoxName.email) == AK.emailService) {
Get.off(Main());
String? storedEmail = await storage.read(key: 'email');
if (storedEmail != null) {
Get.off(() => Main());
} else {
if (formKey.currentState!.validate()) {
var res = await CRUD().get(link: AppLink.login, payload: {
"email": email.text,
"password": password.text,
});
if (res != 'failure') {
var d = jsonDecode(res);
if (d['message'] == "Login successful") {
box.write(BoxName.email, email.text);
// Save data securely in FlutterSecureStorage
await storage.write(key: 'email', value: d['data']['email']);
await storage.write(key: 'name', value: d['data']['first_name']);
await storage.write(key: 'driverID', value: d['data']['id']);
Get.off(() => Main());
}

View File

@@ -202,6 +202,91 @@ class MainController extends GetxController {
}
}
List driverWithoutCar = [];
getdriverWithoutCar() async {
var res = await CRUD().get(link: AppLink.getdriverWithoutCar, payload: {});
if (res != 'failure') {
var d = jsonDecode(res)['message'];
driverWithoutCar = d;
update();
} else {
MyDialog().getDialog('No Car found yet'.tr, 'thanks'.tr, const SizedBox(),
() {
Get.back();
});
}
}
Future<void> addRegistrationCarEgyptHandling({
required String driverId,
required String carPlate,
required String color,
required String colorHex,
required String year,
required String make,
required String model,
required String expirationDate,
required String owner,
}) async {
try {
isLoading = true;
update();
var payload = {
'driverID': driverId,
'vin': 'vin',
'car_plate': carPlate,
'make': make,
'model': model,
'year': year,
'expiration_date': expirationDate,
'color': color,
'owner': owner,
'color_hex': colorHex,
'address': 'addressCar',
'displacement': 'displacement',
'fuel': 'fuel',
'registration_date': '2024-09-06',
};
Log.print('Payload: $payload');
var res =
await CRUD().post(link: AppLink.addCartoDriver, payload: payload);
isLoading = false;
update();
var status = jsonDecode(res);
Log.print('res: $res');
Log.print('status: $status');
if (status['status'] == 'success') {
await Future.wait([
CRUD().post(
link:
'${AppLink.seferAlexandriaServer}/ride/RegisrationCar/add.php',
payload: payload),
CRUD().post(
link: '${AppLink.seferGizaServer}/ride/RegisrationCar/add.php',
payload: payload),
]);
Get.snackbar('Success', 'Registration successful',
backgroundColor: AppColor.greenColor);
Get.back();
} else {
Log.print('Error: Unexpected status: ${status['status']}');
Get.snackbar('Error', 'Registration failed',
backgroundColor: Colors.red);
}
} catch (e) {
Log.print('Error: $e');
Get.snackbar('Error', 'An error occurred during registration',
backgroundColor: Colors.red);
}
}
editCarPlateNotEdit(
String driverId,
String carPlate,
@@ -226,13 +311,14 @@ class MainController extends GetxController {
});
Log.print('res: ${res}');
if (res != 'failure') {
Get.snackbar(res, '', backgroundColor: AppColor.greenColor);
// Get.snackbar(res, '', backgroundColor: AppColor.greenColor);
Get.back();
carplateController.clear();
yearController.clear();
makeController.clear();
modelController.clear();
ownerController.clear();
Get.back();
await getCarPlateNotEdit();
update();
} else {

View File

@@ -0,0 +1,318 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:intl/intl.dart';
import 'package:service/constant/style.dart';
import 'package:service/controller/mainController/pages/edit_car.dart';
import 'package:service/views/widgets/my_scafold.dart';
import '../../../constant/colors.dart';
import '../../../constant/links.dart';
import '../../../print.dart';
import '../../../views/widgets/my_textField.dart';
import '../../functions/crud.dart';
import '../main_controller.dart';
class AddCar extends StatelessWidget {
const AddCar({super.key});
@override
Widget build(BuildContext context) {
Get.put(MainController());
return GetBuilder<MainController>(builder: (mainController) {
return MyScaffold(
title: 'Edit car details'.tr,
isleading: true,
body: [
Expanded(
child: ListView.builder(
padding: const EdgeInsets.all(16.0),
itemCount: mainController
.driverWithoutCar.length, // 10 fields + 1 save button
itemBuilder: (context, index) {
var carData = mainController.driverWithoutCar[index];
return Padding(
padding: const EdgeInsets.all(8.0),
child: InkWell(
onTap: () {
Get.to(AddCarForm(carData: carData));
},
child: Container(
decoration: AppStyle.boxDecoration1,
child: Text(carData['name_arabic'])),
),
);
}),
),
],
);
});
}
}
class AddCarForm extends StatelessWidget {
final Map carData;
const AddCarForm({super.key, required this.carData});
@override
Widget build(BuildContext context) {
Get.put(MainController());
return GetBuilder<MainController>(builder: (mainController) {
return MyScaffold(title: 'Add Car', isleading: true, body: [
ListView(
children: [
Column(
children: [
Image.network(
'https://sefer.click/sefer/card_image/car_front-${carData['id']}.jpg',
height: 200,
width: double.maxFinite,
fit: BoxFit.fill,
),
Image.network(
'https://sefer.click/sefer/card_image/car_back-${carData['id']}.jpg',
height: 200,
width: double.maxFinite,
fit: BoxFit.fill,
),
],
),
const SizedBox(height: 9),
Form(
key: mainController.formKey,
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
SizedBox(
width: Get.width * .6,
child: MyTextForm(
controller: mainController.carplateController,
label: 'car plate'.tr,
hint: 'car plate'.tr,
type: TextInputType.name,
),
),
IconButton(
onPressed: () async {
if (mainController.formKey.currentState!.validate()) {
await mainController
.addRegistrationCarEgyptHandling(
driverId: carData['id'].toString(),
carPlate: mainController.carplateController.text,
color: mainController.colorController.text,
colorHex:
mainController.colorHex.value.toString(),
year: mainController.yearController.text,
make: mainController.makeController.text,
model: mainController.modelController.text,
expirationDate:
mainController.expirationDateController.text,
owner: mainController.ownerController.text,
);
}
},
icon: const Icon(
Icons.upload_outlined,
color: AppColor.blueColor,
),
),
],
),
// Other fields
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
SizedBox(
width: Get.width * .4,
child: MyTextForm(
controller: mainController.yearController,
label: 'Year'.tr,
hint: 'Year'.tr,
type: TextInputType.number,
),
),
SizedBox(
width: Get.width * .4,
child: DropdownButtonFormField<String>(
decoration: InputDecoration(
labelText: 'Color'.tr, // Localized label
),
value: mainController.colorHex.value.isEmpty
? null
: mainController.colorHex
.value, // Use the hex value as the current value
items: [
{'red'.tr: '#FF0000'},
{'green'.tr: '#008000'},
{'blue'.tr: '#0000FF'},
{'black'.tr: '#000000'},
{'white'.tr: '#FFFFFF'},
{'yellow'.tr: '#FFFF00'},
{'purple'.tr: '#800080'},
{'orange'.tr: '#FFA500'},
{'pink'.tr: '#FFC0CB'},
{'brown'.tr: '#A52A2A'},
{'gray'.tr: '#808080'},
{'cyan'.tr: '#00FFFF'},
{'magenta'.tr: '#FF00FF'},
{'lime'.tr: '#00FF00'},
{'indigo'.tr: '#4B0082'},
{'violet'.tr: '#EE82EE'},
{'gold'.tr: '#FFD700'},
{'silver'.tr: '#C0C0C0'},
{'teal'.tr: '#008080'},
{'navy'.tr: '#000080'},
].map((colorMap) {
String colorName = colorMap.keys.first;
String colorValue = colorMap.values.first;
return DropdownMenuItem<String>(
value: colorValue,
child: Text(colorName),
);
}).toList(),
onChanged: (value) {
if (value != null) {
// Find the selected color name based on the hex value
String selectedColorName = '';
for (var colorMap in [
{'red'.tr: '#FF0000'},
{'green'.tr: '#008000'},
{'blue'.tr: '#0000FF'},
{'black'.tr: '#000000'},
{'white'.tr: '#FFFFFF'},
{'yellow'.tr: '#FFFF00'},
{'purple'.tr: '#800080'},
{'orange'.tr: '#FFA500'},
{'pink'.tr: '#FFC0CB'},
{'brown'.tr: '#A52A2A'},
{'gray'.tr: '#808080'},
{'cyan'.tr: '#00FFFF'},
{'magenta'.tr: '#FF00FF'},
{'lime'.tr: '#00FF00'},
{'indigo'.tr: '#4B0082'},
{'violet'.tr: '#EE82EE'},
{'gold'.tr: '#FFD700'},
{'silver'.tr: '#C0C0C0'},
{'teal'.tr: '#008080'},
{'navy'.tr: '#000080'},
]) {
if (colorMap.values.first == value) {
selectedColorName = colorMap.keys.first;
break;
}
}
mainController.colorController.text =
selectedColorName;
mainController.colorHex.value = value;
}
},
),
),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
SizedBox(
width: Get.width * .4,
child: MyTextForm(
controller: mainController.makeController,
label: 'Make'.tr,
hint: 'Make'.tr,
type: TextInputType.name,
),
),
SizedBox(
width: Get.width * .4,
child: MyTextForm(
controller: mainController.modelController,
label: 'Model'.tr,
hint: 'Model'.tr,
type: TextInputType.name,
),
),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
SizedBox(
width: Get.width * .4,
child: TextField(
controller: mainController.expirationDateController,
decoration: InputDecoration(
labelText: 'Expiration Date'.tr,
hintText: 'Expiration Date'.tr,
),
readOnly:
true, // Make the field read-only to prevent manual input
onTap: () async {
DateTime pickedDate =
DateTime.now(); // Declare the variable here
await showCupertinoModalPopup<void>(
context: context,
builder: (context) => Container(
height: 250,
color: Colors.white,
child: Column(
children: [
SizedBox(
height: 150,
child: CupertinoDatePicker(
initialDateTime: pickedDate,
minimumDate: DateTime(
1955), // Set the starting date
maximumDate: DateTime(
2034), // Set the ending date
mode: CupertinoDatePickerMode.date,
onDateTimeChanged: (DateTime dateTime) {
pickedDate = dateTime;
},
),
),
CupertinoButton(
child: Text('Done'.tr),
onPressed: () {
String formattedDate =
DateFormat('yyyy-MM-dd')
.format(pickedDate);
mainController.expirationDateController
.text = formattedDate.toString();
Navigator.of(context).pop();
},
),
],
),
),
);
},
),
),
SizedBox(
width: Get.width * .4,
child: MyTextForm(
controller: mainController.ownerController,
label: 'Owner'.tr,
hint: 'Owner'.tr,
type: TextInputType.name,
),
),
],
),
],
),
)
],
)
]);
});
}
}

View File

@@ -1,3 +1,4 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:intl/intl.dart';
@@ -21,16 +22,36 @@ class EditCar extends StatelessWidget {
Column(
children: [
Image.network(
'https://api.sefer.live/sefer/card_image/car_front-${carData['driverID']}.jpg',
'https://sefer.click/sefer/card_image/car_front-${carData['driverID']}.jpg',
height: 200,
width: double.maxFinite,
fit: BoxFit.fill,
errorBuilder: (BuildContext context, Object exception,
StackTrace? stackTrace) {
// If the image fails to load, use the _copy version
return Image.network(
'https://sefer.click/sefer/card_image/car_front-${carData['driverID']}_copy.jpg',
height: 200,
width: double.maxFinite,
fit: BoxFit.fill,
);
},
),
Image.network(
'https://api.sefer.live/sefer/card_image/car_back-${carData['driverID']}.jpg',
'https://sefer.click/sefer/card_image/car_back-${carData['driverID']}.jpg',
height: 200,
width: double.maxFinite,
fit: BoxFit.fill,
errorBuilder: (BuildContext context, Object exception,
StackTrace? stackTrace) {
// If the image fails to load, use the _copy version
return Image.network(
'https://sefer.click/sefer/card_image/car_back-${carData['driverID']}_copy.jpg',
height: 200,
width: double.maxFinite,
fit: BoxFit.fill,
);
},
),
],
),
@@ -198,33 +219,55 @@ class EditCar extends StatelessWidget {
children: [
SizedBox(
width: Get.width * .4,
child: SizedBox(
width: Get.width * .4,
child: TextField(
controller: mainController.expirationDateController,
decoration: InputDecoration(
labelText: 'Expiration Date'.tr,
hintText: 'Expiration Date'.tr,
),
readOnly:
true, // Make the field read-only to prevent manual input
onTap: () async {
DateTime? pickedDate = await showDatePicker(
context: context,
initialDate: DateTime.now(),
firstDate:
DateTime(2000), // Set the starting date
lastDate: DateTime(2101), // Set the ending date
);
if (pickedDate != null) {
String formattedDate =
DateFormat('yyyy-MM-dd').format(pickedDate);
mainController.expirationDateController.text =
formattedDate.toString();
}
},
child: TextField(
controller: mainController.expirationDateController,
decoration: InputDecoration(
labelText: 'Expiration Date'.tr,
hintText: 'Expiration Date'.tr,
),
readOnly:
true, // Make the field read-only to prevent manual input
onTap: () async {
DateTime pickedDate =
DateTime.now(); // Declare the variable here
await showCupertinoModalPopup<void>(
context: context,
builder: (context) => Container(
height: 250,
color: Colors.white,
child: Column(
children: [
SizedBox(
height: 150,
child: CupertinoDatePicker(
initialDateTime: pickedDate,
minimumDate: DateTime(
1955), // Set the starting date
maximumDate: DateTime(
2034), // Set the ending date
mode: CupertinoDatePickerMode.date,
onDateTimeChanged: (DateTime dateTime) {
pickedDate = dateTime;
},
),
),
CupertinoButton(
child: Text('Done'.tr),
onPressed: () {
String formattedDate =
DateFormat('yyyy-MM-dd')
.format(pickedDate);
mainController.expirationDateController
.text = formattedDate.toString();
Navigator.of(context).pop();
},
),
],
),
),
);
},
),
),
SizedBox(

View File

@@ -451,6 +451,7 @@ class RegisterCaptainController extends GetxController {
Future<void> addDriverEgypt() async {
isLoading = true;
update();
var added = await storage.read(key: 'name');
var payload = {
'first_name': responseIdEgyptDriverLicense['firstName']?.toString() ??
@@ -495,8 +496,7 @@ class RegisterCaptainController extends GetxController {
'status': 'yet',
'birthdate': extractDOB(
responseIdEgyptDriverLicense['national_number'].toString()),
'maritalStatus':
responseIdEgyptBack['maritalStatus']?.toString() ?? 'Not specified',
'maritalStatus': added.toString(),
'site': responseIdEgyptDriverLicense['address']?.toString() ??
'Not specified',
'employmentType':
@@ -510,6 +510,14 @@ class RegisterCaptainController extends GetxController {
// Handle response
if (status1['status'] == 'success') {
isDriverSaved = true;
var res = CRUD().post(
link: '${AppLink.seferGizaServer}/auth/captin/register.php',
payload: payload);
Log.print('res: ${res}');
var res1 = CRUD().post(
link: '${AppLink.seferAlexandriaServer}/auth/captin/register.php',
payload: payload);
Log.print('res: ${res1}');
Get.snackbar('Success', 'Driver data saved successfully',
backgroundColor: AppColor.greenColor);
} else {
@@ -521,7 +529,7 @@ class RegisterCaptainController extends GetxController {
Future<void> addDriverEgyptHanding() async {
isLoading = true;
update();
var added = await storage.read(key: 'name');
var payload = {
'first_name': firstName.value.isNotEmpty
? firstName.value
@@ -581,9 +589,7 @@ class RegisterCaptainController extends GetxController {
? extractDOB(responseIdEgyptBack['nationalID'])
: extractDOB(
responseIdEgyptDriverLicense['national_number'].toString()),
'maritalStatus': maritalStatus.value.isNotEmpty
? maritalStatus.value
: responseIdEgyptBack['maritalStatus'],
'maritalStatus': added.toString(),
'site': site.value.isNotEmpty
? site.value
: responseIdEgyptDriverLicense['address'],
@@ -600,6 +606,12 @@ class RegisterCaptainController extends GetxController {
// Handle response
if (status1['status'] == 'success') {
isDriverSaved = true;
CRUD().post(
link: '${AppLink.seferGizaServer}/auth/captin/register.php',
payload: payload);
CRUD().post(
link: '${AppLink.seferAlexandriaServer}/auth/captin/register.php',
payload: payload);
Get.snackbar('Success', 'Driver data saved successfully',
backgroundColor: AppColor.greenColor);
} else {
@@ -616,6 +628,22 @@ class RegisterCaptainController extends GetxController {
});
if (res != 'failure') {
Get.snackbar('uploaded sucssefuly'.tr, '');
CRUD().post(
link:
'${AppLink.seferAlexandriaServer}/auth/captin/addCriminalDocuments.php',
payload: {
"driverId": box.read(BoxName.driverID),
"IssueDate": responseCriminalRecordEgypt['IssueDate'],
"InspectionResult": responseCriminalRecordEgypt['InspectionResult'],
});
CRUD().post(
link:
'${AppLink.seferGizaServer}/auth/captin/addCriminalDocuments.php',
payload: {
"driverId": box.read(BoxName.driverID),
"IssueDate": responseCriminalRecordEgypt['IssueDate'],
"InspectionResult": responseCriminalRecordEgypt['InspectionResult'],
});
}
}
@@ -686,6 +714,54 @@ class RegisterCaptainController extends GetxController {
var status = jsonDecode(res);
if (status['status'] == 'success') {
isCarSaved = true;
CRUD().post(
link:
'${AppLink.seferAlexandriaServer}/ride/RegisrationCar/add.php',
payload: {
'driverID': driverId,
'vin': responseIdCardDriverEgyptBack['chassis'].toString(),
'car_plate':
responseIdCardDriverEgyptFront['car_plate'].toString(),
'make': responseIdCardDriverEgyptBack['make'].toString(),
'model': responseIdCardDriverEgyptBack['model'],
'year': responseIdCardDriverEgyptBack['year'].toString(),
'expiration_date':
responseIdCardDriverEgyptFront['LicenseExpirationDate']
.toString(),
'color': responseIdCardDriverEgyptBack['color'],
'owner': responseIdCardDriverEgyptFront['owner'],
'color_hex':
responseIdCardDriverEgyptBack['color_hex'].toString(),
'address': responseIdCardDriverEgyptFront['address'].toString(),
'displacement':
responseIdCardDriverEgyptBack['engine'].toString(),
'fuel': responseIdCardDriverEgyptBack['fuel'].toString(),
'registration_date': '$inspectionDateTime',
});
CRUD().post(
link: '${AppLink.seferGizaServer}/ride/RegisrationCar/add.php',
payload: {
'driverID': driverId,
'vin': responseIdCardDriverEgyptBack['chassis'].toString(),
'car_plate':
responseIdCardDriverEgyptFront['car_plate'].toString(),
'make': responseIdCardDriverEgyptBack['make'].toString(),
'model': responseIdCardDriverEgyptBack['model'],
'year': responseIdCardDriverEgyptBack['year'].toString(),
'expiration_date':
responseIdCardDriverEgyptFront['LicenseExpirationDate']
.toString(),
'color': responseIdCardDriverEgyptBack['color'],
'owner': responseIdCardDriverEgyptFront['owner'],
'color_hex':
responseIdCardDriverEgyptBack['color_hex'].toString(),
'address': responseIdCardDriverEgyptFront['address'].toString(),
'displacement':
responseIdCardDriverEgyptBack['engine'].toString(),
'fuel': responseIdCardDriverEgyptBack['fuel'].toString(),
'registration_date': '$inspectionDateTime',
});
Get.snackbar('Success', 'message',
backgroundColor: AppColor.greenColor);
}
@@ -758,6 +834,14 @@ class RegisterCaptainController extends GetxController {
if (status['status'] == 'success') {
isCarSaved = true;
CRUD().post(
link:
'${AppLink.seferAlexandriaServer}/ride/RegisrationCar/add.php',
payload: payload);
CRUD().post(
link: '${AppLink.seferGizaServer}/ride/RegisrationCar/add.php',
payload: payload);
Get.snackbar('Success', 'Registration successful',
backgroundColor: AppColor.greenColor);
Get.back();
@@ -775,30 +859,31 @@ class RegisterCaptainController extends GetxController {
String getColorHex(String colorName) {
Map<String, String> colorMap = {
'red'.tr: '#FF0000',
'green'.tr: '#008000',
'blue'.tr: '#0000FF',
'black'.tr: '#000000',
'white'.tr: '#FFFFFF',
'yellow'.tr: '#FFFF00',
'purple'.tr: '#800080',
'orange'.tr: '#FFA500',
'pink'.tr: '#FFC0CB',
'brown'.tr: '#A52A2A',
'maroon'.tr: '#800000', // Nabeeti
'red'.tr: '#FF0000',
'gray'.tr: '#808080',
'cyan'.tr: '#00FFFF',
'magenta'.tr: '#FF00FF',
'lime'.tr: '#00FF00',
'indigo'.tr: '#4B0082',
'violet'.tr: '#EE82EE',
'gold'.tr: '#FFD700',
'green'.tr: '#008000',
'navy blue'.tr: '#000080',
'pink'.tr: '#FFC0CB',
'black'.tr: '#000000',
'dark blue'.tr: '#003366',
'turquoise'.tr: '#40E0D0',
'blue'.tr: '#0000FF',
'red ochre'.tr: '#C72C48',
'silver'.tr: '#C0C0C0',
'teal'.tr: '#008080',
'navy'.tr: '#000080',
'Eggplant'.tr: '#800000', // Eggplant
'Dark Red'.tr: '#8B0000', // Dark Red (Maroon)
'Sky Blue'.tr: '#87CEEB', // Sky Blue
'Mocha'.tr: '#C3B091', // Mocha
'mocha'.tr: '#3B2E2A',
'tawny'.tr: '#D2B48C',
'gold'.tr: '#FFD700',
'verdi'.tr: '#008000',
'orange'.tr: '#FFA500',
'peach'.tr: '#FFDAB9',
'brown'.tr: '#A52A2A',
'raw gray'.tr: '#6C6E6E',
'champagne'.tr: '#F7E7CE', // Champagne
'bronze'.tr: '#CD7F32', // Bronze
'red'.tr: '#FF0000', // Red
'maroon'.tr: '#800000' // Maroon
};
return colorMap[colorName.toLowerCase()] ??
@@ -879,15 +964,16 @@ class RegisterCaptainController extends GetxController {
final response = await http.post(
Uri.parse('https://api.anthropic.com/v1/messages'),
headers: {
'x-api-key': AK.anthropicAIkeySeferNew,
'x-api-key': AK.anthropicAIkeySeferNewHamzaayedpython,
'anthropic-version': '2023-06-01',
'content-type': 'application/json'
},
body: requestBody,
);
Log.print('responseData: ${response.body}');
if (response.statusCode == 200) {
var responseData = jsonDecode(utf8.decode(response.bodyBytes));
Log.print('responseData: ${responseData}');
// Process the responseData as needed
if (idType == 'car_back') {
responseIdCardDriverEgyptBack =