-
Notifications
You must be signed in to change notification settings - Fork 0
Enable/disable annotation editing Deo #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| /// | ||
| /// Copyright © 2024-2025 PSPDFKit GmbH. All rights reserved. | ||
| /// | ||
| /// THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW | ||
| /// AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE PSPDFKIT LICENSE AGREEMENT. | ||
| /// UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES. | ||
| /// This notice may not be removed from this file. | ||
| /// | ||
|
|
||
| import 'package:flutter/material.dart'; | ||
| import 'package:pspdfkit_flutter/pspdfkit.dart'; | ||
|
|
||
| class DisableAnnotationEditingExample extends StatefulWidget { | ||
| final String documentPath; | ||
|
|
||
| const DisableAnnotationEditingExample( | ||
| {super.key, required this.documentPath}); | ||
|
|
||
| @override | ||
| State<DisableAnnotationEditingExample> createState() => | ||
| _DisableAnnotationEditingExampleState(); | ||
| } | ||
|
|
||
| class _DisableAnnotationEditingExampleState | ||
| extends State<DisableAnnotationEditingExample> { | ||
| PspdfkitWidgetController? _pspdfkitWidgetController; | ||
| var isAnnotationEditingEnabled = true; | ||
|
|
||
| @override | ||
| Widget build(BuildContext context) { | ||
| return Scaffold( | ||
| body: SafeArea( | ||
| top: false, | ||
| bottom: false, | ||
| child: Stack( | ||
| children: [ | ||
| PspdfkitWidget( | ||
| documentPath: widget.documentPath, | ||
| onPspdfkitWidgetCreated: (view) { | ||
| _pspdfkitWidgetController = view; | ||
| // Disable annotation editing | ||
| }, | ||
| ), | ||
| Positioned( | ||
| bottom: 16, | ||
| left: 16, | ||
| child: ElevatedButton( | ||
| onPressed: () async { | ||
| if (_pspdfkitWidgetController != null) { | ||
| // Disable annotation editing | ||
| await _pspdfkitWidgetController | ||
| ?.enableAnnotationEditing( | ||
| enable: !isAnnotationEditingEnabled); | ||
| setState(() { | ||
| isAnnotationEditingEnabled = | ||
| !isAnnotationEditingEnabled; | ||
| }); | ||
| ScaffoldMessenger.of(context).showSnackBar( | ||
| const SnackBar( | ||
| content: Text('Annotation editing disabled')), | ||
| ); | ||
| } | ||
| }, | ||
| child: const Text('Disable Annotation Editing'), | ||
| ), | ||
| ), | ||
| ], | ||
| ))); | ||
| } | ||
| } |
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Generated by pigeon. |
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Generated by pigeon. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -251,4 +251,11 @@ class PspdfkitWidgetControllerWeb extends PspdfkitWidgetController | |
| Future<double> getZoomScale(int pageIndex) { | ||
| return pspdfkitInstance.getZoomScale(pageIndex); | ||
| } | ||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pigeon method definition. |
||
| @override | ||
| Future<void> enableAnnotationEditing( | ||
| {bool enable = true, AnnotationType? annotationType}) { | ||
| // TODO: Implement if you use web. | ||
| throw UnimplementedError(); | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generated by pigeon.