feat(pdf): typed-text tool (Windows-Ink friendly)
Some checks failed
CI / Windows build (push) Has been cancelled

Add a text-annotation tool to the PDF editor. With the text tool a
pen-tap, or a mouse double-click, drops a text box at that normalized
page point and focuses a real Flutter TextField — so the OS IME and the
Windows-Ink handwriting panel feed it (device-validated). Tapping an
existing box re-opens it; clearing it deletes it.

- SidecarText {nx, ny, text, fontSize (page-relative), color} per page,
  glued under zoom; stored in the sidecar `texts` field (back-compat
  missing -> none), saved via scheduleTextsSave and loaded on open.
- Rendered in pageOverlaysBuilder at the scaled position.

PDF editor only for now (note text later). analyze clean, 397 tests.
This commit is contained in:
2026-06-25 00:11:45 +08:00
parent 1d5ba05bb8
commit 20add27a30
12 changed files with 627 additions and 3 deletions

View File

@@ -91,6 +91,8 @@
"actionHighlightSelection": "Highlight selection",
"toolRemoveHighlight": "Remove highlight (tap a highlight)",
"toolPlaceScratchLink": "Place scratch link",
"toolText": "Text (tap or double-click to add)",
"textPlaceholder": "Type…",
"scratchLinkDeleteTitle": "Delete scratch link?",
"scratchLinkDeleteBody": "This removes the anchor and its private scratchpad.",
"toolAddBookmark": "Add bookmark (here or at selection)",

View File

@@ -554,6 +554,18 @@ abstract class AppLocalizations {
/// **'Place scratch link'**
String get toolPlaceScratchLink;
/// No description provided for @toolText.
///
/// In en, this message translates to:
/// **'Text (tap or double-click to add)'**
String get toolText;
/// No description provided for @textPlaceholder.
///
/// In en, this message translates to:
/// **'Type…'**
String get textPlaceholder;
/// No description provided for @scratchLinkDeleteTitle.
///
/// In en, this message translates to:

View File

@@ -247,6 +247,12 @@ class AppLocalizationsEn extends AppLocalizations {
@override
String get toolPlaceScratchLink => 'Place scratch link';
@override
String get toolText => 'Text (tap or double-click to add)';
@override
String get textPlaceholder => 'Type…';
@override
String get scratchLinkDeleteTitle => 'Delete scratch link?';

View File

@@ -247,6 +247,12 @@ class AppLocalizationsZh extends AppLocalizations {
@override
String get toolPlaceScratchLink => '放置便签链接';
@override
String get toolText => '文字(点按或双击添加)';
@override
String get textPlaceholder => '输入文字…';
@override
String get scratchLinkDeleteTitle => '删除便签链接?';

View File

@@ -76,6 +76,8 @@
"actionHighlightSelection": "高亮所选",
"toolRemoveHighlight": "移除高亮(点按高亮处)",
"toolPlaceScratchLink": "放置便签链接",
"toolText": "文字(点按或双击添加)",
"textPlaceholder": "输入文字…",
"scratchLinkDeleteTitle": "删除便签链接?",
"scratchLinkDeleteBody": "这会移除锚点及其专属草稿纸。",
"toolAddBookmark": "添加书签(当前位置或所选段落)",