mirror of
https://git.meshkee.com/applications/cssd.git
synced 2026-10-13 19:58:55 +03:30
Fix upload image file bug
This commit is contained in:
@@ -108,7 +108,7 @@ class ItemProvider extends ChangeNotifier {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<String> addImage(String batchId, dynamic file, String fileName) async {
|
Future<String> addImage(String batchId, dynamic file, String fileName) async {
|
||||||
var imageListInt = file.cast<int>();
|
Uint8List imageListInt = Uint8List.fromList(file.cast<int>());
|
||||||
var dio = new Dio();
|
var dio = new Dio();
|
||||||
dio.options.headers = {
|
dio.options.headers = {
|
||||||
'Authorization': User.token,
|
'Authorization': User.token,
|
||||||
@@ -121,15 +121,10 @@ class ItemProvider extends ChangeNotifier {
|
|||||||
"file": MultipartFile.fromBytes(imageListInt, filename: fileName)
|
"file": MultipartFile.fromBytes(imageListInt, filename: fileName)
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
await dio.post(
|
await dio.post(
|
||||||
Url.addImage,
|
Url.addImage,
|
||||||
data: formData,
|
data: formData,
|
||||||
);
|
);
|
||||||
// print(response.statusCode);
|
|
||||||
// print(response.statusMessage);
|
|
||||||
// print(response.data);
|
|
||||||
|
|
||||||
return 'Added';
|
return 'Added';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'dart:typed_data';
|
import 'dart:typed_data';
|
||||||
// import 'dart:typed_data';
|
|
||||||
import 'package:dio/dio.dart' as di;
|
import 'package:dio/dio.dart' as di;
|
||||||
|
|
||||||
import 'package:cssd/config/urls.dart';
|
import 'package:cssd/config/urls.dart';
|
||||||
import 'package:cssd/config/user.dart';
|
import 'package:cssd/config/user.dart';
|
||||||
import 'package:cssd/models/test_result_models.dart';
|
import 'package:cssd/models/test_result_models.dart';
|
||||||
@@ -125,6 +123,7 @@ class TestResultsProvider with ChangeNotifier {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
bool isloadingButton = false;
|
bool isloadingButton = false;
|
||||||
|
|
||||||
void resetLoadingButton() {
|
void resetLoadingButton() {
|
||||||
isloadingButton = false;
|
isloadingButton = false;
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
@@ -144,8 +143,7 @@ class TestResultsProvider with ChangeNotifier {
|
|||||||
items = [];
|
items = [];
|
||||||
searchBoxValue = value;
|
searchBoxValue = value;
|
||||||
originalItems!.forEach((result) {
|
originalItems!.forEach((result) {
|
||||||
if (
|
if (result.name
|
||||||
result.name
|
|
||||||
.toString()
|
.toString()
|
||||||
.toLowerCase()
|
.toLowerCase()
|
||||||
.contains(searchBoxValue.toLowerCase()) ||
|
.contains(searchBoxValue.toLowerCase()) ||
|
||||||
@@ -160,8 +158,7 @@ class TestResultsProvider with ChangeNotifier {
|
|||||||
result.name
|
result.name
|
||||||
.toString()
|
.toString()
|
||||||
.toUpperCase()
|
.toUpperCase()
|
||||||
.contains(searchBoxValue.toLowerCase())
|
.contains(searchBoxValue.toLowerCase())) {
|
||||||
) {
|
|
||||||
items!.add(result);
|
items!.add(result);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -261,7 +258,8 @@ class TestResultsProvider with ChangeNotifier {
|
|||||||
TestResultObject(
|
TestResultObject(
|
||||||
id: item['id'].toString(),
|
id: item['id'].toString(),
|
||||||
name: item['test_type'] != null ? item['test_type']['name'] : '',
|
name: item['test_type'] != null ? item['test_type']['name'] : '',
|
||||||
deviceId: item['device_id'] != null ? item['device_id'].toString() : '',
|
deviceId:
|
||||||
|
item['device_id'] != null ? item['device_id'].toString() : '',
|
||||||
result: item['result'] == 'Accept' ? 'Accepted' : 'Not Accepted',
|
result: item['result'] == 'Accept' ? 'Accepted' : 'Not Accepted',
|
||||||
date: item['created_at'].toString().substring(0, 10),
|
date: item['created_at'].toString().substring(0, 10),
|
||||||
hospital: item['user']['medical_center']['name'],
|
hospital: item['user']['medical_center']['name'],
|
||||||
@@ -289,7 +287,7 @@ class TestResultsProvider with ChangeNotifier {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<String> addImage(String batchId, dynamic file, String fileName) async {
|
Future<String> addImage(String batchId, dynamic file, String fileName) async {
|
||||||
var imageListInt = file.cast<int>();
|
Uint8List imageListInt = Uint8List.fromList(file.cast<int>());
|
||||||
var dio = new di.Dio();
|
var dio = new di.Dio();
|
||||||
dio.options.headers = {
|
dio.options.headers = {
|
||||||
'Authorization': User.token,
|
'Authorization': User.token,
|
||||||
|
|||||||
Reference in New Issue
Block a user