Update: 2026-06-26 17:29:23
This commit is contained in:
@@ -1,16 +1,15 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:ffi';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
|
||||
import '../../constant/api_key.dart';
|
||||
import '../../constant/box_name.dart';
|
||||
import '../../constant/colors.dart';
|
||||
import '../../constant/info.dart';
|
||||
import '../../constant/links.dart';
|
||||
import '../../constant/style.dart';
|
||||
import '../../main.dart';
|
||||
import '../../views/widgets/snackbar.dart';
|
||||
import '../functions/crud.dart';
|
||||
|
||||
class RegisterCaptainController extends GetxController {
|
||||
@@ -102,7 +101,7 @@ class RegisterCaptainController extends GetxController {
|
||||
driverNotCompleteRegistration = d;
|
||||
update();
|
||||
} else {
|
||||
Get.snackbar(res, '');
|
||||
mySnackbarError(res);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -279,9 +278,7 @@ class RegisterCaptainController extends GetxController {
|
||||
await addRegistrationCarEgypt();
|
||||
|
||||
if (isCarSaved && isDriverSaved) {
|
||||
Get.snackbar('added', '',
|
||||
backgroundColor:
|
||||
AppColor.greenColor); // Get.offAll(() => HomeCaptain());
|
||||
mySnackbarSuccess('added'); // Get.offAll(() => HomeCaptain());
|
||||
// Get.offAll(() => HomeCaptain());
|
||||
}
|
||||
}
|
||||
@@ -348,11 +345,9 @@ class RegisterCaptainController extends GetxController {
|
||||
// Handle response
|
||||
if (status1['status'] == 'success') {
|
||||
isDriverSaved = true;
|
||||
Get.snackbar('Success', 'Driver data saved successfully',
|
||||
backgroundColor: AppColor.greenColor);
|
||||
mySnackbarSuccess('Driver data saved successfully');
|
||||
} else {
|
||||
Get.snackbar('Error', 'Failed to save driver data',
|
||||
backgroundColor: Colors.red);
|
||||
mySnackbarError('Failed to save driver data');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -363,7 +358,7 @@ class RegisterCaptainController extends GetxController {
|
||||
"InspectionResult": responseCriminalRecordEgypt['InspectionResult'],
|
||||
});
|
||||
if (res != 'failure') {
|
||||
Get.snackbar('uploaded sucssefuly'.tr, '');
|
||||
mySnackbarSuccess('uploaded sucssefuly'.tr);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -394,8 +389,7 @@ class RegisterCaptainController extends GetxController {
|
||||
var status = jsonDecode(res);
|
||||
if (status['status'] == 'success') {
|
||||
isCarSaved = true;
|
||||
Get.snackbar('Success', 'message',
|
||||
backgroundColor: AppColor.greenColor);
|
||||
mySnackbarSuccess('message');
|
||||
}
|
||||
} catch (e) {}
|
||||
}
|
||||
@@ -557,7 +551,6 @@ class RegisterCaptainController extends GetxController {
|
||||
var responseData = jsonDecode(response.body);
|
||||
// Process the responseData as needed
|
||||
|
||||
var result = responseData['candidates'][0]['content']['parts'][0]['text'];
|
||||
RegExp regex = RegExp(r"```json([^`]*)```");
|
||||
String? jsonString =
|
||||
regex.firstMatch(responseData.toString())?.group(1)?.trim();
|
||||
@@ -580,8 +573,7 @@ class RegisterCaptainController extends GetxController {
|
||||
|
||||
update();
|
||||
} else {
|
||||
Get.snackbar('Error', "JSON string not found",
|
||||
backgroundColor: AppColor.redColor);
|
||||
mySnackbarError("JSON string not found");
|
||||
}
|
||||
|
||||
// Rest of your code...
|
||||
|
||||
Reference in New Issue
Block a user