Переглянути джерело

【代码优化】 1.优化部分代码问题

liuxiaolong 1 рік тому
батько
коміт
b5c4473a4d

+ 1 - 1
CHANGELOG.md

@@ -1,3 +1,3 @@
 ## 0.0.1
 
-* TODO: Describe initial release.
+* First Release Version.

+ 22 - 11
README.md

@@ -1,15 +1,26 @@
-# kmpdfkit_conversion_flutter
+# Conversion SDK Flutter
 
-A new Flutter plugin project.
+## How to Use
 
-## Getting Started
+* InitSDK
+```dart
+    CPDFConverter.init("key", "secret");
+```
+* Conversion PDF
+```dart
+    CPDFConverter.convert(
+        taskId: const Uuid().v4(),
+        filePath: "pdfFilePath",
+        convertType: ConvertType.ppt, 
+        options: ConvertPPTOptions(
+            containAnnotations: true, 
+            containImages: true), 
+        callback: (TaskResult result) {
+            var progress = result.progress;
+            var taskId = result.taskId;
+            var taskStatus = result.taskStatus;
+            var outputPath = result.outPutPath;
+    });
+```
 
-This project is a starting point for a Flutter
-[plug-in package](https://flutter.dev/developing-packages/),
-a specialized package that includes platform-specific implementation code for
-Android and/or iOS.
-
-For help getting started with Flutter development, view the
-[online documentation](https://flutter.dev/docs), which offers tutorials,
-samples, guidance on mobile development, and a full API reference.
 

+ 0 - 13
example/lib/widgets/convert_list_widget.dart

@@ -56,7 +56,6 @@ class _ConvertListWidgetState extends State<ConvertListWidget> {
                   style: const TextStyle(fontSize: 12),
                 ),
                 trailing: Text(getStatusName(bean)),
-                // item 直观感受是整体大小
                 contentPadding:
                     const EdgeInsets.symmetric(horizontal: 12, vertical: 2),
                 onTap: () async {
@@ -64,18 +63,6 @@ class _ConvertListWidgetState extends State<ConvertListWidget> {
                     OpenFile.open(bean.outputPath);
                   }
                 },
-              ),
-              Row(
-                children: [
-                  ElevatedButton(onPressed: () {
-                    CPDFConverter.cancelTask();
-                  }, child: Text("取消任务")),
-                  ElevatedButton(onPressed: () {
-                    context
-                        .read<ConvertTaskQueueProvider>()
-                        .startTask(bean);
-                  }, child: Text("开始任务"))
-                ],
               )
             ],
           );

+ 1 - 1
example/pubspec.lock

@@ -126,7 +126,7 @@ packages:
       path: ".."
       relative: true
     source: path
-    version: "0.0.1+1"
+    version: "0.0.1"
   lints:
     dependency: transitive
     description:

+ 0 - 2
ios/Classes/ConversionSDKFlutterPlugin.swift

@@ -10,8 +10,6 @@ public class ConversionSDKFlutterPlugin : NSObject, FlutterPlugin {
     let instance = ConversionSDKFlutterPlugin()
       ConverFilePlugin(messenger: registrar.messenger())
       registrar.addMethodCallDelegate(instance, channel: channel)
-      
-
   }
 
   public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) {

+ 0 - 1
lib/cpdf_converter.dart

@@ -11,7 +11,6 @@ import 'dart:collection';
 
 import 'package:flutter/services.dart';
 import 'package:kmpdfkit_conversion_flutter/models/task_result.dart';
-import 'package:kmpdfkit_conversion_flutter/util/string_extensions.dart';
 
 import 'models/convert_status.dart';
 import 'models/convert_type.dart';

+ 2 - 4
lib/util/string_extensions.dart

@@ -3,7 +3,7 @@ import 'package:flutter/foundation.dart';
 
 extension StringExtension on String {
   String capitalize() {
-    if (this.isEmpty) {
+    if (isEmpty) {
       return this;
     } else {
       return this[0].toUpperCase() + substring(1);
@@ -11,12 +11,10 @@ extension StringExtension on String {
   }
 }
 
- String TAG = "CPDFConversion";
-
 void conversionLog(String msg){
   if (kDebugMode) {
     StringBuffer sb = StringBuffer();
-    sb.write(TAG );
+    sb.write("CPDFConversion");
     sb.write(" : ");
     sb.write(msg);
     print(sb.toString());

+ 4 - 50
pubspec.yaml

@@ -1,7 +1,7 @@
 name: kmpdfkit_conversion_flutter
-description: A new Flutter plugin project.
-version: 0.0.1+1
-homepage:
+description: Conversion SDK Flutter Plugin
+version: 0.0.1
+homepage: https://www.compdf.com/conversion
 
 environment:
   sdk: '>=2.19.6 <3.0.0'
@@ -17,21 +17,8 @@ dev_dependencies:
     sdk: flutter
   flutter_lints: ^2.0.0
 
-# For information on the generic Dart part of this file, see the
-# following page: https://dart.dev/tools/pub/pubspec
-
-# The following section is specific to Flutter packages.
 flutter:
-  # This section identifies this Flutter project as a plugin project.
-  # The 'pluginClass' specifies the class (in Java, Kotlin, Swift, Objective-C, etc.)
-  # which should be registered in the plugin registry. This is required for
-  # using method channels.
-  # The Android 'package' specifies package in which the registered class is.
-  # This is required for using method channels on Android.
-  # The 'ffiPlugin' specifies that native code should be built and bundled.
-  # This is required for using `dart:ffi`.
-  # All these are used by the tooling to maintain consistency when
-  # adding or updating assets for this project.
+
   plugin:
     platforms:
       android:
@@ -40,36 +27,3 @@ flutter:
 
       ios:
         pluginClass: ConversionSDKFlutterPlugin
-
-
-
-  # To add assets to your plugin package, add an assets section, like this:
-  # assets:
-  #   - images/a_dot_burr.jpeg
-  #   - images/a_dot_ham.jpeg
-  #
-  # For details regarding assets in packages, see
-  # https://flutter.dev/assets-and-images/#from-packages
-  #
-  # An image asset can refer to one or more resolution-specific "variants", see
-  # https://flutter.dev/assets-and-images/#resolution-aware
-
-  # To add custom fonts to your plugin package, add a fonts section here,
-  # in this "flutter" section. Each entry in this list should have a
-  # "family" key with the font family name, and a "fonts" key with a
-  # list giving the asset and other descriptors for the font. For
-  # example:
-  # fonts:
-  #   - family: Schyler
-  #     fonts:
-  #       - asset: fonts/Schyler-Regular.ttf
-  #       - asset: fonts/Schyler-Italic.ttf
-  #         style: italic
-  #   - family: Trajan Pro
-  #     fonts:
-  #       - asset: fonts/TrajanPro.ttf
-  #       - asset: fonts/TrajanPro_Bold.ttf
-  #         weight: 700
-  #
-  # For details regarding fonts in packages, see
-  # https://flutter.dev/custom-fonts/#from-packages