Browse Source

PDFView Flutter - 优化命名

liuxiaolong 1 year ago
parent
commit
48ea1391d7
41 changed files with 310 additions and 291 deletions
  1. 19 17
      android/app/src/main/kotlin/com/compdfkit/pdfviewer/flutter/ComPDFKitPlugin.kt
  2. 5 9
      android/app/src/main/kotlin/com/compdfkit/pdfviewer/flutter/FlutterCPDFReaderView.kt
  3. 0 1
      android/app/src/main/kotlin/com/compdfkit/pdfviewer/flutter/FlutterCPDFReaderViewFactory.kt
  4. 0 6
      android/app/src/main/kotlin/com/compdfkit/pdfviewer/flutter/MainActivity.kt
  5. 0 5
      android/app/src/main/kotlin/com/compdfkit/pdfviewer/flutter/helpers/AnnotAttributeUtil.kt
  6. 0 4
      android/app/src/main/kotlin/com/compdfkit/pdfviewer/flutter/helpers/CPDFReaderViewHelpers.kt
  7. 0 16
      android/app/src/main/kotlin/com/compdfkit/pdfviewer/flutter/helpers/ColorExtension.kt
  8. 0 2
      android/app/src/main/kotlin/com/compdfkit/pdfviewer/flutter/helpers/ContextMenuEventDispatcher.kt
  9. 14 0
      android/app/src/main/kotlin/com/compdfkit/pdfviewer/flutter/helpers/Extensions.kt
  10. 39 42
      android/app/src/main/kotlin/com/compdfkit/pdfviewer/flutter/helpers/PluginUtils.kt
  11. 16 16
      android/app/src/main/kotlin/com/compdfkit/pdfviewer/flutter/helpers/SampleContextMenuHelper.kt
  12. 3 3
      android/app/src/main/kotlin/com/compdfkit/pdfviewer/flutter/helpers/SamplePdfLinkAnnotAttachHelper.kt
  13. 28 11
      android/app/src/main/kotlin/com/compdfkit/pdfviewer/flutter/view/PDFReaderView.kt
  14. 0 1
      android/app/src/main/res/layout/layout_select_text_content_view.xml
  15. 1 1
      ios/Runner/AppDelegate.swift
  16. 1 1
      ios/Runner/PDFNativeViewFactory.swift
  17. 2 1
      lib/compdfkit.dart
  18. 2 1
      lib/widgets/compdfkit/compdfkit_widget.dart
  19. 7 5
      lib/widgets/contains.dart
  20. 0 3
      lib/widgets/events.dart
  21. 10 10
      lib/widgets/function/annot_attribute_options_widget.dart
  22. 90 60
      lib/widgets/function/pdf_bottom_annot_fun_widget.dart
  23. 4 4
      lib/widgets/function/attrwidget/attr_color_list_widget.dart
  24. 3 3
      lib/widgets/function/attrwidget/attr_free_text_widget.dart
  25. 5 4
      lib/widgets/function/attrwidget/attr_link_widget.dart
  26. 3 3
      lib/widgets/function/attrwidget/attr_shape_type_widget.dart
  27. 7 8
      lib/widgets/function/attrwidget/base_slider_widget.dart
  28. 3 3
      lib/widgets/function/attrwidget/ink/attr_ink_line_width_widget.dart
  29. 1 2
      lib/widgets/function/attrwidget/signature/attr_signature_edit_widget.dart
  30. 15 16
      lib/widgets/function/attrwidget/signature/attr_signature_list_widget.dart
  31. 0 1
      lib/widgets/function/attrwidget/stamp/attr_custom_stamp_edit_widget.dart
  32. 2 2
      lib/widgets/function/attrwidget/stamp/attr_custom_stamp_preview_widget.dart
  33. 3 3
      lib/widgets/function/attrwidget/stamp/attr_stamp_widget.dart
  34. 0 2
      lib/widgets/models/annot_attribute_bean.dart
  35. 0 1
      lib/widgets/models/annot_bean.dart
  36. 0 2
      lib/widgets/models/text_stamp_bean.dart
  37. 1 1
      lib/widgets/page/pdf_page_widget.dart
  38. 3 1
      lib/widgets/painting/stamp_shape_border.dart
  39. 21 18
      lib/widgets/function/attrwidget/ink/attr_ink_pen_wave_widget.dart
  40. 2 1
      lib/widgets/util/stamp_util.dart
  41. 0 1
      test/widget_test.dart

+ 19 - 17
android/app/src/main/kotlin/com/compdfkit/pdfviewer/flutter/ComPDFKitPlugin.kt

@@ -1,8 +1,9 @@
 package com.compdfkit.pdfviewer.flutter
 
-import android.util.Log
 import com.compdfkit.core.document.CPDFSdk
-import com.compdfkit.pdfviewer.flutter.helpers.PluginUtils.KEY_COMPDFKIT_VERSION
+import com.compdfkit.pdfviewer.flutter.helpers.PluginUtils.FUNCTION_GET_COMPDFKIT_VERSION
+import com.compdfkit.pdfviewer.flutter.helpers.PluginUtils.METHOD_COM_PDF_KIT_GLOBAL_INFO
+import com.compdfkit.pdfviewer.flutter.helpers.PluginUtils.VIEW_TYPE_COM_PDF_KIT_PDF_VIEW
 import io.flutter.embedding.engine.plugins.FlutterPlugin
 import io.flutter.embedding.engine.plugins.activity.ActivityAware
 import io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding
