📊 数据持久化阶段完成: - 完成4个数据模型的Hive集成(Book, Bookshelf, Bookmark, Highlight) - 实现4个Repository数据访问层 - 生成5个TypeAdapter自动序列化文件 - 完成所有模型的CRUD操作和测试验证 📚 项目文档更新: - 新增数据持久化阶段完成总结文档 - 更新CLAUDE.md项目主文档 - 完善项目结构说明和开发进度 🚀 UI开发阶段规划: - 定义产品定位:类似微信读书的Material Design电子书阅读器 - 制定4阶段开发计划:UI基础架构→顶部导航→首页内容→数据集成 - 明确页面结构:底部Tab导航(首页/书库/统计/我的) - 规划核心功能:搜索、导入、最近阅读、摘录列表 🎯 下一里程碑: - 开始UI基础架构搭建 - 实现底部Tab导航和Material Design主题系统 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
175 lines
4.2 KiB
Dart
175 lines
4.2 KiB
Dart
// GENERATED CODE - DO NOT MODIFY BY HAND
|
|
|
|
part of 'highlight.dart';
|
|
|
|
// **************************************************************************
|
|
// TypeAdapterGenerator
|
|
// **************************************************************************
|
|
|
|
class HighlightAdapter extends TypeAdapter<Highlight> {
|
|
@override
|
|
final int typeId = 8;
|
|
|
|
@override
|
|
Highlight read(BinaryReader reader) {
|
|
final numOfFields = reader.readByte();
|
|
final fields = <int, dynamic>{
|
|
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
|
|
};
|
|
return Highlight(
|
|
id: fields[0] as String,
|
|
bookId: fields[1] as String,
|
|
chapterId: fields[2] as String?,
|
|
selectedText: fields[3] as String,
|
|
startIndex: fields[4] as int,
|
|
endIndex: fields[5] as int,
|
|
color: fields[6] as HighlightColor,
|
|
createdTime: fields[7] as DateTime,
|
|
annotation: fields[8] as String?,
|
|
annotationType: fields[9] as AnnotationType?,
|
|
annotationTime: fields[10] as DateTime?,
|
|
);
|
|
}
|
|
|
|
@override
|
|
void write(BinaryWriter writer, Highlight obj) {
|
|
writer
|
|
..writeByte(11)
|
|
..writeByte(0)
|
|
..write(obj.id)
|
|
..writeByte(1)
|
|
..write(obj.bookId)
|
|
..writeByte(2)
|
|
..write(obj.chapterId)
|
|
..writeByte(3)
|
|
..write(obj.selectedText)
|
|
..writeByte(4)
|
|
..write(obj.startIndex)
|
|
..writeByte(5)
|
|
..write(obj.endIndex)
|
|
..writeByte(6)
|
|
..write(obj.color)
|
|
..writeByte(7)
|
|
..write(obj.createdTime)
|
|
..writeByte(8)
|
|
..write(obj.annotation)
|
|
..writeByte(9)
|
|
..write(obj.annotationType)
|
|
..writeByte(10)
|
|
..write(obj.annotationTime);
|
|
}
|
|
|
|
@override
|
|
int get hashCode => typeId.hashCode;
|
|
|
|
@override
|
|
bool operator ==(Object other) =>
|
|
identical(this, other) ||
|
|
other is HighlightAdapter &&
|
|
runtimeType == other.runtimeType &&
|
|
typeId == other.typeId;
|
|
}
|
|
|
|
class HighlightColorAdapter extends TypeAdapter<HighlightColor> {
|
|
@override
|
|
final int typeId = 6;
|
|
|
|
@override
|
|
HighlightColor read(BinaryReader reader) {
|
|
switch (reader.readByte()) {
|
|
case 0:
|
|
return HighlightColor.yellow;
|
|
case 1:
|
|
return HighlightColor.orange;
|
|
case 2:
|
|
return HighlightColor.green;
|
|
case 3:
|
|
return HighlightColor.blue;
|
|
case 4:
|
|
return HighlightColor.pink;
|
|
default:
|
|
return HighlightColor.yellow;
|
|
}
|
|
}
|
|
|
|
@override
|
|
void write(BinaryWriter writer, HighlightColor obj) {
|
|
switch (obj) {
|
|
case HighlightColor.yellow:
|
|
writer.writeByte(0);
|
|
break;
|
|
case HighlightColor.orange:
|
|
writer.writeByte(1);
|
|
break;
|
|
case HighlightColor.green:
|
|
writer.writeByte(2);
|
|
break;
|
|
case HighlightColor.blue:
|
|
writer.writeByte(3);
|
|
break;
|
|
case HighlightColor.pink:
|
|
writer.writeByte(4);
|
|
break;
|
|
}
|
|
}
|
|
|
|
@override
|
|
int get hashCode => typeId.hashCode;
|
|
|
|
@override
|
|
bool operator ==(Object other) =>
|
|
identical(this, other) ||
|
|
other is HighlightColorAdapter &&
|
|
runtimeType == other.runtimeType &&
|
|
typeId == other.typeId;
|
|
}
|
|
|
|
class AnnotationTypeAdapter extends TypeAdapter<AnnotationType> {
|
|
@override
|
|
final int typeId = 7;
|
|
|
|
@override
|
|
AnnotationType read(BinaryReader reader) {
|
|
switch (reader.readByte()) {
|
|
case 0:
|
|
return AnnotationType.note;
|
|
case 1:
|
|
return AnnotationType.thought;
|
|
case 2:
|
|
return AnnotationType.summary;
|
|
case 3:
|
|
return AnnotationType.question;
|
|
default:
|
|
return AnnotationType.note;
|
|
}
|
|
}
|
|
|
|
@override
|
|
void write(BinaryWriter writer, AnnotationType obj) {
|
|
switch (obj) {
|
|
case AnnotationType.note:
|
|
writer.writeByte(0);
|
|
break;
|
|
case AnnotationType.thought:
|
|
writer.writeByte(1);
|
|
break;
|
|
case AnnotationType.summary:
|
|
writer.writeByte(2);
|
|
break;
|
|
case AnnotationType.question:
|
|
writer.writeByte(3);
|
|
break;
|
|
}
|
|
}
|
|
|
|
@override
|
|
int get hashCode => typeId.hashCode;
|
|
|
|
@override
|
|
bool operator ==(Object other) =>
|
|
identical(this, other) ||
|
|
other is AnnotationTypeAdapter &&
|
|
runtimeType == other.runtimeType &&
|
|
typeId == other.typeId;
|
|
}
|