diff --git a/README.md b/README.md index 8e6c9fa..7706237 100644 --- a/README.md +++ b/README.md @@ -288,4 +288,3 @@ python app.py - **[lumina](https://github.com/MilkFeng/lumina)** - **[NLCISBNPlugin](https://github.com/DoiiarX/NLCISBNPlugin)** - diff --git a/lib/pages/epub_reader/epub_detail_page.dart b/lib/pages/epub_reader/epub_detail_page.dart index 3217c1a..79dae09 100644 --- a/lib/pages/epub_reader/epub_detail_page.dart +++ b/lib/pages/epub_reader/epub_detail_page.dart @@ -842,7 +842,26 @@ class _EpubDetailPageState extends State { decoration: BoxDecoration(color: colors.surfaceContainerHighest, borderRadius: BorderRadius.circular(10)), child: Icon(Icons.link_off, size: 18, color: colors.error)), title: Text('取消关联', style: TextStyle(fontSize: 13, color: colors.error)), - onTap: () { Navigator.pop(ctx); _unlinkBook(); }, + onTap: () { + Navigator.pop(ctx); + showDialog( + context: context, + builder: (confirmCtx) => AlertDialog( + title: const Text('取消关联', style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600)), + content: Text( + '取消关联会清除掉阅读界面的蓝色划线且重新关联后不可恢复,确定要取消关联吗?', + style: TextStyle(fontSize: 14, color: colors.onSurface.withValues(alpha: 0.6)), + ), + actions: [ + TextButton(onPressed: () => Navigator.pop(confirmCtx), child: Text('取消', style: TextStyle(color: colors.onSurface.withValues(alpha: 0.4)))), + TextButton( + onPressed: () { Navigator.pop(confirmCtx); _unlinkBook(); }, + child: Text('确定', style: TextStyle(color: colors.error, fontWeight: FontWeight.w600)), + ), + ], + ), + ); + }, ), const SizedBox(height: 8), ]), diff --git a/lib/utils/epub/reader_dao.dart b/lib/utils/epub/reader_dao.dart index 92f69a3..b296da4 100644 --- a/lib/utils/epub/reader_dao.dart +++ b/lib/utils/epub/reader_dao.dart @@ -88,6 +88,12 @@ class ReaderDao { /// 取消关联 Future unlinkBook(String readerBookId) async { final db = await _db.database; + // 同步删除该书的摘抄蓝色高亮标注 + await db.delete( + 'book_annotations', + where: 'book_id = ? AND color = ?', + whereArgs: [readerBookId, 'excerpt'], + ); return db.update( 'reader_books', {'book_id': '', 'updated_at': DateTime.now().toIso8601String()},