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.
208 lines
8.4 KiB
Dart
208 lines
8.4 KiB
Dart
import 'dart:convert';
|
|
import 'dart:io';
|
|
import 'dart:typed_data';
|
|
|
|
import 'package:flutter/foundation.dart';
|
|
import 'package:just_audio/just_audio.dart';
|
|
|
|
List<SingleUserChatModel> singleUserChatModelFromJson(String str) => List<SingleUserChatModel>.from(json.decode(str).map((x) => SingleUserChatModel.fromJson(x)));
|
|
|
|
String singleUserChatModelToJson(List<SingleUserChatModel> data) => json.encode(List<dynamic>.from(data.map((x) => x.toJson())));
|
|
|
|
class SingleUserChatModel {
|
|
SingleUserChatModel(
|
|
{this.userChatHistoryId,
|
|
this.userChatHistoryLineId,
|
|
this.contant,
|
|
this.contantNo,
|
|
this.currentUserId,
|
|
this.currentUserName,
|
|
this.targetUserId,
|
|
this.targetUserName,
|
|
this.encryptedTargetUserId,
|
|
this.encryptedTargetUserName,
|
|
this.currentUserEmail,
|
|
this.targetUserEmail,
|
|
this.chatEventId,
|
|
this.fileTypeId,
|
|
this.isSeen,
|
|
this.isDelivered,
|
|
this.createdDate,
|
|
this.chatSource,
|
|
this.conversationId,
|
|
this.fileTypeResponse,
|
|
this.userChatReplyResponse,
|
|
this.isReplied,
|
|
this.isImageLoaded,
|
|
this.image,
|
|
this.voice,
|
|
this.voiceController});
|
|
|
|
int? userChatHistoryId;
|
|
int? userChatHistoryLineId;
|
|
String? contant;
|
|
String? contantNo;
|
|
int? currentUserId;
|
|
String? currentUserName;
|
|
String? currentUserEmail;
|
|
int? targetUserId;
|
|
String? targetUserName;
|
|
String? targetUserEmail;
|
|
String? encryptedTargetUserId;
|
|
String? encryptedTargetUserName;
|
|
int? chatEventId;
|
|
dynamic fileTypeId;
|
|
bool? isSeen;
|
|
bool? isDelivered;
|
|
DateTime? createdDate;
|
|
int? chatSource;
|
|
String? conversationId;
|
|
FileTypeResponse? fileTypeResponse;
|
|
UserChatReplyResponse? userChatReplyResponse;
|
|
bool? isReplied;
|
|
bool? isImageLoaded;
|
|
Uint8List? image;
|
|
File? voice;
|
|
AudioPlayer? voiceController;
|
|
|
|
factory SingleUserChatModel.fromJson(Map<String, dynamic> json) => SingleUserChatModel(
|
|
userChatHistoryId: json["userChatHistoryId"] == null ? null : json["userChatHistoryId"],
|
|
userChatHistoryLineId: json["userChatHistoryLineId"] == null ? null : json["userChatHistoryLineId"],
|
|
contant: json["contant"] == null ? null : json["contant"],
|
|
contantNo: json["contantNo"] == null ? null : json["contantNo"],
|
|
currentUserId: json["currentUserId"] == null ? null : json["currentUserId"],
|
|
currentUserName: json["currentUserName"] == null ? null : json["currentUserName"],
|
|
targetUserId: json["targetUserId"] == null ? null : json["targetUserId"],
|
|
targetUserName: json["targetUserName"] == null ? null : json["targetUserName"],
|
|
targetUserEmail: json["targetUserEmail"] == null ? null : json["targetUserEmail"],
|
|
currentUserEmail: json["currentUserEmail"] == null ? null : json["currentUserEmail"],
|
|
encryptedTargetUserId: json["encryptedTargetUserId"] == null ? null : json["encryptedTargetUserId"],
|
|
encryptedTargetUserName: json["encryptedTargetUserName"] == null ? null : json["encryptedTargetUserName"],
|
|
chatEventId: json["chatEventId"] == null ? null : json["chatEventId"],
|
|
fileTypeId: json["fileTypeId"],
|
|
isSeen: json["isSeen"] == null ? null : json["isSeen"],
|
|
isDelivered: json["isDelivered"] == null ? null : json["isDelivered"],
|
|
createdDate: json["createdDate"] == null ? null : DateTime.parse(json["createdDate"]),
|
|
chatSource: json["chatSource"] == null ? null : json["chatSource"],
|
|
conversationId: json["conversationId"] == null ? null : json["conversationId"],
|
|
fileTypeResponse: json["fileTypeResponse"] == null ? null : FileTypeResponse.fromJson(json["fileTypeResponse"]),
|
|
userChatReplyResponse: json["userChatReplyResponse"] == null ? null : UserChatReplyResponse.fromJson(json["userChatReplyResponse"]),
|
|
isReplied: false,
|
|
isImageLoaded: false,
|
|
image: null,
|
|
voice: null,
|
|
voiceController: json["fileTypeId"] == 13 ? AudioPlayer() : null);
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
"userChatHistoryId": userChatHistoryId == null ? null : userChatHistoryId,
|
|
"userChatHistoryLineId": userChatHistoryLineId == null ? null : userChatHistoryLineId,
|
|
"contant": contant == null ? null : contant,
|
|
"contantNo": contantNo == null ? null : contantNo,
|
|
"currentUserId": currentUserId == null ? null : currentUserId,
|
|
"currentUserName": currentUserName == null ? null : currentUserName,
|
|
"targetUserId": targetUserId == null ? null : targetUserId,
|
|
"targetUserName": targetUserName == null ? null : targetUserName,
|
|
"encryptedTargetUserId": encryptedTargetUserId == null ? null : encryptedTargetUserId,
|
|
"encryptedTargetUserName": encryptedTargetUserName == null ? null : encryptedTargetUserName,
|
|
"currentUserEmail": currentUserEmail == null ? null : currentUserEmail,
|
|
"targetUserEmail": targetUserEmail == null ? null : targetUserEmail,
|
|
"chatEventId": chatEventId == null ? null : chatEventId,
|
|
"fileTypeId": fileTypeId,
|
|
"isSeen": isSeen == null ? null : isSeen,
|
|
"isDelivered": isDelivered == null ? null : isDelivered,
|
|
"createdDate": createdDate == null ? null : createdDate!.toIso8601String(),
|
|
"chatSource": chatSource == null ? null : chatSource,
|
|
"conversationId": conversationId == null ? null : conversationId,
|
|
"fileTypeResponse": fileTypeResponse == null ? null : fileTypeResponse!.toJson(),
|
|
"userChatReplyResponse": userChatReplyResponse == null ? null : userChatReplyResponse!.toJson(),
|
|
};
|
|
}
|
|
|
|
class FileTypeResponse {
|
|
FileTypeResponse({
|
|
this.fileTypeId,
|
|
this.fileTypeName,
|
|
this.fileTypeDescription,
|
|
this.fileKind,
|
|
this.fileName,
|
|
});
|
|
|
|
int? fileTypeId;
|
|
dynamic fileTypeName;
|
|
dynamic fileTypeDescription;
|
|
dynamic fileKind;
|
|
dynamic fileName;
|
|
|
|
factory FileTypeResponse.fromJson(Map<String, dynamic> json) => FileTypeResponse(
|
|
fileTypeId: json["fileTypeId"] == null ? null : json["fileTypeId"],
|
|
fileTypeName: json["fileTypeName"],
|
|
fileTypeDescription: json["fileTypeDescription"],
|
|
fileKind: json["fileKind"],
|
|
fileName: json["fileName"],
|
|
);
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
"fileTypeId": fileTypeId == null ? null : fileTypeId,
|
|
"fileTypeName": fileTypeName,
|
|
"fileTypeDescription": fileTypeDescription,
|
|
"fileKind": fileKind,
|
|
"fileName": fileName,
|
|
};
|
|
}
|
|
|
|
class UserChatReplyResponse {
|
|
UserChatReplyResponse(
|
|
{this.userChatHistoryId,
|
|
this.chatEventId,
|
|
this.contant,
|
|
this.contantNo,
|
|
this.fileTypeId,
|
|
this.createdDate,
|
|
this.targetUserId,
|
|
this.targetUserName,
|
|
this.fileTypeResponse,
|
|
this.isImageLoaded,
|
|
this.image,
|
|
this.voice});
|
|
|
|
int? userChatHistoryId;
|
|
int? chatEventId;
|
|
String? contant;
|
|
String? contantNo;
|
|
dynamic fileTypeId;
|
|
DateTime? createdDate;
|
|
int? targetUserId;
|
|
String? targetUserName;
|
|
FileTypeResponse? fileTypeResponse;
|
|
bool? isImageLoaded;
|
|
Uint8List? image;
|
|
Uint8List? voice;
|
|
|
|
factory UserChatReplyResponse.fromJson(Map<String, dynamic> json) => UserChatReplyResponse(
|
|
userChatHistoryId: json["userChatHistoryId"] == null ? null : json["userChatHistoryId"],
|
|
chatEventId: json["chatEventId"] == null ? null : json["chatEventId"],
|
|
contant: json["contant"] == null ? null : json["contant"],
|
|
contantNo: json["contantNo"] == null ? null : json["contantNo"],
|
|
fileTypeId: json["fileTypeId"],
|
|
createdDate: json["createdDate"] == null ? null : DateTime.parse(json["createdDate"]),
|
|
targetUserId: json["targetUserId"] == null ? null : json["targetUserId"],
|
|
targetUserName: json["targetUserName"] == null ? null : json["targetUserName"],
|
|
fileTypeResponse: json["fileTypeResponse"] == null ? null : FileTypeResponse.fromJson(json["fileTypeResponse"]),
|
|
isImageLoaded: false,
|
|
image: null,
|
|
voice: null,
|
|
);
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
"userChatHistoryId": userChatHistoryId == null ? null : userChatHistoryId,
|
|
"chatEventId": chatEventId == null ? null : chatEventId,
|
|
"contant": contant == null ? null : contant,
|
|
"contantNo": contantNo == null ? null : contantNo,
|
|
"fileTypeId": fileTypeId,
|
|
"createdDate": createdDate == null ? null : createdDate!.toIso8601String(),
|
|
"targetUserId": targetUserId == null ? null : targetUserId,
|
|
"targetUserName": targetUserName == null ? null : targetUserName,
|
|
"fileTypeResponse": fileTypeResponse == null ? null : fileTypeResponse!.toJson(),
|
|
};
|
|
}
|