Files
BadNote/lib/models/bookmark.g.dart
Akiba So 1d5ba05bb8
Some checks failed
CI / Windows build (push) Has been cancelled
feat(pdf): paragraph-precise bookmarks
Add a bookmark tool to the PDF editor. A bookmark anchors to a precise
location: when text is selected it captures the selection's normalized
rect + the start char index in the page text (the true paragraph
anchor); with no selection it falls back to the tapped page + point.

- Bookmark model gains optional normalized anchor rect + charIndex +
  label (all absent from JSON when null, so old sidecars still load).
- Bookmarks persist in the sidecar (scheduleBookmarkUpsert) and load on
  open; a bookmarks panel lists them and tapping one jumps to its page.
  Delete is persisted.

Scoped to the PDF editor (note bookmarks later); scroll-to-anchor is
page-level for now. analyze clean, 391 tests green.
2026-06-25 00:00:16 +08:00

38 lines
1.5 KiB
Dart

// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'bookmark.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_$BookmarkImpl _$$BookmarkImplFromJson(Map<String, dynamic> json) =>
_$BookmarkImpl(
id: json['id'] as String,
documentId: json['documentId'] as String,
pageNumber: (json['pageNumber'] as num).toInt(),
label: json['label'] as String? ?? '',
color: (json['color'] as num?)?.toInt() ?? 0xFF2196F3,
createdAt: DateTime.parse(json['createdAt'] as String),
anchorLeft: (json['anchorLeft'] as num?)?.toDouble(),
anchorTop: (json['anchorTop'] as num?)?.toDouble(),
anchorRight: (json['anchorRight'] as num?)?.toDouble(),
anchorBottom: (json['anchorBottom'] as num?)?.toDouble(),
charIndex: (json['charIndex'] as num?)?.toInt(),
);
Map<String, dynamic> _$$BookmarkImplToJson(_$BookmarkImpl instance) =>
<String, dynamic>{
'id': instance.id,
'documentId': instance.documentId,
'pageNumber': instance.pageNumber,
'label': instance.label,
'color': instance.color,
'createdAt': instance.createdAt.toIso8601String(),
'anchorLeft': instance.anchorLeft,
'anchorTop': instance.anchorTop,
'anchorRight': instance.anchorRight,
'anchorBottom': instance.anchorBottom,
'charIndex': instance.charIndex,
};