generated from dellevin/template
优化接触关联阅读界面清除蓝色高亮
This commit is contained in:
@@ -288,4 +288,3 @@ python app.py
|
||||
|
||||
- **[lumina](https://github.com/MilkFeng/lumina)**
|
||||
- **[NLCISBNPlugin](https://github.com/DoiiarX/NLCISBNPlugin)**
|
||||
|
||||
|
||||
@@ -842,7 +842,26 @@ class _EpubDetailPageState extends State<EpubDetailPage> {
|
||||
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),
|
||||
]),
|
||||
|
||||
@@ -88,6 +88,12 @@ class ReaderDao {
|
||||
/// 取消关联
|
||||
Future<int> 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()},
|
||||
|
||||
Reference in New Issue
Block a user