Replies: 1 comment
-
On the today's Flutter 3.27 release, Flutter introduces a way to get SelectableRegionState from SelectionArea using GlobalKey. SelectableRegionState has the following methods: But for copy, copySelection is recently deprecated because of the iOS copy notification issue. And, because pdfrx internally embed SelectionArea inside PdfViewer, you should use PdfViewerParams.perPageSelectableRegionInjector to replace the embedded one like this: final selectionAreaKey = GlobalKey<SelectableRegionState>();
PdfViewer.file(
...,
params: PdfViewerParams(
perPageSelectableRegionInjector: (context, child, page, pageRect) {
return SelectionArea(
key: selectionAreaKey,
onSelectionChanged: (selection) { /* some code to handle selection change */ },
child: child,
);
}
),
...
// clear selection
final selectableRegionState = selectionAreaKey.state;
state?.clearSelection(); Of course, pdfrx has PdfViewerParams.onTextSelectionChange method to be notified when text selection change, which has better control on PDF structure. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
When text is selected, how do you get that data without copying it?
How do I implement the custom selection toolbar? For instance, other PDF viewer apps have these:
after selected.
Beta Was this translation helpful? Give feedback.
All reactions