@@ -13,36 +14,38 @@ import io.flutter.plugin.common.MethodChannel.MethodCallHandler
 import io.flutter.plugin.platform.PlatformViewRegistry
 
 /**
- * @classname:
- * @author: LiuXiaoLong
- * @date: 2023/3/7
- * description:
- */
+ *  ComPDFKitPlugin.kt
+ *  Copyright © 2014-2023 PDF Technologies, Inc. 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 ComPDFKit LICENSE AGREEMENT.
+ *  UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES.
+ *  This notice may not be removed from this file.
+ **/
 class ComPDFKitPlugin : MethodCallHandler, FlutterPlugin, ActivityAware {
 
-    val TAG = "ComPDFKitPlugin"
-    val viewType = "com.compdfkit.global"
-    val flutterPDFViewType = "com.compdfkit.pdf.flutter"
+
+
     var mRegistry: PlatformViewRegistry? = null
     var mMessenger: BinaryMessenger? = null
-    var mMethodChannel: MethodChannel? = null
+    private var mGlobalMethodChannel: MethodChannel? = null
 
     override fun onAttachedToEngine(binding: FlutterPlugin.FlutterPluginBinding) {
         mMessenger = binding.binaryMessenger
         mRegistry = binding.platformViewRegistry
-        mMethodChannel = MethodChannel(mMessenger!!, viewType)
-        mMethodChannel?.setMethodCallHandler(this)
+        mGlobalMethodChannel = MethodChannel(mMessenger!!, METHOD_COM_PDF_KIT_GLOBAL_INFO)
+        mGlobalMethodChannel?.setMethodCallHandler(this)
     }
 
 
     override fun onDetachedFromEngine(binding: FlutterPlugin.FlutterPluginBinding) {
         mRegistry = null
         mMessenger = null
-        mMethodChannel?.setMethodCallHandler(null)
+        mGlobalMethodChannel?.setMethodCallHandler(null)
     }
 
     override fun onAttachedToActivity(binding: ActivityPluginBinding) {
-        mRegistry?.registerViewFactory(flutterPDFViewType, FlutterCPDFReaderViewFactory(mMessenger!!))
+        mRegistry?.registerViewFactory(VIEW_TYPE_COM_PDF_KIT_PDF_VIEW, FlutterCPDFReaderViewFactory(mMessenger!!))
     }
 
     override fun onDetachedFromActivityForConfigChanges() {
@@ -55,9 +58,8 @@ class ComPDFKitPlugin : MethodCallHandler, FlutterPlugin, ActivityAware {
     }
 
     override fun onMethodCall(call: MethodCall, result: MethodChannel.Result) {
-        Log.e(TAG, "call.methold: ${call.method}")
         when(call.method){
-            KEY_COMPDFKIT_VERSION -> {
+            FUNCTION_GET_COMPDFKIT_VERSION -> {
                 result.success(CPDFSdk.getSDKVersion())
             }
         }

+ 5 - 9
android/app/src/main/kotlin/com/compdfkit/pdfviewer/flutter/FlutterCPDFReaderView.kt

@@ -1,13 +1,12 @@
 package com.compdfkit.pdfviewer.flutter
 
 import android.content.Context
-import android.util.Log
 import android.view.View
 import com.compdfkit.pdfviewer.flutter.helpers.ContextMenuEventDispatcher
 import com.compdfkit.pdfviewer.flutter.helpers.PluginUtils
 import com.compdfkit.pdfviewer.flutter.helpers.PluginUtils.EVENT_CHANNEL_READER_VIEW_CALL_BACK
-import com.compdfkit.pdfviewer.flutter.helpers.PluginUtils.EVENT_CHANNEL_READER_VIEW_CONTEXT_MENU_HELPER
 import com.compdfkit.pdfviewer.flutter.helpers.PluginUtils.EVENT_CHANNEL_READER_VIEW_FOCUSED_CHANGE_CALL_BACK
+import com.compdfkit.pdfviewer.flutter.helpers.PluginUtils.METHOD_COM_PDF_KIT_VIEW_SETTINGS
 import com.compdfkit.pdfviewer.flutter.helpers.setStreamHandler
 import com.compdfkit.pdfviewer.flutter.view.PDFReaderView
 import io.flutter.plugin.common.BinaryMessenger
@@ -35,31 +34,28 @@ class FlutterCPDFReaderView(
 ) : PlatformView, MethodChannel.MethodCallHandler {
 
 
-
-
     private var readerView: PDFReaderView = PDFReaderView(context, messenger)
 
     private var methodChannel: MethodChannel
 
     init {
-        Log.e("初始化", "FlutterCPDFReaderView")
         registerWith(messenger)
         readerView.openDocument(documentPath)
         PluginUtils.initPDFReaderViewConfig(readerView, configurationMap)
-        methodChannel = MethodChannel(messenger, "com.compdfkit.pdf.flutter")
+        methodChannel = MethodChannel(messenger, METHOD_COM_PDF_KIT_VIEW_SETTINGS)
         methodChannel.setMethodCallHandler(this)
-
     }
 
 
     private fun registerWith(messenger: BinaryMessenger) {
+        ContextMenuEventDispatcher.register(messenger)
+
         val readerViewCallbackEventChannel = EventChannel(messenger, EVENT_CHANNEL_READER_VIEW_CALL_BACK)
         readerViewCallbackEventChannel.setStreamHandler {
-            onListen { arguments, events ->
+            onListen { _, events ->
                 readerView.setReaderViewCallbackEventEmitter(events)
             }
         }
-        ContextMenuEventDispatcher.register(messenger)
 
         val readerViewFocusedChangEventChannel = EventChannel(messenger, EVENT_CHANNEL_READER_VIEW_FOCUSED_CHANGE_CALL_BACK)
         readerViewFocusedChangEventChannel.setStreamHandler {

+ 0 - 1
android/app/src/main/kotlin/com/compdfkit/pdfviewer/flutter/FlutterCPDFReaderViewFactory.kt

@@ -1,7 +1,6 @@
 package com.compdfkit.pdfviewer.flutter
 
 import android.content.Context
-import com.compdfkit.pdfviewer.flutter.FlutterCPDFReaderView
 import io.flutter.plugin.common.BinaryMessenger
 import io.flutter.plugin.common.StandardMessageCodec
 import io.flutter.plugin.platform.PlatformView

+ 0 - 6
android/app/src/main/kotlin/com/compdfkit/pdfviewer/flutter/MainActivity.kt

@@ -1,19 +1,13 @@
 package com.compdfkit.pdfviewer.flutter
 
-import android.graphics.Color
-import android.util.Log
 import io.flutter.embedding.android.FlutterActivity
 import io.flutter.embedding.engine.FlutterEngine
 
 class MainActivity: FlutterActivity() {
 
-
     override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
         super.configureFlutterEngine(flutterEngine)
         flutterEngine.plugins.add(ComPDFKitPlugin())
-
     }
 
-
-
 }

+ 0 - 5
android/app/src/main/kotlin/com/compdfkit/pdfviewer/flutter/helpers/AnnotAttributeUtil.kt

@@ -1,14 +1,11 @@
 package com.compdfkit.pdfviewer.flutter.helpers
 
 import android.graphics.Color
-import android.util.Log
 import com.compdfkit.core.annotation.CPDFAnnotation
 import com.compdfkit.core.annotation.CPDFLineAnnotation
-import com.compdfkit.core.annotation.CPDFLinkAnnotation
 import com.compdfkit.core.annotation.CPDFStampAnnotation
 import com.compdfkit.core.annotation.CPDFTextAttribute
 import com.compdfkit.core.annotation.CPDFTextAttribute.FontNameHelper.FontType
-import com.compdfkit.demo.component.annottool.stamp.TextStampType
 import com.compdfkit.ui.reader.CPDFReaderView
 
 
@@ -24,8 +21,6 @@ import com.compdfkit.ui.reader.CPDFReaderView
 object AnnotAttributeUtil {
 
 
-
-
     /**
      * Set CPDFReaderView annotation attribute
      * @param cpdfReaderView CPDFReaderView

+ 0 - 4
android/app/src/main/kotlin/com/compdfkit/pdfviewer/flutter/helpers/CPDFReaderViewHelpers.kt

@@ -1,11 +1,7 @@
 package com.compdfkit.pdfviewer.flutter.helpers
 
 import android.content.Context
-import android.graphics.Color
-import com.compdfkit.core.annotation.CPDFAnnotation
-import com.compdfkit.core.annotation.CPDFLineAnnotation
 import com.compdfkit.core.document.CPDFDocument
-import com.compdfkit.ui.reader.CPDFReaderView
 
 /**
  *  CPDFReaderViewHelpers.kt

+ 0 - 16
android/app/src/main/kotlin/com/compdfkit/pdfviewer/flutter/helpers/ColorExtension.kt

@@ -1,16 +0,0 @@
-package com.compdfkit.pdfviewer.flutter.helpers
-
-import android.graphics.Color
-
-
-fun Int.toHexColor(): String {
-    val alpha = this shr 24 and 0xFF
-    val red = this shr 16 and 0xFF
-    val green = this shr 8 and 0xFF
-    val blue = this and 0xFF
-    return String.format("#%02X%02X%02X%02X", alpha, red, green, blue)
-}
-
-fun String.fromHex() : Int{
-    return Color.parseColor(this)
-}

+ 0 - 2
android/app/src/main/kotlin/com/compdfkit/pdfviewer/flutter/helpers/ContextMenuEventDispatcher.kt

@@ -28,7 +28,6 @@ object ContextMenuEventDispatcher {
     private var handlerMap: HashMap<String, OnMethodCall> = hashMapOf()
 
     fun register(messenger: BinaryMessenger) {
-
         modifyAnnotationAttrChannel = MethodChannel(messenger, PluginUtils.METHOD_CHANNEL_MODIFY_ANNOTATION_ATTRIBUTE)
         modifyAnnotationAttrChannel?.setMethodCallHandler { call, result ->
             for (mutableEntry in handlerMap) {
@@ -51,7 +50,6 @@ object ContextMenuEventDispatcher {
 
     fun addModifyAnnotationCallBack(key: String, onMethodCall: OnMethodCall) {
         handlerMap[key] = onMethodCall
-
     }
 
 

+ 14 - 0
android/app/src/main/kotlin/com/compdfkit/pdfviewer/flutter/helpers/Extensions.kt

@@ -1,5 +1,6 @@
 package com.compdfkit.pdfviewer.flutter.helpers
 
+import android.graphics.Color
 import com.compdfkit.pdfviewer.flutter.base.BaseStreamHandler
 import io.flutter.plugin.common.EventChannel
 
@@ -39,3 +40,16 @@ fun Map<String, Any>?.getLong(key : String) : Long?{
 fun EventChannel.setStreamHandler(handler : BaseStreamHandler.() -> Unit){
     setStreamHandler(BaseStreamHandler().also(handler))
 }
+
+
+fun Int.toHexColor(): String {
+    val alpha = this shr 24 and 0xFF
+    val red = this shr 16 and 0xFF
+    val green = this shr 8 and 0xFF
+    val blue = this and 0xFF
+    return String.format("#%02X%02X%02X%02X", alpha, red, green, blue)
+}
+
+fun String.fromHex() : Int{
+    return Color.parseColor(this)
+}

+ 39 - 42
android/app/src/main/kotlin/com/compdfkit/pdfviewer/flutter/helpers/PluginUtils.kt

@@ -1,11 +1,6 @@
 package com.compdfkit.pdfviewer.flutter.helpers
 
-import android.graphics.Color
-import android.util.Log
-import com.compdfkit.core.annotation.CPDFAnnotation
-import com.compdfkit.core.annotation.CPDFLineAnnotation
 import com.compdfkit.pdfviewer.flutter.view.PDFReaderView
-import com.compdfkit.ui.reader.CPDFReaderView
 import io.flutter.plugin.common.MethodCall
 import io.flutter.plugin.common.MethodChannel
 
@@ -21,13 +16,13 @@ import io.flutter.plugin.common.MethodChannel
 object PluginUtils {
 
 
-
-    const val EVENT_CHANNEL_READER_VIEW_CALL_BACK = "event_reader_view_call_back"
-    const val EVENT_CHANNEL_READER_VIEW_CONTEXT_MENU_HELPER = "event_reader_view_context_menu_helper"
-    const val METHOD_CHANNEL_MODIFY_ANNOTATION_ATTRIBUTE = "method_modify_annotation_attribute"
-    const val EVENT_CHANNEL_READER_VIEW_FOCUSED_CHANGE_CALL_BACK = "event_reader_view_focused_change_call_back"
-    //get ComPDFKit Version info
-    const val KEY_COMPDFKIT_VERSION = "ComPDFKitVersion"
+    const val METHOD_COM_PDF_KIT_GLOBAL_INFO = "com.compdfkit.pdf.flutter.global"
+    const val METHOD_COM_PDF_KIT_VIEW_SETTINGS = "com.compdfkit.pdf.flutter.pdfview.settings"
+    const val METHOD_CHANNEL_MODIFY_ANNOTATION_ATTRIBUTE = "com.compdfkit.pdf.flutter.pdfview.modify.annotation.attribute"
+    const val VIEW_TYPE_COM_PDF_KIT_PDF_VIEW = "com.compdfkit.pdf.flutter.pdfview"
+    const val EVENT_CHANNEL_READER_VIEW_CALL_BACK = "com.compdfkit.pdf.flutter.pdfview.view.call.back"
+    const val EVENT_CHANNEL_READER_VIEW_CONTEXT_MENU_HELPER = "com.compdfkit.pdf.flutter.pdfview.context.menu.helper"
+    const val EVENT_CHANNEL_READER_VIEW_FOCUSED_CHANGE_CALL_BACK = "com.compdfkit.pdf.flutter.pdfview.focused.change.callback"
 
 
     const val EVENT_ON_TAP_MAIN_DOC_AREA = "onTapMainDocArea"
@@ -63,21 +58,23 @@ object PluginUtils {
     const val EVENT_DOCUMENT_CURRENT_PAGE_INDEX = "documentCurrentPageIndex"
     const val EVENT_DOCUMENT_PAGE_COUNT = "documentPageCount"
 
-    const val KEY_SCROLL_DIRECTION = "scrollDirection"
-    const val KEY_IS_DOUBLE_PAGE = "isDoublePage"
-    const val KEY_IS_CONTINUE_MODE = "isContinueMode"
-    const val KEY_IS_COVER_PAGE_MODE = "isCoverPageMode"
-    const val KEY_IS_CROP_PAGE_MODE = "isCropPageMode"
-    const val KEY_ANNOT_TYPE = "annotType"
-    const val KEY_ANNOT_ATTRIBUTE = "annotAttribute"
-    const val KEY_TOUCH_MODE = "touchMode"
-    const val KEY_FOCUSED_TYPE = "focusedType"
-    const val KEY_READ_BACKGROUND_COLOR = "readBackgroundColor"
-    const val KEY_MODIFY_ANNOTATION_ATTRIBUTE = "modifyAnnotationAttribute"
-    const val KEY_DISMISS_MODIFY_ANNOTATION_ATTRIBUTE = "dismissModifyAnnotationAttr"
+    const val EVENT_SCROLL_DIRECTION = "scrollDirection"
+    const val EVENT_IS_DOUBLE_PAGE = "isDoublePage"
+    const val EVENT_IS_CONTINUE_MODE = "isContinueMode"
+    const val EVENT_IS_COVER_PAGE_MODE = "isCoverPageMode"
+    const val EVENT_IS_CROP_PAGE_MODE = "isCropPageMode"
+    const val EVENT_ANNOT_TYPE = "annotType"
+    const val EVENT_ANNOT_ATTRIBUTE = "annotAttribute"
+    const val EVENT_TOUCH_MODE = "touchMode"
+    const val EVENT_FOCUSED_TYPE = "focusedType"
+    const val EVENT_READ_BACKGROUND_COLOR = "readBackgroundColor"
+    const val EVENT_MODIFY_ANNOTATION_ATTRIBUTE = "modifyAnnotationAttribute"
+    const val EVENT_DISMISS_MODIFY_ANNOTATION_ATTRIBUTE = "dismissModifyAnnotationAttr"
     const val SCROLL_DIRECTION_VERTICAL = "vertical"
     const val SCROLL_DIRECTION_HORIZONTAL = "horizontal"
 
+    //get ComPDFKit Version info
+    const val FUNCTION_GET_COMPDFKIT_VERSION = "ComPDFKitVersion"
     ///MethodChannel invokeMethod method name
     const val FUNCTION_SET_SCROLL_DIRECTION = "setScrollDirection"
     const val FUNCTION_GET_SCROLL_DIRECTION = "getScrollDirection"
@@ -98,25 +95,25 @@ object PluginUtils {
 
     fun initPDFReaderViewConfig(pdfReaderView: PDFReaderView, configurationMap: Map<String, Any>?) {
 
-        configurationMap.getString(KEY_SCROLL_DIRECTION)?.let {
+        configurationMap.getString(EVENT_SCROLL_DIRECTION)?.let {
             pdfReaderView.pdfReaderView.isVerticalMode = it == SCROLL_DIRECTION_VERTICAL
         }
-        configurationMap.getBoolean(KEY_IS_DOUBLE_PAGE)?.let {
+        configurationMap.getBoolean(EVENT_IS_DOUBLE_PAGE)?.let {
             pdfReaderView.pdfReaderView.isDoublePageMode = it
         }
-        configurationMap.getBoolean(KEY_IS_CONTINUE_MODE)?.let {
+        configurationMap.getBoolean(EVENT_IS_CONTINUE_MODE)?.let {
             pdfReaderView.pdfReaderView.isContinueMode = it
         }
-        configurationMap.getBoolean(KEY_IS_COVER_PAGE_MODE)?.let {
+        configurationMap.getBoolean(EVENT_IS_COVER_PAGE_MODE)?.let {
             pdfReaderView.pdfReaderView.isCoverPageMode = it
         }
-        configurationMap.getBoolean(KEY_IS_CROP_PAGE_MODE)?.let {
+        configurationMap.getBoolean(EVENT_IS_CROP_PAGE_MODE)?.let {
             pdfReaderView.pdfReaderView.isCropMode = it
         }
-        configurationMap.getMap(KEY_ANNOT_ATTRIBUTE)?.let {
+        configurationMap.getMap(EVENT_ANNOT_ATTRIBUTE)?.let {
             AnnotAttributeUtil.setAnnotAttribute(pdfReaderView.pdfReaderView, it)
         }
-        configurationMap.getString(KEY_READ_BACKGROUND_COLOR)?.let {
+        configurationMap.getString(EVENT_READ_BACKGROUND_COLOR)?.let {
             pdfReaderView.pdfReaderView.readBackgroundColor = it.fromHex()
         }
 
@@ -130,7 +127,7 @@ object PluginUtils {
                 result.success(if (pdfReaderView.pdfReaderView.isVerticalMode) SCROLL_DIRECTION_VERTICAL else SCROLL_DIRECTION_HORIZONTAL)
             }
             FUNCTION_SET_SCROLL_DIRECTION -> {
-                (configuration?.get(KEY_SCROLL_DIRECTION) as? String)?.let {
+                (configuration?.get(EVENT_SCROLL_DIRECTION) as? String)?.let {
                     pdfReaderView.pdfReaderView.isVerticalMode = it == SCROLL_DIRECTION_VERTICAL
                     result.success(if (pdfReaderView.pdfReaderView.isVerticalMode) SCROLL_DIRECTION_VERTICAL else SCROLL_DIRECTION_HORIZONTAL)
                 }
@@ -139,13 +136,13 @@ object PluginUtils {
                 result.success(pdfReaderView.pdfReaderView.isDoublePageMode)
             }
             FUNCTION_SET_PAGE_MODE -> {
-                (configuration?.get(KEY_IS_DOUBLE_PAGE) as? Boolean)?.let {
+                (configuration?.get(EVENT_IS_DOUBLE_PAGE) as? Boolean)?.let {
                     pdfReaderView.pdfReaderView.isDoublePageMode = it
                     result.success(pdfReaderView.pdfReaderView.isDoublePageMode)
                 }
             }
             FUNCTION_SET_IS_CONTINUE_MODE -> {
-                (configuration?.get(KEY_IS_CONTINUE_MODE) as? Boolean)?.let {
+                (configuration?.get(EVENT_IS_CONTINUE_MODE) as? Boolean)?.let {
                     pdfReaderView.pdfReaderView.isContinueMode = it
                     result.success(pdfReaderView.pdfReaderView.isContinueMode)
                 }
@@ -157,7 +154,7 @@ object PluginUtils {
                 result.success(pdfReaderView.pdfReaderView.isCoverPageMode)
             }
             FUNCTION_SET_IS_COVER_PAGE_MODE -> {
-                (configuration?.get(KEY_IS_COVER_PAGE_MODE) as? Boolean)?.let {
+                (configuration?.get(EVENT_IS_COVER_PAGE_MODE) as? Boolean)?.let {
                     pdfReaderView.pdfReaderView.isCoverPageMode = it
                     result.success(pdfReaderView.pdfReaderView.isCoverPageMode)
                 }
@@ -166,26 +163,26 @@ object PluginUtils {
                 result.success(pdfReaderView.pdfReaderView.isCropMode)
             }
             FUNCTION_SET_IS_CROP_PAGE_MODE -> {
-                (configuration?.get(KEY_IS_CROP_PAGE_MODE) as? Boolean)?.let {
+                (configuration?.get(EVENT_IS_CROP_PAGE_MODE) as? Boolean)?.let {
                     pdfReaderView.pdfReaderView.isCropMode = it
                     result.success(pdfReaderView.pdfReaderView.isCropMode)
                 }
             }
             FUNCTION_GET_ANNOT_ATTRIBUTE -> {
-                (configuration?.get(KEY_ANNOT_TYPE) as? String)?.let {
+                (configuration?.get(EVENT_ANNOT_TYPE) as? String)?.let {
                     val annotAttribute = AnnotAttributeUtil.getReaderAnnotAttribute(pdfReaderView.pdfReaderView, AnnotType.valueOf(it.uppercase()))
                     result.success(annotAttribute)
                 }
             }
             FUNCTION_SET_ANNOT_ATTRIBUTE -> {
-                configuration.getString(KEY_ANNOT_TYPE)?.let {
-                    val annotAttr = configuration?.get(KEY_ANNOT_ATTRIBUTE) as? Map<String, Any> ?: hashMapOf()
+                configuration.getString(EVENT_ANNOT_TYPE)?.let {
+                    val annotAttr = configuration?.get(EVENT_ANNOT_ATTRIBUTE) as? Map<String, Any> ?: hashMapOf()
                     AnnotAttributeUtil.setAnnotAttribute(pdfReaderView.pdfReaderView, mapOf(it to annotAttr))
                 }
             }
             FUNCTION_SET_CURRENT_FOCUSED_TYPE -> {
-                val touchMode = configuration.getString(KEY_TOUCH_MODE)
-                val focusedType = configuration.getString(KEY_FOCUSED_TYPE)
+                val touchMode = configuration.getString(EVENT_TOUCH_MODE)
+                val focusedType = configuration.getString(EVENT_FOCUSED_TYPE)
                 pdfReaderView.setAnnotationType(touchMode, focusedType)
                 result.success(true)
             }
@@ -193,7 +190,7 @@ object PluginUtils {
                 result.success(pdfReaderView.pdfReaderView.readBackgroundColor)
             }
             FUNCTION_SET_READER_VIEW_BACKGROUND_COLOR -> {
-                configuration.getLong(KEY_READ_BACKGROUND_COLOR)?.let {
+                configuration.getLong(EVENT_READ_BACKGROUND_COLOR)?.let {
                     pdfReaderView.pdfReaderView.readBackgroundColor = it.toInt()
                     result.success(pdfReaderView.pdfReaderView.readBackgroundColor)
                 }

+ 16 - 16
android/app/src/main/kotlin/com/compdfkit/pdfviewer/flutter/helpers/SampleContextMenuHelper.kt

@@ -29,8 +29,8 @@ import com.compdfkit.pdfviewer.flutter.R
 import com.compdfkit.pdfviewer.flutter.helpers.PluginUtils.EVENT_ANNOT_ATTR_ALPHA
 import com.compdfkit.pdfviewer.flutter.helpers.PluginUtils.EVENT_ANNOT_ATTR_BORDER_COLOR
 import com.compdfkit.pdfviewer.flutter.helpers.PluginUtils.EVENT_ANNOT_ATTR_BORDER_COLOR_ALPHA
-import com.compdfkit.pdfviewer.flutter.helpers.PluginUtils.EVENT_ANNOT_ATTR_COLOR
 import com.compdfkit.pdfviewer.flutter.helpers.PluginUtils.EVENT_ANNOT_ATTR_BORDER_WIDTH
+import com.compdfkit.pdfviewer.flutter.helpers.PluginUtils.EVENT_ANNOT_ATTR_COLOR
 import com.compdfkit.pdfviewer.flutter.helpers.PluginUtils.EVENT_ANNOT_ATTR_FILL_COLOR
 import com.compdfkit.pdfviewer.flutter.helpers.PluginUtils.EVENT_ANNOT_ATTR_FILL_COLOR_ALPHA
 import com.compdfkit.pdfviewer.flutter.helpers.PluginUtils.EVENT_ANNOT_ATTR_FONT_BOLD
@@ -44,9 +44,9 @@ import com.compdfkit.pdfviewer.flutter.helpers.PluginUtils.EVENT_ANNOT_ATTR_LINK
 import com.compdfkit.pdfviewer.flutter.helpers.PluginUtils.EVENT_ANNOT_ATTR_SHAPE_TYPE
 import com.compdfkit.pdfviewer.flutter.helpers.PluginUtils.EVENT_ANNOT_ATTR_TEXT_COLOR
 import com.compdfkit.pdfviewer.flutter.helpers.PluginUtils.EVENT_ANNOT_ATTR_TEXT_COLOR_ALPHA
-import com.compdfkit.pdfviewer.flutter.helpers.PluginUtils.KEY_ANNOT_TYPE
-import com.compdfkit.pdfviewer.flutter.helpers.PluginUtils.KEY_DISMISS_MODIFY_ANNOTATION_ATTRIBUTE
-import com.compdfkit.pdfviewer.flutter.helpers.PluginUtils.KEY_MODIFY_ANNOTATION_ATTRIBUTE
+import com.compdfkit.pdfviewer.flutter.helpers.PluginUtils.EVENT_ANNOT_TYPE
+import com.compdfkit.pdfviewer.flutter.helpers.PluginUtils.EVENT_DISMISS_MODIFY_ANNOTATION_ATTRIBUTE
+import com.compdfkit.pdfviewer.flutter.helpers.PluginUtils.EVENT_MODIFY_ANNOTATION_ATTRIBUTE
 import com.compdfkit.ui.attribute.CPDFAnnotAttribute
 import com.compdfkit.ui.contextmenu.CPDFContextMenuShowHelper
 import com.compdfkit.ui.contextmenu.IContextMenuShowListener.ContextMenuType
@@ -87,11 +87,11 @@ class SampleContextMenuHelper(readerView: CPDFReaderView, mContext: Context, mes
         ContextMenuEventDispatcher.addModifyAnnotationCallBack("SampleContextMenuHelper") { call, result ->
             val configuration = call.arguments as? HashMap<String, Any>
             when (call.method) {
-                KEY_MODIFY_ANNOTATION_ATTRIBUTE -> {
+                EVENT_MODIFY_ANNOTATION_ATTRIBUTE -> {
                     val color = configuration.getString(EVENT_ANNOT_ATTR_COLOR)
                     val alpha = configuration.getInt(EVENT_ANNOT_ATTR_ALPHA)
                     val annotAttrBorderWidth = configuration.getNumber(EVENT_ANNOT_ATTR_BORDER_WIDTH)
-                    val annotationType = configuration.getString(KEY_ANNOT_TYPE)
+                    val annotationType = configuration.getString(EVENT_ANNOT_TYPE)
                     val annotAttrBorderColor = configuration.getString(EVENT_ANNOT_ATTR_BORDER_COLOR)
                     val annotAttrBorderAlpha = configuration.getInt(EVENT_ANNOT_ATTR_BORDER_COLOR_ALPHA)
                     val annotAttrFillColor = configuration.getString(EVENT_ANNOT_ATTR_FILL_COLOR)
@@ -261,7 +261,7 @@ class SampleContextMenuHelper(readerView: CPDFReaderView, mContext: Context, mes
                         }
                     }
                 }
-                KEY_DISMISS_MODIFY_ANNOTATION_ATTRIBUTE -> {
+                EVENT_DISMISS_MODIFY_ANNOTATION_ATTRIBUTE -> {
                     selectMarkupAnnotImpl = null
                     selectPageView = null
                 }
@@ -289,7 +289,7 @@ class SampleContextMenuHelper(readerView: CPDFReaderView, mContext: Context, mes
                 val attr = when (annotation) {
                     is CPDFCircleAnnotation -> {
                         mapOf(
-                            KEY_ANNOT_TYPE to AnnotType.SHAPE.name.lowercase(),
+                            EVENT_ANNOT_TYPE to AnnotType.SHAPE.name.lowercase(),
                             EVENT_ANNOT_ATTR_BORDER_COLOR to annotation.lineColor.toHexColor(),
                             EVENT_ANNOT_ATTR_BORDER_COLOR_ALPHA to annotation.lineAlpha,
                             EVENT_ANNOT_ATTR_BORDER_WIDTH to annotation.borderWidth,
@@ -300,7 +300,7 @@ class SampleContextMenuHelper(readerView: CPDFReaderView, mContext: Context, mes
                     }
                     is CPDFSquareAnnotation -> {
                         mapOf(
-                            KEY_ANNOT_TYPE to AnnotType.SHAPE.name.lowercase(),
+                            EVENT_ANNOT_TYPE to AnnotType.SHAPE.name.lowercase(),
                             EVENT_ANNOT_ATTR_BORDER_COLOR to annotation.lineColor.toHexColor(),
                             EVENT_ANNOT_ATTR_BORDER_COLOR_ALPHA to annotation.lineAlpha,
                             EVENT_ANNOT_ATTR_BORDER_WIDTH to annotation.borderWidth,
@@ -312,7 +312,7 @@ class SampleContextMenuHelper(readerView: CPDFReaderView, mContext: Context, mes
                     is CPDFLineAnnotation -> {
                         val shapeType = if (annotation.lineTailType == CPDFLineAnnotation.LineType.LINETYPE_ARROW) AnnotType.ARROW else AnnotType.LINE
                         mapOf(
-                            KEY_ANNOT_TYPE to AnnotType.SHAPE.name.lowercase(),
+                            EVENT_ANNOT_TYPE to AnnotType.SHAPE.name.lowercase(),
                             EVENT_ANNOT_ATTR_BORDER_COLOR to annotation.lineColor.toHexColor(),
                             EVENT_ANNOT_ATTR_BORDER_COLOR_ALPHA to annotation.lineAlpha,
                             EVENT_ANNOT_ATTR_BORDER_WIDTH to annotation.borderWidth,
@@ -394,7 +394,7 @@ class SampleContextMenuHelper(readerView: CPDFReaderView, mContext: Context, mes
                     val fontName = freetextAnnotation.freetextDa.fontName
                     ContextMenuEventDispatcher.sendEvent(
                         mapOf(
-                            KEY_ANNOT_TYPE to AnnotType.FREETEXT.name.lowercase(),
+                            EVENT_ANNOT_TYPE to AnnotType.FREETEXT.name.lowercase(),
                             EVENT_ANNOT_ATTR_FONT_BOLD to CPDFTextAttribute.FontNameHelper.isBold(fontName),
                             EVENT_ANNOT_ATTR_FONT_ITALIC to CPDFTextAttribute.FontNameHelper.isItalic(fontName),
                             EVENT_ANNOT_ATTR_FONT_TYPE to CPDFTextAttribute.FontNameHelper.getFontType(fontName).name,
@@ -434,7 +434,7 @@ class SampleContextMenuHelper(readerView: CPDFReaderView, mContext: Context, mes
                 //Notify the flutter side to open the annotation attribute modification interface
                 ContextMenuEventDispatcher.sendEvent(
                     mapOf(
-                        KEY_ANNOT_TYPE to markupAnnotation.type.name.lowercase(),
+                        EVENT_ANNOT_TYPE to markupAnnotation.type.name.lowercase(),
                         EVENT_ANNOT_ATTR_COLOR to markupAnnotation.color.toHexColor(),
                         EVENT_ANNOT_ATTR_ALPHA to markupAnnotation.alpha
                     )
@@ -472,7 +472,7 @@ class SampleContextMenuHelper(readerView: CPDFReaderView, mContext: Context, mes
                 //Notify the flutter side to open the annotation attribute modification interface
                 ContextMenuEventDispatcher.sendEvent(
                     mapOf(
-                        KEY_ANNOT_TYPE to inkAnnotation.type.name.lowercase(),
+                        EVENT_ANNOT_TYPE to inkAnnotation.type.name.lowercase(),
                         EVENT_ANNOT_ATTR_COLOR to inkAnnotation.color.toHexColor(),
                         EVENT_ANNOT_ATTR_ALPHA to inkAnnotation.alpha,
                         EVENT_ANNOT_ATTR_BORDER_WIDTH to round(inkAnnotation.borderWidth)
@@ -547,7 +547,7 @@ class SampleContextMenuHelper(readerView: CPDFReaderView, mContext: Context, mes
                 val map = when {
                     destination != null -> {
                         mapOf(
-                            KEY_ANNOT_TYPE to linkAnnotation.type.name.lowercase(),
+                            EVENT_ANNOT_TYPE to linkAnnotation.type.name.lowercase(),
                             EVENT_ANNOT_ATTR_LINK_TYPE to LinkType.PAGE.name.lowercase(),
                             EVENT_ANNOT_ATTR_LINK_PAGE to destination.pageIndex + 1
                         )
@@ -556,7 +556,7 @@ class SampleContextMenuHelper(readerView: CPDFReaderView, mContext: Context, mes
                         when (action.actionType) {
                             CPDFAction.ActionType.PDFActionType_GoTo -> {
                                 mapOf(
-                                    KEY_ANNOT_TYPE to linkAnnotation.type.name.lowercase(),
+                                    EVENT_ANNOT_TYPE to linkAnnotation.type.name.lowercase(),
                                     EVENT_ANNOT_ATTR_LINK_TYPE to LinkType.PAGE.name.lowercase(),
                                     EVENT_ANNOT_ATTR_LINK_PAGE to (action as CPDFGoToAction).getDestination(readerView.pdfDocument).pageIndex + 1
                                 )
@@ -565,7 +565,7 @@ class SampleContextMenuHelper(readerView: CPDFReaderView, mContext: Context, mes
                                 val uri = (action as CPDFUriAction).uri
                                 val linkType = if (uri.startsWith("mailto:")) LinkType.EMAIL else LinkType.WEBSITE
                                 mapOf(
-                                    KEY_ANNOT_TYPE to linkAnnotation.type.name.lowercase(),
+                                    EVENT_ANNOT_TYPE to linkAnnotation.type.name.lowercase(),
                                     EVENT_ANNOT_ATTR_LINK_TYPE to linkType.name.lowercase(),
                                     EVENT_ANNOT_ATTR_LINK_WEB to uri,
                                     EVENT_ANNOT_ATTR_LINK_EMAIL to uri.replace("mailto:", "")

+ 3 - 3
android/app/src/main/kotlin/com/compdfkit/pdfviewer/flutter/helpers/SamplePdfLinkAnnotAttachHelper.kt

@@ -25,18 +25,18 @@ class SamplePdfLinkAnnotAttachHelper : CPDFLinkAnnotAttachHelper() {
             return
         }
         ContextMenuEventDispatcher.sendEvent(
-            mapOf(PluginUtils.KEY_ANNOT_TYPE to linkAnnotation.type.name.lowercase())
+            mapOf(PluginUtils.EVENT_ANNOT_TYPE to linkAnnotation.type.name.lowercase())
         )
 
         ContextMenuEventDispatcher.addModifyAnnotationCallBack("SamplePDFLinkHelper") { call, result ->
             val configuration = call.arguments as? HashMap<String, Any>
             when (call.method) {
-                PluginUtils.KEY_MODIFY_ANNOTATION_ATTRIBUTE -> {
+                PluginUtils.EVENT_MODIFY_ANNOTATION_ATTRIBUTE -> {
                     val linkType = configuration.getString(PluginUtils.EVENT_ANNOT_ATTR_LINK_TYPE) ?: ""
                     val linkPage = configuration.getInt(PluginUtils.EVENT_ANNOT_ATTR_LINK_PAGE) ?: 1
                     val linkEmail = configuration.getString(PluginUtils.EVENT_ANNOT_ATTR_LINK_EMAIL) ?: ""
                     val linkWebsite = configuration.getString(PluginUtils.EVENT_ANNOT_ATTR_LINK_WEB)
-                    val annotationType = configuration.getString(PluginUtils.KEY_ANNOT_TYPE)
+                    val annotationType = configuration.getString(PluginUtils.EVENT_ANNOT_TYPE)
                     val cancelCreateLink = configuration.getBoolean(PluginUtils.EVENT_ANNOT_ATTR_LINK_CANCEL_CREATE) ?: false
                     if (cancelCreateLink) {
                         tpdfPage.deleteAnnotation(linkAnnotation)

+ 28 - 11
android/app/src/main/kotlin/com/compdfkit/pdfviewer/flutter/view/PDFReaderView.kt

@@ -1,7 +1,7 @@
 package com.compdfkit.pdfviewer.flutter.view
 
+import android.annotation.SuppressLint
 import android.content.Context
-import android.util.Log
 import android.widget.RelativeLayout
 import com.compdfkit.core.annotation.CPDFAnnotation
 import com.compdfkit.core.annotation.CPDFLineAnnotation
@@ -32,22 +32,38 @@ import io.flutter.plugin.common.EventChannel
 class PDFReaderView(context: Context?, messenger: BinaryMessenger) : RelativeLayout(context), IReaderViewCallback {
 
 
-    private var callbackEventEmitter: EventChannel.EventSink? = null
     var pdfReaderView = CPDFReaderView(context)
+
+    private var callbackEventEmitter: EventChannel.EventSink? = null
     private var focusedChangeCallbackEventEmitter: EventChannel.EventSink? = null
-    private var contextMenuHelper: SampleContextMenuHelper
+
+    // record current page index
     var currentPageIndex = 0
+    // record currentFocusedType is signature
+    var currentFocusedIsSignature : Boolean = false
+
     init {
         pdfReaderView.setReaderViewCallback(this)
         pdfReaderView.setOnFocusedTypeChangedListener {
-            focusedChangeCallbackEventEmitter?.success(it.name)
+
+        }
+        pdfReaderView.apply {
+            setReaderViewCallback(this@PDFReaderView)
+            contextMenuShowListener = SampleContextMenuHelper(pdfReaderView, context!!, messenger)
+            annotImplRegistry.registAttachHelper(CPDFLinkAnnotation::class.java, SamplePdfLinkAnnotAttachHelper::class.java)
+            isAllowAddAndEditAnnot = true
+            setFixedScroll(true)
+            setOnFocusedTypeChangedListener {
+                if (currentFocusedIsSignature && it == CPDFAnnotation.Type.STAMP){
+                    focusedChangeCallbackEventEmitter?.success(AnnotType.SIGNATURE.name)
+                }else{
+                    if (it == CPDFAnnotation.Type.UNKNOWN){
+                        focusedChangeCallbackEventEmitter?.success(it.name)
+                    }
+                }
+            }
         }
-        contextMenuHelper = SampleContextMenuHelper(pdfReaderView, context!!, messenger)
-        pdfReaderView.contextMenuShowListener = contextMenuHelper
-        pdfReaderView.annotImplRegistry.registAttachHelper(CPDFLinkAnnotation::class.java, SamplePdfLinkAnnotAttachHelper::class.java)
-        pdfReaderView.isAllowAddAndEditAnnot = true
         addView(pdfReaderView)
-        pdfReaderView.setFixedScroll(true)
     }
 
 
@@ -101,14 +117,16 @@ class PDFReaderView(context: Context?, messenger: BinaryMessenger) : RelativeLay
                 if (currentFocusedType == CPDFAnnotation.Type.INK) {
                     inkDrawHelper.onSave()
                 }
-
+                currentFocusedIsSignature = false
                 when {
                     AnnotType.ARROW.name.equals(annotationType, true) -> {
                         // If the annotation type is an arrow, change the line end type to [CPDFLineAnnotation.LineType.LINETYPE_ARROW].
                         currentFocusedType = CPDFAnnotation.Type.LINE
+
                         readerAttribute.annotAttribute.lineAttr.setLineType(CPDFLineAnnotation.LineType.LINETYPE_NONE, CPDFLineAnnotation.LineType.LINETYPE_ARROW)
                     }
                     AnnotType.SIGNATURE.name.equals(annotationType, true) -> {
+                        currentFocusedIsSignature = true
                         currentFocusedType = CPDFAnnotation.Type.STAMP
                     }
                     else -> {
@@ -123,7 +141,6 @@ class PDFReaderView(context: Context?, messenger: BinaryMessenger) : RelativeLay
     }
 
 
-
     fun setReaderViewCallbackEventEmitter(emitter: EventChannel.EventSink?) {
         callbackEventEmitter = emitter
     }

+ 0 - 1
android/app/src/main/res/layout/layout_select_text_content_view.xml

@@ -1,6 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
 <androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:app="http://schemas.android.com/apk/res-auto"
     android:layout_width="wrap_content"
     android:layout_height="wrap_content">
 

+ 1 - 1
ios/Runner/AppDelegate.swift

@@ -15,7 +15,7 @@ import Flutter
       let factory = PDFLNativeViewFactory(messenger: registrar!.messenger())
       self.registrar(forPlugin: "<plugin-name>")!.register(
           factory,
-          withId: "com.compdfkit.pdf.flutter")
+          withId: "com.compdfkit.pdf.flutter.pdfview")
       
     return super.application(application, didFinishLaunchingWithOptions: launchOptions)
   }

+ 1 - 1
ios/Runner/PDFNativeViewFactory.swift

@@ -78,7 +78,7 @@ class FLNativeView: NSObject, FlutterPlatformView {
         // iOS views can be created here
         createNativeView(view: _view)
         
-        let channel = FlutterMethodChannel(name: "com.compdfkit.pdf.flutter", binaryMessenger: messenger!)
+        let channel = FlutterMethodChannel(name: "com.compdfkit.pdf.flutter.pdfview.settings", binaryMessenger: messenger!)
         
         channel.setMethodCallHandler{(call : FlutterMethodCall, result : @escaping FlutterResult) in
             if (call.method == "setAnnotAttribute"){

+ 2 - 1
lib/compdfkit.dart

@@ -1,11 +1,12 @@
 import 'package:flutter/services.dart';
+import 'package:kmpdfkit_demo/widgets/contains.dart';
 
 class ComPDFKit {
   static MethodChannel? _privateChannel;
 
   static MethodChannel get _channel {
     if (_privateChannel == null) {
-      _privateChannel = const MethodChannel('com.compdfkit.global');
+      _privateChannel = const MethodChannel(ChannelNames.eventComPDFKitGlobal);
       _privateChannel?.setMethodCallHandler(_platformCallHandler);
     }
     return _privateChannel!;

+ 2 - 1
lib/widgets/compdfkit/compdfkit_widget.dart

@@ -5,6 +5,7 @@ import 'package:flutter/gestures.dart';
 import 'package:flutter/material.dart';
 import 'package:flutter/rendering.dart';
 import 'package:flutter/services.dart';
+import 'package:kmpdfkit_demo/widgets/contains.dart';
 
 
 ///
@@ -39,7 +40,7 @@ class _ComPDFKitWidgetState extends State<ComPDFKitWidget> {
 
   @override
   Widget build(BuildContext context) {
-    const String viewType = 'com.compdfkit.pdf.flutter';
+    const String viewType = ChannelNames.comPDFKitViewType;
     final Map<String, dynamic> creationParams = <String, dynamic>{
       'document': widget.documentPath,
       'configuration': widget.configuration

+ 7 - 5
lib/widgets/contains.dart

@@ -1,10 +1,12 @@
 class ChannelNames {
-  static const eventReaderViewCallback = 'event_reader_view_call_back';
+  static const comPDFKitViewType = 'com.compdfkit.pdf.flutter.pdfview';
+  static const eventComPDFKitGlobal = 'com.compdfkit.pdf.flutter.global';
+  static const eventReaderViewCallback = 'com.compdfkit.pdf.flutter.pdfview.view.call.back';
   static const eventReaderViewContextMenuHelper =
-      'event_reader_view_context_menu_helper';
-  static const eventModifyAnnotationAttr = 'method_modify_annotation_attribute';
-  static const eventCPDFReaderView = 'com.compdfkit.pdf.flutter';
-  static const eventFocusedChange = 'event_reader_view_focused_change_call_back';
+      'com.compdfkit.pdf.flutter.pdfview.context.menu.helper';
+  static const eventModifyAnnotationAttr = 'com.compdfkit.pdf.flutter.pdfview.modify.annotation.attribute';
+  static const eventCPDFReaderView = 'com.compdfkit.pdf.flutter.pdfview.settings';
+  static const eventFocusedChange = 'com.compdfkit.pdf.flutter.pdfview.focused.change.callback';
 }
 
 ///MethodChannel invokeMethod method name

+ 0 - 3
lib/widgets/events.dart

@@ -1,7 +1,5 @@
-import 'package:flutter/material.dart';
 import 'package:flutter/services.dart';
 import 'package:kmpdfkit_demo/widgets/contains.dart';
-import 'package:kmpdfkit_demo/widgets/extension/color_extension.dart';
 import 'package:kmpdfkit_demo/widgets/models/annot_bean.dart';
 
 import 'models/annot_attribute_bean.dart';
@@ -124,7 +122,6 @@ void setReaderViewContextMenuHelperListener(
   }).listen((event) {
     Map<dynamic, dynamic> result = event;
     String annotType = result[EventParameters.annotType];
-    print('setReaderViewContextMenuHelperListener:$event');
     AnnotationType type = AnnotationType.values.byName(annotType);
     showAnnotationAttributeOptions(AnnotBean(
       annotType: type,

+ 10 - 10
lib/widgets/function/annot_attribute_options_widget.dart

@@ -1,17 +1,17 @@
 import 'package:flutter/material.dart';
 import 'package:kmpdfkit_demo/widgets/contains.dart';
+import 'package:kmpdfkit_demo/widgets/function/attrwidget/attr_color_list_widget.dart';
 import 'package:kmpdfkit_demo/widgets/function/attrwidget/attr_free_text_widget.dart';
 import 'package:kmpdfkit_demo/widgets/function/attrwidget/attr_link_widget.dart';
-import 'package:kmpdfkit_demo/widgets/function/attrwidget/signature/attr_signature_list_widget.dart';
-import 'package:kmpdfkit_demo/widgets/function/attrwidget/stamp/attr_stamp_widget.dart';
+import 'package:kmpdfkit_demo/widgets/function/attrwidget/attr_shape_type_widget.dart';
 import 'package:kmpdfkit_demo/widgets/function/attrwidget/base_slider_widget.dart';
-import 'package:kmpdfkit_demo/widgets/function/attrwidget/attr_color_list_widget.dart';
-import 'package:kmpdfkit_demo/widgets/function/attrwidget/ink/attr_ink_pen_wave_widget.dart';
 import 'package:kmpdfkit_demo/widgets/function/attrwidget/ink/attr_ink_line_width_widget.dart';
-import 'package:kmpdfkit_demo/widgets/function/attrwidget/attr_shape_type_widget.dart';
+import 'package:kmpdfkit_demo/widgets/function/attrwidget/signature/attr_signature_list_widget.dart';
+import 'package:kmpdfkit_demo/widgets/function/attrwidget/stamp/attr_stamp_widget.dart';
 import 'package:kmpdfkit_demo/widgets/models/annot_attribute_bean.dart';
 import 'package:kmpdfkit_demo/widgets/models/annot_bean.dart';
 import 'package:kmpdfkit_demo/widgets/models/text_stamp_bean.dart';
+import 'package:kmpdfkit_demo/widgets/painting/wave_widget.dart';
 
 ///  annot_attribute_options_widget.dart
 ///
@@ -25,10 +25,10 @@ import 'package:kmpdfkit_demo/widgets/models/text_stamp_bean.dart';
 typedef AnnotAttributeOptionsCallback = void Function(AnnotAttributeBean);
 
 class AnnotAttributeOptionsWidget extends StatefulWidget {
-  AnnotBean annotBean;
+  final AnnotBean annotBean;
   final AnnotAttributeOptionsCallback attributeOptionsCallback;
 
-  AnnotAttributeOptionsWidget(
+  const AnnotAttributeOptionsWidget(
       {Key? key,
       required this.annotBean,
       required this.attributeOptionsCallback})
@@ -65,7 +65,7 @@ class _AnnotAttributeOptionsWidgetState
       case AnnotationType.ink:
         {
           return Column(mainAxisSize: MainAxisSize.min, children: [
-            InkCurvedWidget(
+            WaveWidget(
               color: widget.annotBean.attributeBean.color,
               lineWidth: widget.annotBean.attributeBean.borderWidth,
               alpha: widget.annotBean.attributeBean.alpha,
@@ -106,7 +106,7 @@ class _AnnotAttributeOptionsWidgetState
                 ..imagePath = imagePath
                 ..isSignature = true;
               widget.attributeOptionsCallback(widget.annotBean.attributeBean);
-              Navigator.pop(context);
+              Navigator.pop(context,1);
             },
           );
         }
@@ -125,7 +125,7 @@ class _AnnotAttributeOptionsWidgetState
                 ..customStampBean = textStampBean;
             }
             widget.attributeOptionsCallback(widget.annotBean.attributeBean);
-            Navigator.pop(context);
+            Navigator.pop(context, 1);
           });
         }
       case AnnotationType.link:

+ 90 - 60
lib/widgets/function/pdf_bottom_annot_fun_widget.dart

@@ -3,11 +3,10 @@ import 'package:flutter_svg/flutter_svg.dart';
 import 'package:kmpdfkit_demo/widgets/contains.dart';
 import 'package:kmpdfkit_demo/widgets/events.dart';
 import 'package:kmpdfkit_demo/widgets/function/annot_attribute_options_widget.dart';
-import 'package:kmpdfkit_demo/widgets/function/attrwidget/signature/attr_signature_list_widget.dart';
 import 'package:kmpdfkit_demo/widgets/models/annot_attribute_bean.dart';
 import 'package:kmpdfkit_demo/widgets/models/annot_bean.dart';
 
-///  pdf_bottom_annot_fun_widget.dart
+///  annot_tool_list_widget.dart
 ///
 ///  Copyright © 2014-2023 PDF Technologies, Inc. All Rights Reserved.
 ///
@@ -94,15 +93,23 @@ class _PDFBottomAnnotFunWidgetState extends State<PDFBottomAnnotFunWidget> {
   @override
   void initState() {
     super.initState();
+    // init annotation attribute , get attribute from android or ios
     initAnnotAttr();
+    // After listening to the CPDFReaderView comment, click the attribute adjustment, and the corresponding attribute adjustment interface will pop up
     setReaderViewContextMenuHelperListener((annotBean) {
-      _attributeOptionsModalBottomSheet(context, annotBean,
-          (AnnotAttributeBean bean) {
-        modifyAnnotationAttribute(
-            annotationType: annotBean.annotType, bean: bean);
-      }, () {
-        dismissModifyAnnotationAttribute();
-      });
+      // show annotation change attribute UI
+      _showAnnotationAttrOptionsWidget(
+          context: context,
+          annotBean: annotBean,
+          callback: (bean) {
+            //modify current select annotation attribute
+            modifyAnnotationAttribute(
+                annotationType: annotBean.annotType, bean: bean);
+          },
+          closeCallback: (stampHasResult) {
+            //close change attribute ui, send msg to android or ios
+            dismissModifyAnnotationAttribute();
+          });
     });
 
     setReaderViewFocusedChangeListener((annotationType) {
@@ -116,37 +123,40 @@ class _PDFBottomAnnotFunWidgetState extends State<PDFBottomAnnotFunWidget> {
 
   @override
   Widget build(BuildContext context) {
-    return annotFunctionMenuListWidget(selectAnnot, (annotBean) {
-      var annot = selectAnnot == annotBean.annotType
-          ? AnnotationType.unknown
-          : annotBean.attributeBean.shapeType;
-      setCPDFReaderViewFocusType(annot);
+    return annotMenuWidget(
+        selectAnnotType: selectAnnot,
+        onTap: (annotBean) {
+          changeFocusType(annotBean);
 
-      setState(() {
-        selectAnnot = selectAnnot == annotBean.annotType
-            ? AnnotationType.unknown
-            : annotBean.annotType;
-      });
+          setState(() {
+            selectAnnot = selectAnnot == annotBean.annotType
+                ? AnnotationType.unknown
+                : annotBean.annotType;
+          });
 
-      if (selectAnnot == AnnotationType.signature ||
-          selectAnnot == AnnotationType.stamp) {
-        showAttributeModalBottomSheet(context, annotBean);
-      }
-    }, (annotBean) {
-      setCPDFReaderViewFocusType(annotBean.attributeBean.shapeType);
-      setState(() {
-        selectAnnot = annotBean.annotType;
-      });
-      if(selectAnnot != AnnotationType.link && selectAnnot != AnnotationType.redact){
-        showAttributeModalBottomSheet(context, annotBean);
-      }
-    });
+          if (selectAnnot == AnnotationType.signature ||
+              selectAnnot == AnnotationType.stamp) {
+            // if is signature and stamp annotation show attribute change ui
+            showAttributeModalBottomSheet(context, annotBean);
+          }
+        },
+        onLongPress: (annotBean) {
+          setCPDFReaderViewFocusType(annotBean.attributeBean.shapeType);
+          setState(() {
+            selectAnnot = annotBean.annotType;
+          });
+
+          if (selectAnnot != AnnotationType.link &&
+              selectAnnot != AnnotationType.redact) {
+            showAttributeModalBottomSheet(context, annotBean);
+          }
+        });
   }
 
-  Widget annotFunctionMenuListWidget(
-      AnnotationType selectAnnotType,
-      Function(AnnotBean annotBean) onTap,
-      Function(AnnotBean annotBean) onLongPress) {
+  Widget annotMenuWidget(
+      {required AnnotationType selectAnnotType,
+      required Function(AnnotBean annotBean) onTap,
+      required Function(AnnotBean annotBean) onLongPress}) {
     return Container(
         color: const Color(0xFFEFF4FD),
         height: 60,
@@ -206,30 +216,38 @@ class _PDFBottomAnnotFunWidgetState extends State<PDFBottomAnnotFunWidget> {
 
   void showAttributeModalBottomSheet(
       BuildContext context, AnnotBean annotBean) {
-    _attributeOptionsModalBottomSheet(context, annotBean,
-        (AnnotAttributeBean attributeBean) async {
-      setAnnotAttribute(
-          annotationType: annotBean.annotType, bean: attributeBean);
-      AnnotBean bean = annotFunList
-          .firstWhere((element) => element.annotType == annotBean.annotType);
-      setState(() {
-        bean.attributeBean = attributeBean;
-      });
-    }, () {
-      setState(() {
-        if (selectAnnot == AnnotationType.signature ||
-            selectAnnot == AnnotationType.stamp) {
-          selectAnnot = AnnotationType.unknown;
-          setCPDFReaderViewFocusType(selectAnnot);
-        }
-      });
-    });
+    _showAnnotationAttrOptionsWidget(
+        context: context,
+        annotBean: annotBean,
+        callback: (AnnotAttributeBean attributeBean) async {
+          setAnnotAttribute(
+              annotationType: annotBean.annotType, bean: attributeBean);
+          AnnotBean bean = annotFunList.firstWhere(
+              (element) => element.annotType == annotBean.annotType);
+          setState(() {
+            bean.attributeBean = attributeBean;
+          });
+        },
+        closeCallback: (stampHasResult) {
+          setState(() {
+            if (selectAnnot == AnnotationType.signature ||
+                selectAnnot == AnnotationType.stamp) {
+              if (!stampHasResult) {
+                selectAnnot = AnnotationType.unknown;
+                setCPDFReaderViewFocusType(selectAnnot);
+              }
+            }
+          });
+        });
   }
 
-  void _attributeOptionsModalBottomSheet(context, AnnotBean annotBean,
-      AnnotAttributeOptionsCallback callback, VoidCallback? closeCallback) {
+  void _showAnnotationAttrOptionsWidget(
+      {context,
+      required AnnotBean annotBean,
+      required AnnotAttributeOptionsCallback callback,
+      Function(bool stampHasResult)? closeCallback}) {
     if (annotBean.annotType == AnnotationType.link) {
-      Future<void> close = showDialog(
+      Future<dynamic> close = showDialog(
           context: context,
           builder: (context) {
             return AnnotAttributeOptionsWidget(
@@ -239,11 +257,11 @@ class _PDFBottomAnnotFunWidgetState extends State<PDFBottomAnnotFunWidget> {
           });
       close.then((value) {
         if (closeCallback != null) {
-          closeCallback();
+          closeCallback(value != null);
         }
       });
     } else {
-      Future<void> close = showModalBottomSheet<int>(
+      Future<dynamic> close = showModalBottomSheet<int>(
           context: context,
           barrierColor: Colors.transparent,
           isScrollControlled: true,
@@ -256,7 +274,7 @@ class _PDFBottomAnnotFunWidgetState extends State<PDFBottomAnnotFunWidget> {
           });
       close.then((value) {
         if (closeCallback != null) {
-          closeCallback();
+          closeCallback(value != null);
         }
       });
     }
@@ -273,6 +291,8 @@ class _PDFBottomAnnotFunWidgetState extends State<PDFBottomAnnotFunWidget> {
         await getAnnotAttribute(AnnotationType.squiggly);
     AnnotAttributeBean ink = await getAnnotAttribute(AnnotationType.ink);
     AnnotAttributeBean shape = await getAnnotAttribute(AnnotationType.shape);
+    AnnotAttributeBean signature =
+        await getAnnotAttribute(AnnotationType.signature);
     AnnotAttributeBean freeText =
         await getAnnotAttribute(AnnotationType.freetext);
     setState(() {
@@ -301,10 +321,20 @@ class _PDFBottomAnnotFunWidgetState extends State<PDFBottomAnnotFunWidget> {
           case AnnotationType.freetext:
             element.attributeBean = freeText;
             break;
+          case AnnotationType.signature:
+            element.attributeBean = signature;
+            break;
           default:
             break;
         }
       }
     });
   }
+
+  void changeFocusType(AnnotBean annotBean) {
+    var annot = selectAnnot == annotBean.annotType
+        ? AnnotationType.unknown
+        : annotBean.attributeBean.shapeType;
+    setCPDFReaderViewFocusType(annot);
+  }
 }

+ 4 - 4
lib/widgets/function/attrwidget/attr_color_list_widget.dart

@@ -27,10 +27,10 @@ var annotColorList = [
 typedef AnnotColorOptionsCallback = void Function(Color color);
 
 class ColorListWidget extends StatefulWidget {
-  Color? color;
+  final Color color;
   final AnnotColorOptionsCallback colorOptionsCallback;
 
-  ColorListWidget(
+  const ColorListWidget(
       {Key? key, required this.color, required this.colorOptionsCallback})
       : super(key: key);
 
@@ -39,7 +39,7 @@ class ColorListWidget extends StatefulWidget {
 }
 
 class _ColorListWidgetState extends State<ColorListWidget> {
-  Color? selectColor;
+  late Color selectColor;
 
   @override
   void initState() {
@@ -62,7 +62,7 @@ class _ColorListWidgetState extends State<ColorListWidget> {
                   child: Column(
                     crossAxisAlignment: CrossAxisAlignment.center,
                     children: [
-                      if (selectColor?.value == annotColorList[index].value) ...[
+                      if (selectColor.value == annotColorList[index].value) ...[
                         const Icon(
                           Icons.arrow_drop_down_sharp,
                           size: 24,

+ 3 - 3
lib/widgets/function/attrwidget/attr_free_text_widget.dart

@@ -17,10 +17,10 @@ typedef AttrFreeTextCallback = Function(AnnotAttributeBean);
 ///  This notice may not be removed from this file.
 
 class AttrFreeTextWidget extends StatefulWidget {
-  AnnotAttributeBean bean;
-  AttrFreeTextCallback callback;
+  final AnnotAttributeBean bean;
+  final AttrFreeTextCallback callback;
 
-  AttrFreeTextWidget({Key? key, required this.bean, required this.callback})
+  const AttrFreeTextWidget({Key? key, required this.bean, required this.callback})
       : super(key: key);
 
   @override

+ 5 - 4
lib/widgets/function/attrwidget/attr_link_widget.dart

@@ -20,10 +20,11 @@ typedef AttrLinkCallback = Function(LinkType linkType, String linkUrl, int linkP
 typedef AttrLinkCancelCreateCallback = Function(bool cancelCreateLink);
 
 class AttrLinkWidget extends StatefulWidget {
-  AttrLinkCallback callback;
-  AttrLinkCancelCreateCallback cancelCreateCallback;
-  AnnotAttributeBean attributeBean;
-  AttrLinkWidget({Key? key,required this.attributeBean, required this.callback, required this.cancelCreateCallback}) : super(key: key);
+
+  final AttrLinkCallback callback;
+  final AttrLinkCancelCreateCallback cancelCreateCallback;
+  final AnnotAttributeBean attributeBean;
+  const AttrLinkWidget({Key? key,required this.attributeBean, required this.callback, required this.cancelCreateCallback}) : super(key: key);
 
   @override
   State<AttrLinkWidget> createState() => _AttrLinkWidgetState();

+ 3 - 3
lib/widgets/function/attrwidget/attr_shape_type_widget.dart

@@ -19,10 +19,10 @@ typedef ShapeAttrCallback = Function(
      AnnotAttributeBean bean);
 
 class ShapeAttrWidget extends StatefulWidget {
-  AnnotAttributeBean bean;
-  ShapeAttrCallback callback;
+  final AnnotAttributeBean bean;
+  final ShapeAttrCallback callback;
 
-  ShapeAttrWidget(
+  const ShapeAttrWidget(
       {Key? key,
       required this.bean,
       required this.callback})

+ 7 - 8
lib/widgets/function/attrwidget/base_slider_widget.dart

@@ -1,5 +1,4 @@
 import 'package:flutter/material.dart';
-import 'package:kmpdfkit_demo/widgets/function/attrwidget/attr_color_list_widget.dart';
 
 ///  annot_attribute_options_widget.dart
 ///
@@ -15,15 +14,15 @@ typedef AnnotSliderValueOptionsCallback = void Function(double value);
 enum ValueShowType { sourceValue, percentage }
 
 class BaseSliderWidget extends StatefulWidget {
-  double sliderCurrentValue = 0;
-  double sliderMaxValue;
-  double sliderMinValue = 0;
-  IconData icon;
-  ValueShowType valueShowType;
-  String valueText;
+  final double sliderCurrentValue;
+  final double sliderMaxValue;
+  final double sliderMinValue;
+  final IconData icon;
+  final ValueShowType valueShowType;
+  final String valueText;
   final AnnotSliderValueOptionsCallback sliderValueCallback;
 
-  BaseSliderWidget(
+  const BaseSliderWidget(
       {Key? key,
       required this.sliderCurrentValue,
       required this.sliderMinValue,

+ 3 - 3
lib/widgets/function/attrwidget/ink/attr_ink_line_width_widget.dart

@@ -15,10 +15,10 @@ import '../base_slider_widget.dart';
 typedef InkPenLineWidthCallback = Function(double lineWidth);
 
 class InkPenLineWidthWidget extends StatefulWidget {
-  double borderWidth = 2;
-  InkPenLineWidthCallback inkBorderWidthCallback;
+  final double borderWidth;
+  final InkPenLineWidthCallback inkBorderWidthCallback;
 
-  InkPenLineWidthWidget(
+  const InkPenLineWidthWidget(
       {Key? key,
       required this.borderWidth,
       required this.inkBorderWidthCallback})

+ 1 - 2
lib/widgets/function/attrwidget/signature/attr_signature_edit_widget.dart

@@ -1,4 +1,3 @@
-import 'dart:ui' as ui;
 import 'package:flutter/material.dart';
 import 'package:kmpdfkit_demo/widgets/function/attrwidget/attr_color_list_widget.dart';
 import 'package:kmpdfkit_demo/widgets/function/attrwidget/base_slider_widget.dart';
@@ -14,7 +13,7 @@ class AttrSignatureEditWidget extends StatefulWidget {
 }
 
 class _AttrSignatureEditWidgetState extends State<AttrSignatureEditWidget> {
-  GlobalKey<SfSignaturePadState> _signaturePadKey = GlobalKey();
+  final GlobalKey<SfSignaturePadState> _signaturePadKey = GlobalKey();
   double strokeWidth = 5;
   Color strokeColor = Colors.red;
 

+ 15 - 16
lib/widgets/function/attrwidget/signature/attr_signature_list_widget.dart

@@ -5,7 +5,6 @@ import 'package:kmpdfkit_demo/widgets/util/signature_image_util.dart';
 
 import 'attr_signature_edit_widget.dart';
 
-
 ///  attr_signature_list_widget.dart
 ///
 ///  Copyright © 2014-2023 PDF Technologies, Inc. All Rights Reserved.
@@ -18,8 +17,10 @@ import 'attr_signature_edit_widget.dart';
 typedef AttrSignatureCallback = Function(String imagePath);
 
 class AttrSignatureListWidget extends StatefulWidget {
-  AttrSignatureCallback callback;
-  AttrSignatureListWidget({Key? key, required this.callback}) : super(key: key);
+  final AttrSignatureCallback callback;
+
+  const AttrSignatureListWidget({Key? key, required this.callback})
+      : super(key: key);
 
   @override
   State<AttrSignatureListWidget> createState() =>
@@ -43,18 +44,19 @@ class _AttrSignatureListWidgetState extends State<AttrSignatureListWidget> {
           actions: [
             IconButton(
                 onPressed: () async {
-                  if(_isEditMode){
-                    SignatureImageUtil.delete(_signatureImageList.where((element) => element.select).toList());
+                  if (_isEditMode) {
+                    SignatureImageUtil.delete(_signatureImageList
+                        .where((element) => element.select)
+                        .toList());
                     setState(() {
                       _isEditMode = false;
                     });
                     _refreshSignatureImageList();
-                  }else{
+                  } else {
                     setState(() {
                       _isEditMode = true;
                     });
                   }
-                  
                 },
                 icon: Icon(_isEditMode ? Icons.delete : Icons.edit))
           ],
@@ -88,7 +90,8 @@ class _AttrSignatureListWidgetState extends State<AttrSignatureListWidget> {
                             value: _signatureImageList[index].select,
                             onChanged: (value) async {
                               setState(() {
-                                _signatureImageList[index].select = !_signatureImageList[index].select;
+                                _signatureImageList[index].select =
+                                    !_signatureImageList[index].select;
                               });
                             },
                           ))
@@ -96,7 +99,7 @@ class _AttrSignatureListWidgetState extends State<AttrSignatureListWidget> {
                   ],
                 ),
               ),
-              onTap: (){
+              onTap: () {
                 widget.callback(_signatureImageList[index].file.path);
               },
             );
@@ -130,13 +133,9 @@ class _AttrSignatureListWidgetState extends State<AttrSignatureListWidget> {
   }
 }
 
-
-class SignatureImageBean{
-
+class SignatureImageBean {
   File file;
   bool select;
-  
+
   SignatureImageBean(this.file, this.select);
-  
-  
-}
+}

+ 0 - 1
lib/widgets/function/attrwidget/stamp/attr_custom_stamp_edit_widget.dart

@@ -1,6 +1,5 @@
 import 'package:date_format/date_format.dart';
 import 'package:flutter/material.dart';
-import 'package:flutter/rendering.dart';
 import 'package:kmpdfkit_demo/widgets/function/attrwidget/stamp/attr_custom_stamp_preview_widget.dart';
 import 'package:kmpdfkit_demo/widgets/models/text_stamp_bean.dart';
 import 'package:kmpdfkit_demo/widgets/models/text_stamp_color_bean.dart';

+ 2 - 2
lib/widgets/function/attrwidget/stamp/attr_custom_stamp_preview_widget.dart

@@ -13,9 +13,9 @@ import 'package:kmpdfkit_demo/widgets/painting/stamp_shape_border.dart';
 ///  This notice may not be removed from this file.
 
 class AttrCustomStampPreviewWidget extends StatefulWidget {
-  TextStampBean bean;
+  final TextStampBean bean;
 
-  AttrCustomStampPreviewWidget({Key? key, required this.bean})
+  const AttrCustomStampPreviewWidget({Key? key, required this.bean})
       : super(key: key);
 
   @override

+ 3 - 3
lib/widgets/function/attrwidget/stamp/attr_stamp_widget.dart

@@ -51,9 +51,9 @@ typedef AttrStampCallback = Function(
     String? standardStampName, TextStampBean? textStampBean);
 
 class AttrStampWidget extends StatefulWidget {
-  AttrStampCallback callback;
+  final AttrStampCallback callback;
 
-  AttrStampWidget({Key? key, required this.callback}) : super(key: key);
+  const AttrStampWidget({Key? key, required this.callback}) : super(key: key);
 
   @override
   State<AttrStampWidget> createState() => _AttrStampWidgetState();
@@ -61,10 +61,10 @@ class AttrStampWidget extends StatefulWidget {
 
 class _AttrStampWidgetState extends State<AttrStampWidget>
     with AutomaticKeepAliveClientMixin, TickerProviderStateMixin {
+
   List<Tab> tabs = [const Tab(text: 'STANDARD'), const Tab(text: 'CUSTOM')];
   List<TextStampBean> _customTextStampList = [];
   late TabController _tabController;
-
   bool _isEditMode = false;
   int _selectIndex = 0;
 

+ 0 - 2
lib/widgets/models/annot_attribute_bean.dart

@@ -1,5 +1,3 @@
-import 'dart:ui';
-
 import 'package:flutter/material.dart';
 import 'package:kmpdfkit_demo/widgets/models/text_stamp_bean.dart';
 

+ 0 - 1
lib/widgets/models/annot_bean.dart

@@ -1,4 +1,3 @@
-import 'package:flutter/material.dart';
 import 'package:kmpdfkit_demo/widgets/contains.dart';
 
 import 'annot_attribute_bean.dart';

+ 0 - 2
lib/widgets/models/text_stamp_bean.dart

@@ -1,5 +1,3 @@
-import 'dart:ui';
-
 import 'package:flutter/material.dart';
 
 ///  text_stamp_bean.dart

+ 1 - 1
lib/widgets/page/pdf_page_widget.dart

@@ -3,7 +3,7 @@ import 'package:kmpdfkit_demo/widgets/compdfkit/compdfkit_widget.dart';
 import 'package:kmpdfkit_demo/widgets/events.dart';
 import 'package:kmpdfkit_demo/widgets/page_routes.dart';
 
-import '../function/pdf_bottom_annot_fun_widget.dart';
+import '../function/annot_tool_list_widget.dart';
 
 ///  pdf_page_widget.dart
 ///

+ 3 - 1
lib/widgets/painting/stamp_shape_border.dart

@@ -1,6 +1,8 @@
 import 'dart:math';
-import 'package:flutter/material.dart';
 import 'dart:math' as math;
+
+import 'package:flutter/material.dart';
+
 import '../models/text_stamp_bean.dart';
 
 

+ 21 - 18
lib/widgets/function/attrwidget/ink/attr_ink_pen_wave_widget.dart

@@ -1,7 +1,7 @@
 import 'package:flutter/material.dart';
 
 
-///  attr_ink_pen_wave_widget.dart
+///  wave_widget.dart
 ///
 ///  Copyright © 2014-2023 PDF Technologies, Inc. All Rights Reserved.
 ///
@@ -10,6 +10,26 @@ import 'package:flutter/material.dart';
 ///  UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES.
 ///  This notice may not be removed from this file.
 
+
+class WaveWidget extends StatefulWidget {
+
+  final Color color;
+  final double lineWidth;
+  final int alpha;
+  const WaveWidget({Key? key, required this.color,required this.lineWidth, required this.alpha}) : super(key: key);
+
+  @override
+  State<WaveWidget> createState() => _WaveWidgetState();
+}
+
+class _WaveWidgetState extends State<WaveWidget> {
+  @override
+  Widget build(BuildContext context) {
+    return CustomPaint(size: const Size(double.infinity, 100), painter: WavePainter(color: widget.color, lineWidth: widget.lineWidth, alpha: widget.alpha));
+  }
+}
+
+
 class WavePainter extends CustomPainter {
   
   final Color color;
@@ -38,20 +58,3 @@ class WavePainter extends CustomPainter {
   bool shouldRepaint(CustomPainter oldDelegate) => false;
 }
 
-class InkCurvedWidget extends StatefulWidget {
-  
-  Color color;
-  double lineWidth;
-  int alpha = 255;
-  InkCurvedWidget({Key? key, required this.color,required this.lineWidth, required this.alpha}) : super(key: key);
-
-  @override
-  State<InkCurvedWidget> createState() => _InkCurvedWidgetState();
-}
-
-class _InkCurvedWidgetState extends State<InkCurvedWidget> {
-  @override
-  Widget build(BuildContext context) {
-    return CustomPaint(size: const Size(double.infinity, 100), painter: WavePainter(color: widget.color, lineWidth: widget.lineWidth, alpha: widget.alpha));
-  }
-}

+ 2 - 1
lib/widgets/util/stamp_util.dart

@@ -1,13 +1,14 @@
 import 'dart:convert';
 import 'dart:io';
 import 'dart:ui' as ui;
+
 import 'package:flutter/material.dart';
 import 'package:flutter/rendering.dart';
 import 'package:kmpdfkit_demo/widgets/models/text_stamp_bean.dart';
+import 'package:path/path.dart';
 import 'package:path_provider/path_provider.dart';
 
 import 'image_util.dart';
-import 'package:path/path.dart';
 
 ///  stamp_util.dart
 ///

+ 0 - 1
test/widget_test.dart

@@ -7,7 +7,6 @@
 
 import 'package:flutter/material.dart';
 import 'package:flutter_test/flutter_test.dart';
-
 import 'package:kmpdfkit_demo/main.dart';
 
 void main() {