Просмотр исходного кода

ComPDFKit(flutter) - lint检查,问题修正

liuxiaolong 7 месяцев назад
Родитель
Сommit
73b650088e

+ 6 - 6
README.md

@@ -144,7 +144,7 @@ import 'package:compdfkit_flutter/cpdf_configuration.dart';
 
 import 'package:flutter/material.dart';
 
-const String DOCUMENT_PATH = 'pdfs/PDF_Document.pdf';
+const String _documentPath = 'pdfs/PDF_Document.pdf';
 
 void main() {
   runApp(const MyApp());
@@ -191,13 +191,13 @@ class _MyAppState extends State<MyApp> {
   }
 
   void showDocument(BuildContext context) async {
-    final bytes = await DefaultAssetBundle.of(context).load(DOCUMENT_PATH);
+    final bytes = await DefaultAssetBundle.of(context).load(_documentPath);
     final list = bytes.buffer.asUint8List();
     final tempDir = await ComPDFKit.getTemporaryDirectory();
     var pdfsDir = Directory('${tempDir.path}/pdfs');
     pdfsDir.createSync(recursive: true);
 
-    final tempDocumentPath = '${tempDir.path}/$DOCUMENT_PATH';
+    final tempDocumentPath = '${tempDir.path}/$_documentPath';
     final file = File(tempDocumentPath);
     if (!file.existsSync()) {
       file.create(recursive: true);
@@ -332,7 +332,7 @@ import 'package:compdfkit_flutter/cpdf_configuration.dart';
 
 import 'package:flutter/material.dart';
 
-const String DOCUMENT_PATH = 'pdfs/PDF_Document.pdf';
+const String _documentPath = 'pdfs/PDF_Document.pdf';
 
 void main() {
   runApp(const MyApp());
@@ -379,13 +379,13 @@ class _MyAppState extends State<MyApp> {
   }
 
   void showDocument(BuildContext context) async {
-    final bytes = await DefaultAssetBundle.of(context).load(DOCUMENT_PATH);
+    final bytes = await DefaultAssetBundle.of(context).load(_documentPath);
     final list = bytes.buffer.asUint8List();
     final tempDir = await ComPDFKit.getTemporaryDirectory();
     var pdfsDir = Directory('${tempDir.path}/pdfs');
     pdfsDir.createSync(recursive: true);
 
-    final tempDocumentPath = '${tempDir.path}/$DOCUMENT_PATH';
+    final tempDocumentPath = '${tempDir.path}/$_documentPath';
     final file = File(tempDocumentPath);
     if (!file.existsSync()) {
       file.create(recursive: true);

+ 1 - 1
example/android/app/build.gradle

@@ -55,7 +55,7 @@ android {
         applicationId "com.compdfkit.flutter.example"
         minSdkVersion 21
         targetSdkVersion 33
-        versionCode 4
+        versionCode 5
         versionName flutterVersionName
     }
 

+ 6 - 4
example/lib/main.dart

@@ -1,19 +1,21 @@
+///
 ///  Copyright © 2014-2024 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.
+///
+
 
 import 'dart:io';
 
 import 'package:compdfkit_flutter/compdfkit.dart';
 import 'package:compdfkit_flutter/cpdf_configuration.dart';
-import 'package:compdfkit_flutter/cpdf_options.dart';
 
 import 'package:flutter/material.dart';
 
-const String DOCUMENT_PATH = 'pdfs/PDF_Document.pdf';
+const String _documentPath = 'pdfs/PDF_Document.pdf';
 
 void main() {
   runApp(const MyApp());
@@ -61,12 +63,12 @@ class _MyAppState extends State<MyApp> {
   }
 
   void showDocument(BuildContext context) async {
-    final bytes = await DefaultAssetBundle.of(context).load(DOCUMENT_PATH);
+    final bytes = await DefaultAssetBundle.of(context).load(_documentPath);
     final list = bytes.buffer.asUint8List();
     final tempDir = await ComPDFKit.getTemporaryDirectory();
     var pdfsDir = Directory('${tempDir.path}/pdfs');
     pdfsDir.createSync(recursive: true);
-    final tempDocumentPath = '${tempDir.path}/$DOCUMENT_PATH';
+    final tempDocumentPath = '${tempDir.path}/$_documentPath';
     final file = File(tempDocumentPath);
     if (!file.existsSync()) {
       file.create(recursive: true);

+ 1 - 6
example/pubspec.yaml

@@ -5,7 +5,7 @@ homepage: https://www.compdf.com
 repository: https://github.com/ComPDFKit/compdfkit-pdf-sdk-flutter
 issue_tracker: https://www.compdf.com/support
 documentation: https://www.compdf.com/guides/pdf-sdk/flutter/overview
-
+publish_to: 'none'
 environment:
   sdk: '>=3.0.5 <4.0.0'
 
@@ -20,11 +20,6 @@ dependencies:
     sdk: flutter
 
   compdfkit_flutter:
-    # When depending on this package from a real application you should use:
-    #   compdfkit_flutter: ^x.y.z
-    # See https://dart.dev/tools/pub/dependencies#version-constraints
-    # The example app is bundled with the plugin so we use a path dependency on
-    # the parent directory to use the current plugin's version.
     path: ../
 
   # The following adds the Cupertino Icons font to your application.

+ 3 - 0
lib/compdfkit.dart

@@ -1,15 +1,18 @@
+///
 ///  Copyright © 2014-2024 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.
+///
 
 import 'dart:io';
 
 import 'package:compdfkit_flutter/cpdf_configuration.dart';
 import 'package:flutter/services.dart';
 
+/// ComPDFKit plugin to load PDF and image documents on both platform iOS and Android.
 class ComPDFKit {
   static const MethodChannel _methodChannel =
       MethodChannel('com.compdfkit.flutter.plugin');

+ 9 - 7
lib/cpdf_configuration.dart

@@ -1,16 +1,18 @@
-import 'dart:convert';
-
-import 'package:compdfkit_flutter/util/extension/cpdf_color_extension.dart';
-import 'package:flutter/material.dart';
-
-import 'cpdf_options.dart';
-
+///
 ///  Copyright © 2014-2024 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.
+///
+
+import 'dart:convert';
+
+import 'package:compdfkit_flutter/util/extension/cpdf_color_extension.dart';
+import 'package:flutter/material.dart';
+
+import 'cpdf_options.dart';
 
 /// modeConfig: Configuration of parameters that can be adjusted when opening a PDF interface.
 /// For example, setting the default display mode when opening, such as entering viewer or annotations mode.

+ 2 - 0
lib/cpdf_options.dart

@@ -1,9 +1,11 @@
+///
 ///  Copyright © 2014-2024 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.
+///
 
 enum CPreviewMode { viewer, annotations, contentEditor, forms, signatures }
 

+ 6 - 4
lib/util/extension/cpdf_color_extension.dart

@@ -1,13 +1,15 @@
-import 'dart:ui';
-
-import 'package:flutter/material.dart';
-
+///
 ///  Copyright © 2014-2024 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.
+///
+
+import 'dart:ui';
+
+import 'package:flutter/material.dart';
 
 extension HexColor on Color {
   String toHex({bool leadingHashSign = true}) => '${leadingHashSign ? '#' : ''}'