11/27/1
This commit is contained in:
@@ -26,14 +26,13 @@ class CRUD {
|
||||
// 'Basic ${base64Encode(utf8.encode(basicAuthCredentials.toString()))}',
|
||||
},
|
||||
);
|
||||
//print("-----basicAuthCredentials----" + AK.basicAuthCredentials.toString());
|
||||
//print("-----request----" + response.request.toString());
|
||||
//print("-----headers-----" + response.headers.toString());
|
||||
//print("-----payload-----" + payload.toString());
|
||||
// print("-----request----" + response.request.toString());
|
||||
// print("-----headers-----" + response.headers.toString());
|
||||
// print("-----payload-----" + payload.toString());
|
||||
if (response.statusCode == 200) {
|
||||
var jsonData = jsonDecode(response.body);
|
||||
if (jsonData['status'] == 'success') {
|
||||
// //print(jsonData);
|
||||
// print(jsonData);
|
||||
|
||||
return response.body;
|
||||
}
|
||||
|
||||
@@ -6,20 +6,16 @@ import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:image_picker/image_picker.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:path/path.dart' as path;
|
||||
import 'package:path_provider/path_provider.dart' as path_provider;
|
||||
import 'package:ride/constant/api_key.dart';
|
||||
import 'package:ride/constant/box_name.dart';
|
||||
import 'package:ride/constant/colors.dart';
|
||||
import 'package:ride/constant/credential.dart';
|
||||
import 'package:ride/constant/info.dart';
|
||||
import 'package:ride/constant/links.dart';
|
||||
import 'package:ride/constant/style.dart';
|
||||
import 'package:ride/constant/table_names.dart';
|
||||
import 'package:ride/env/env.dart';
|
||||
import 'package:ride/main.dart';
|
||||
import 'package:ride/views/widgets/elevated_btn.dart';
|
||||
|
||||
import '../../constant/links.dart';
|
||||
import '../../views/auth/captin/car_license_page.dart';
|
||||
import 'launch.dart';
|
||||
|
||||
@@ -232,6 +228,7 @@ class ScanDocumentsByApi extends GetxController {
|
||||
late Uint8List imageDocumentFrontSide;
|
||||
XFile? image;
|
||||
XFile? imageFace;
|
||||
late File tempFile;
|
||||
late String imagePath;
|
||||
DateTime now = DateTime.now();
|
||||
late String name;
|
||||
@@ -326,7 +323,7 @@ class ScanDocumentsByApi extends GetxController {
|
||||
responseMap['data']['image']['portrait'] != null) {
|
||||
imagePortrait = base64Decode(responseMap['data']['image']['portrait']);
|
||||
String tempPath = Directory.systemTemp.path;
|
||||
File tempFile = File('$tempPath/image.jpg');
|
||||
tempFile = File('$tempPath/image.jpg');
|
||||
await tempFile.writeAsBytes(imagePortrait);
|
||||
|
||||
imagePath = tempFile.path;
|
||||
@@ -480,7 +477,11 @@ class ScanDocumentsByApi extends GetxController {
|
||||
)
|
||||
: MyElevatedButton(
|
||||
title: 'Next'.tr,
|
||||
onPressed: () => Get.to(() => CarLicensePage()),
|
||||
onPressed: () async {
|
||||
await uploadImage(
|
||||
tempFile, AppLink.uploadImagePortrate);
|
||||
Get.to(() => CarLicensePage());
|
||||
},
|
||||
kolor: AppColor.greenColor,
|
||||
));
|
||||
} else {
|
||||
@@ -489,12 +490,12 @@ class ScanDocumentsByApi extends GetxController {
|
||||
}
|
||||
// Todo upload images and fields
|
||||
|
||||
Future<String> uploadImage(File imageFile) async {
|
||||
Future<String> uploadImage(File imageFile, String link) async {
|
||||
String? basicAuthCredentials =
|
||||
await storage.read(key: BoxName.basicAuthCredentials);
|
||||
var request = http.MultipartRequest(
|
||||
'POST',
|
||||
Uri.parse(AppLink.uploadImage),
|
||||
Uri.parse(link), //AppLink.uploadImage
|
||||
);
|
||||
|
||||
// Attach the image file to the request
|
||||
|
||||
Reference in New Issue
Block a user