openAttachmentNoteModal method
Implementation
Future<void> openAttachmentNoteModal(
Attachment? attachment, {
bool isEditable = true,
}) async {
noteName.value = attachment?.fileName ?? "";
if (attachment != null) {
try {
attachment.isLoadingContent = true;
attachments.refresh();
update();
String? content = await AttachmentService.readAttachmentContent(
attachment.id,
);
noteContent.value = content ?? "";
attachment.isLoadingContent = false;
update();
attachments.refresh();
} catch (e) {
attachment.isLoadingContent = false;
noteContent.value = "";
attachments.refresh();
update();
}
} else {
noteContent.value = "";
}
noteNameController.text = noteName.value;
noteContentController.text = noteContent.value;
openAttachmentNote.value = attachment;
update();
showAttachmentNoteModal(isEditable: isEditable);
}