You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
107 lines
2.6 KiB
Dart
107 lines
2.6 KiB
Dart
import 'dart:convert';
|
|
import 'dart:typed_data';
|
|
|
|
import 'package:diplomaticquarterapp/uitl/utils.dart';
|
|
|
|
class DoctorPrePostImages {
|
|
DoctorPrePostImageModel? pre;
|
|
DoctorPrePostImageModel? post;
|
|
|
|
Uint8List getPreBytes(){
|
|
try{
|
|
var b64 = pre!.imageStr!.replaceFirst('data:image/png;base64,', '');
|
|
if(pre!.imageStr != null && isBase64(b64))
|
|
return Utils.dataFromBase64String(b64);
|
|
}catch(e){
|
|
|
|
}
|
|
return Uint8List(0);
|
|
}
|
|
|
|
Uint8List getPostBytes(){
|
|
try{
|
|
var b64 = post!.imageStr!.replaceFirst('data:image/png;base64,', '');
|
|
if(post!.imageStr != null && isBase64(b64))
|
|
return Utils.dataFromBase64String(b64);
|
|
}catch(e){
|
|
|
|
}
|
|
return Uint8List(0);
|
|
}
|
|
|
|
bool isBase64(String str) {
|
|
RegExp _base64 = RegExp(
|
|
r'^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=|[A-Za-z0-9+\/]{4})$');
|
|
return _base64.hasMatch(str);
|
|
}
|
|
}
|
|
|
|
class DoctorPrePostImageModel {
|
|
String? setupID;
|
|
int? projectID;
|
|
int? clinicId;
|
|
int? doctorId;
|
|
int? lineItemNo;
|
|
String? imageStr;
|
|
int? imageType;
|
|
String? description;
|
|
dynamic isNewUpdated;
|
|
bool? isActive;
|
|
String? createdOn;
|
|
int? createdBy;
|
|
dynamic editedOn;
|
|
dynamic editedBy;
|
|
|
|
DoctorPrePostImageModel({
|
|
this.setupID,
|
|
this.projectID,
|
|
this.clinicId,
|
|
this.doctorId,
|
|
this.lineItemNo,
|
|
this.imageStr,
|
|
this.imageType,
|
|
this.description,
|
|
this.isNewUpdated,
|
|
this.isActive,
|
|
this.createdOn,
|
|
this.createdBy,
|
|
this.editedOn,
|
|
this.editedBy});
|
|
|
|
DoctorPrePostImageModel.fromJson(dynamic json) {
|
|
setupID = json["SetupID"];
|
|
projectID = json["ProjectID"];
|
|
clinicId = json["ClinicId"];
|
|
doctorId = json["DoctorId"];
|
|
lineItemNo = json["LineItemNo"];
|
|
imageStr = json["ImageStr"];
|
|
imageType = json["ImageType"];
|
|
description = json["Description"];
|
|
isNewUpdated = json["IsNewUpdated"];
|
|
isActive = json["IsActive"];
|
|
createdOn = json["CreatedOn"];
|
|
createdBy = json["CreatedBy"];
|
|
editedOn = json["EditedOn"];
|
|
editedBy = json["EditedBy"];
|
|
}
|
|
|
|
Map<String, dynamic> toJson() {
|
|
var map = <String, dynamic>{};
|
|
map["SetupID"] = setupID;
|
|
map["ProjectID"] = projectID;
|
|
map["ClinicId"] = clinicId;
|
|
map["DoctorId"] = doctorId;
|
|
map["LineItemNo"] = lineItemNo;
|
|
map["ImageStr"] = imageStr;
|
|
map["ImageType"] = imageType;
|
|
map["Description"] = description;
|
|
map["IsNewUpdated"] = isNewUpdated;
|
|
map["IsActive"] = isActive;
|
|
map["CreatedOn"] = createdOn;
|
|
map["CreatedBy"] = createdBy;
|
|
map["EditedOn"] = editedOn;
|
|
map["EditedBy"] = editedBy;
|
|
return map;
|
|
}
|
|
|
|
} |