Basic event based rendering

This commit is contained in:
2024-06-28 00:59:11 +08:00
parent bbc9ea69f7
commit 78f9ad941b
11 changed files with 352 additions and 275 deletions

View File

@ -9,15 +9,12 @@ class Event {
DateTime? deletedAt;
Map<String, dynamic> body;
String type;
List<int>? attachments;
Channel? channel;
Sender sender;
int? replyId;
Event? replyTo;
int channelId;
int senderId;
bool isSending = false;
bool isPending = false;
Event({
required this.id,
@ -27,11 +24,8 @@ class Event {
this.deletedAt,
required this.body,
required this.type,
this.attachments,
this.channel,
required this.sender,
required this.replyId,
required this.replyTo,
required this.channelId,
required this.senderId,
});
@ -44,15 +38,9 @@ class Event {
deletedAt: json['deleted_at'],
body: json['body'],
type: json['type'],
attachments: json['attachments'] != null
? List<int>.from(json['attachments'])
: null,
channel:
json['channel'] != null ? Channel.fromJson(json['channel']) : null,
sender: Sender.fromJson(json['sender']),
replyId: json['reply_id'],
replyTo:
json['reply_to'] != null ? Event.fromJson(json['reply_to']) : null,
channelId: json['channel_id'],
senderId: json['sender_id'],
);
@ -65,11 +53,8 @@ class Event {
'deleted_at': deletedAt,
'body': body,
'type': type,
'attachments': attachments,
'channel': channel?.toJson(),
'sender': sender.toJson(),
'reply_id': replyId,
'reply_to': replyTo?.toJson(),
'channel_id': channelId,
'sender_id': senderId,
};