// 日记元素 Isar Collection — 本地持久化存储 // // 与纯 Dart 模型 JournalElement 分离,通过转换函数桥接。 // journalId 索引支持按日记查询所有元素。 import 'package:isar/isar.dart'; part 'journal_element_collection.g.dart'; @collection class JournalElementCollection { /// Isar 自增主键 Id isarId = Isar.autoIncrement; /// 业务 UUID(索引) @Index() String id = ''; /// 所属日记 ID(索引,用于外键查询) @Index() String journalId = ''; /// 元素类型(enum → string: text/image/sticker/handwriting_ref/tape) String elementType = 'text'; /// X 坐标 double positionX = 0; /// Y 坐标 double positionY = 0; /// 宽度 double width = 100; /// 高度 double height = 100; /// 旋转角度 double rotation = 0; /// 层级 int zIndex = 0; /// 结构化内容(JSON String) /// text: {'text':'...','fontSize':16.0} /// image: {'filePath':'...'} /// sticker: {'stickerPackId':'...','stickerId':'...'} /// handwriting_ref: {'strokesJson':'...','strokeCount':42} /// tape: {'tapeStyle':'washi_dots'} String contentJson = '{}'; /// 版本号(乐观锁) int version = 1; /// 创建时间(epoch milliseconds) int createdAtEpoch = 0; /// 更新时间(epoch milliseconds) int updatedAtEpoch = 0; /// 软删除标记 bool isDeleted = false; }