diff --git a/.gitignore b/.gitignore
index f226b14..e8d3882 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,3 +8,8 @@ build/
example/ios/Flutter/flutter_export_environment.sh
example/.flutter-plugins-dependencies
android/.idea/
+
+.idea/
+android/.settings/
+
+.vscode/
diff --git a/.idea/flutter_pdf_viewer.iml b/.idea/flutter_pdf_viewer.iml
deleted file mode 100644
index 55d90fc..0000000
--- a/.idea/flutter_pdf_viewer.iml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Dart_SDK.xml b/.idea/libraries/Dart_SDK.xml
deleted file mode 100644
index 80c115f..0000000
--- a/.idea/libraries/Dart_SDK.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Flutter_Plugins.xml b/.idea/libraries/Flutter_Plugins.xml
deleted file mode 100644
index 24324de..0000000
--- a/.idea/libraries/Flutter_Plugins.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
deleted file mode 100644
index 99ae653..0000000
--- a/.idea/misc.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
deleted file mode 100644
index fd5603f..0000000
--- a/.idea/modules.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
deleted file mode 100644
index 35eb1dd..0000000
--- a/.idea/vcs.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
deleted file mode 100644
index 2ef968f..0000000
--- a/.idea/workspace.xml
+++ /dev/null
@@ -1,544 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Android
-
-
- Class metricsJava
-
-
- Class structureJava
-
-
- Cloning issuesJava
-
-
- Code style issuesJava
-
-
- CorrectnessLintAndroid
-
-
- Dart
-
-
- Declaration redundancyJava
-
-
- DeclarationGroovy
-
-
- Dependency issuesJava
-
-
- EncapsulationJava
-
-
- Error handlingGroovy
-
-
- Error handlingJava
-
-
- FinalizationJava
-
-
- Flutter
-
-
- Google Cloud Endpoints
-
-
- Groovy
-
-
- HTML
-
-
- ImportsJava
-
-
- Inheritance issuesJava
-
-
- InitializationJava
-
-
- InternationalizationJava
-
-
- InternationalizationLintAndroid
-
-
- J2ME issuesJava
-
-
- Java
-
-
- Java 5Java language level migration aidsJava
-
-
- Java interop issuesKotlin
-
-
- Java language level migration aidsJava
-
-
- JavadocJava
-
-
- Kotlin
-
-
- LintAndroid
-
-
- MemoryJava
-
-
- Method metricsJava
-
-
- Naming conventionsJava
-
-
- Naming conventionsKotlin
-
-
- Packaging issuesJava
-
-
- PerformanceJava
-
-
- PerformanceLintAndroid
-
-
- Potentially confusing code constructsGroovy
-
-
- Probable bugsJava
-
-
- Probable bugsKotlin
-
-
- Properties Files
-
-
- Redundant constructsKotlin
-
-
- RegExp
-
-
- SecurityJava
-
-
- SecurityLintAndroid
-
-
- Threading issuesGroovy
-
-
- Threading issuesJava
-
-
- VisibilityJava
-
-
- XML
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 1551973615649
-
-
- 1551973615649
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- file://$PROJECT_DIR$/example/lib/main.dart
- 17
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Android
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 1.8
-
-
-
-
-
-
-
-
-
-
-
- flutter_pdf_viewer
-
-
-
-
-
-
-
-
-
-
-
-
- Dart SDK
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.vscode/launch.json b/.vscode/launch.json
deleted file mode 100644
index 345b640..0000000
--- a/.vscode/launch.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- // Use IntelliSense to learn about possible attributes.
- // Hover to view descriptions of existing attributes.
- // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
- "version": "0.2.0",
- "configurations": [
- {
- "name": "Flutter",
- "type": "dart",
- "request": "launch",
- "program": "./example/lib/main.dart"
- }
- ]
-}
\ No newline at end of file
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e6a9ada..70973fa 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,10 @@
# Changelog
-# 2.0.0
+
+## 2.0.1
+* Bug fixes related to cache
+* improvements
+
+## 2.0.0
* Null safety upgrade
* Fixed some issues
* new `numberPickerConfirmWidget`
diff --git a/analysis_options.yaml b/analysis_options.yaml
new file mode 100644
index 0000000..55309e9
--- /dev/null
+++ b/analysis_options.yaml
@@ -0,0 +1 @@
+include: package:lint/analysis_options.yaml
diff --git a/android/.classpath b/android/.classpath
deleted file mode 100644
index eb19361..0000000
--- a/android/.classpath
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
diff --git a/android/.gitignore b/android/.gitignore
index c6cbe56..62425c2 100644
--- a/android/.gitignore
+++ b/android/.gitignore
@@ -6,3 +6,6 @@
.DS_Store
/build
/captures
+.project
+.classpath
+.settings/
diff --git a/android/.project b/android/.project
deleted file mode 100644
index 6f9050a..0000000
--- a/android/.project
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
- flutter_plugin_pdf_viewer
- Project android created by Buildship.
-
-
-
-
- org.eclipse.jdt.core.javabuilder
-
-
-
-
- org.eclipse.buildship.core.gradleprojectbuilder
-
-
-
-
-
- org.eclipse.jdt.core.javanature
- org.eclipse.buildship.core.gradleprojectnature
-
-
diff --git a/android/.settings/org.eclipse.buildship.core.prefs b/android/.settings/org.eclipse.buildship.core.prefs
deleted file mode 100644
index 5628deb..0000000
--- a/android/.settings/org.eclipse.buildship.core.prefs
+++ /dev/null
@@ -1,13 +0,0 @@
-arguments=--scan
-auto.sync=false
-build.scans.enabled=false
-connection.gradle.distribution=GRADLE_DISTRIBUTION(VERSION(6.0-20191016123526+0000))
-connection.project.dir=
-eclipse.preferences.version=1
-gradle.user.home=
-java.home=/Library/Java/JavaVirtualMachines/jdk-11.0.4.jdk/Contents/Home
-jvm.arguments=
-offline.mode=false
-override.workspace.settings=true
-show.console.view=true
-show.executions.view=true
diff --git a/android/build.gradle b/android/build.gradle
index 3efafc3..e165f24 100644
--- a/android/build.gradle
+++ b/android/build.gradle
@@ -22,10 +22,10 @@ rootProject.allprojects {
apply plugin: 'com.android.library'
android {
- compileSdkVersion 28
+ compileSdkVersion 30
defaultConfig {
- minSdkVersion 16
+ minSdkVersion 21
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
lintOptions {
diff --git a/android/src/main/java/pt/tribeiro/flutter_plugin_pdf_viewer/FlutterPluginPdfViewerPlugin.java b/android/src/main/java/pt/tribeiro/flutter_plugin_pdf_viewer/FlutterPluginPdfViewerPlugin.java
index 9c23001..2757086 100644
--- a/android/src/main/java/pt/tribeiro/flutter_plugin_pdf_viewer/FlutterPluginPdfViewerPlugin.java
+++ b/android/src/main/java/pt/tribeiro/flutter_plugin_pdf_viewer/FlutterPluginPdfViewerPlugin.java
@@ -1,106 +1,131 @@
package pt.tribeiro.flutter_plugin_pdf_viewer;
+import android.app.Activity;
+import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.pdf.PdfRenderer;
-import android.os.Environment;
-import android.os.ParcelFileDescriptor;
+import android.os.Process;
+import android.os.*;
import android.util.Log;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.FilenameFilter;
-
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import io.flutter.embedding.engine.plugins.FlutterPlugin;
+import io.flutter.embedding.engine.plugins.activity.ActivityAware;
+import io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding;
import io.flutter.plugin.common.MethodCall;
import io.flutter.plugin.common.MethodChannel;
import io.flutter.plugin.common.MethodChannel.MethodCallHandler;
import io.flutter.plugin.common.MethodChannel.Result;
-import io.flutter.plugin.common.PluginRegistry.Registrar;
-import android.graphics.ColorMatrix;
-import android.graphics.ColorMatrixColorFilter;
-import android.os.HandlerThread;
-import android.os.Process;
-import android.os.Handler;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.FilenameFilter;
+import java.util.Locale;
/**
* FlutterPluginPdfViewerPlugin
*/
-public class FlutterPluginPdfViewerPlugin implements MethodCallHandler {
- private static Registrar instance;
- private HandlerThread handlerThread;
+public class FlutterPluginPdfViewerPlugin implements FlutterPlugin, MethodCallHandler, ActivityAware {
+ private static final String TAG = "PdfViewerPlugin";
+
private Handler backgroundHandler;
private final Object pluginLocker = new Object();
private final String filePrefix = "FlutterPluginPdfViewer";
- /**
- * Plugin registration.
- */
- public static void registerWith(Registrar registrar) {
- final MethodChannel channel = new MethodChannel(registrar.messenger(), "flutter_plugin_pdf_viewer");
- instance = registrar;
- channel.setMethodCallHandler(new FlutterPluginPdfViewerPlugin());
+ /// The MethodChannel that will the communication between Flutter and native Android
+ ///
+ /// This local reference serves to register the plugin with the Flutter Engine and unregister it
+ /// when the Flutter Engine is detached from the Activity
+ private MethodChannel channel;
+ private Context context;
+ private Activity activity;
+
+ @Override
+ public void onAttachedToEngine(@NonNull FlutterPluginBinding binding) {
+ channel = new MethodChannel(binding.getBinaryMessenger(), "flutter_plugin_pdf_viewer");
+ channel.setMethodCallHandler(this);
+ context = binding.getApplicationContext();
+ }
+
+ @Override
+ public void onDetachedFromEngine(@NonNull FlutterPluginBinding binding) {
+ channel.setMethodCallHandler(null);
}
@Override
- public void onMethodCall(final MethodCall call, final Result result) {
+ public void onMethodCall(@NonNull final MethodCall call, @NonNull final Result result) {
synchronized (pluginLocker) {
if (backgroundHandler == null) {
- handlerThread = new HandlerThread("flutterPdfViewer", Process.THREAD_PRIORITY_BACKGROUND);
+ HandlerThread handlerThread = new HandlerThread("flutterPdfViewer", Process.THREAD_PRIORITY_BACKGROUND);
handlerThread.start();
backgroundHandler = new Handler(handlerThread.getLooper());
}
}
- final Handler mainThreadHandler = new Handler();
- backgroundHandler.post(//
+ final Handler mainThreadHandler = new Handler(Looper.myLooper());
+ backgroundHandler.post(
new Runnable() {
@Override
public void run() {
switch (call.method) {
- case "getNumberOfPages":
- final String numResult = getNumberOfPages((String) call.argument("filePath"));
- mainThreadHandler.post(new Runnable() {
- @Override
- public void run() {
- result.success(numResult);
- }
- });
- break;
- case "getPage":
- final String pageResult = getPage((String) call.argument("filePath"),
- (int) call.argument("pageNumber"));
- mainThreadHandler.post(new Runnable() {
- @Override
- public void run() {
- result.success(pageResult);
+ case "getNumberOfPages":
+ final String numResult = getNumberOfPages((String) call.argument("filePath"));
+ mainThreadHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ result.success(numResult);
+ }
+ });
+ break;
+ case "getPage":
+ Integer pageNumber = call.argument("pageNumber");
+ final String pageResult = getPage((String) call.argument("filePath"), pageNumber);
+ if (pageResult == null) {
+ Log.d(TAG, "Retrieving page failed.");
+ result.notImplemented();
}
- });
- break;
- default:
- result.notImplemented();
- break;
+ mainThreadHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ result.success(pageResult);
+ }
+ });
+ break;
+ default:
+ result.notImplemented();
+ break;
}
}
- });
+ }
+ );
}
private String getNumberOfPages(String filePath) {
- File pdf = new File(filePath);
- try {
- clearCacheDir();
- PdfRenderer renderer = new PdfRenderer(ParcelFileDescriptor.open(pdf, ParcelFileDescriptor.MODE_READ_ONLY));
- Bitmap bitmap;
+ try (PdfRenderer renderer = new PdfRenderer(getPdfFile(filePath))) {
final int pageCount = renderer.getPageCount();
- return String.format("%d", pageCount);
+ if (!clearCacheDir()) {
+ Log.d("NumPages", "getNumberOfPages: failed to clean cache.");
+ }
+ return String.format(Locale.US, "%d", pageCount);
} catch (Exception ex) {
ex.printStackTrace();
}
return null;
}
+ private ParcelFileDescriptor getPdfFile(String filePath) throws FileNotFoundException {
+ File pdfFile = new File(filePath);
+ if (!pdfFile.canRead()) {
+ Log.d(TAG, "getPdfFile: Can't read file: " + filePath);
+ }
+ return ParcelFileDescriptor.open(pdfFile, ParcelFileDescriptor.MODE_READ_ONLY);
+ }
+
private boolean clearCacheDir() {
try {
- File directory = instance.context().getCacheDir();
+ File directory = context.getCacheDir();
FilenameFilter myFilter = new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
@@ -109,9 +134,10 @@ public boolean accept(File dir, String name) {
};
File[] files = directory.listFiles(myFilter);
// Log.d("Cache Files", "Size: " + files.length);
- for (int i = 0; i < files.length; i++) {
- // Log.d("Files", "FileName: " + files[i].getName());
- files[i].delete();
+ for (File file : files != null ? files : new File[0]) {
+ if (!file.delete()) {
+ Log.d("Cache files", String.format("Deleting file %s failed.", file.getName()));
+ }
}
return true;
} catch (Exception ex) {
@@ -127,11 +153,15 @@ private String getFileNameFromPath(String name) {
}
private String createTempPreview(Bitmap bmp, String name, int page) {
+ if (context == null) {
+ Log.d(TAG, "createTempPreview: Context is null!");
+ return null;
+ }
String fileNameOnly = getFileNameFromPath(name);
File file;
try {
- String fileName = String.format("%s-%d.png", fileNameOnly, page);
- file = File.createTempFile(fileName, null, instance.context().getCacheDir());
+ String fileName = String.format(Locale.US, "%s-%d.png", fileNameOnly, page);
+ file = File.createTempFile(fileName, null, context.getCacheDir());
FileOutputStream out = new FileOutputStream(file);
bmp.compress(Bitmap.CompressFormat.PNG, 100, out);
out.flush();
@@ -143,19 +173,18 @@ private String createTempPreview(Bitmap bmp, String name, int page) {
return file.getAbsolutePath();
}
- private String getPage(String filePath, int pageNumber) {
- File pdf = new File(filePath);
- try {
- PdfRenderer renderer = new PdfRenderer(ParcelFileDescriptor.open(pdf, ParcelFileDescriptor.MODE_READ_ONLY));
+ private String getPage(String filePath, @Nullable Integer pageNumber) {
+ try (PdfRenderer renderer = new PdfRenderer(getPdfFile(filePath))) {
final int pageCount = renderer.getPageCount();
- if (pageNumber > pageCount) {
+ if (pageNumber == null || pageNumber > pageCount) {
pageNumber = pageCount;
}
PdfRenderer.Page page = renderer.openPage(--pageNumber);
- double width = instance.activity().getResources().getDisplayMetrics().densityDpi * page.getWidth();
- double height = instance.activity().getResources().getDisplayMetrics().densityDpi * page.getHeight();
+ final int densityDpi = activity.getResources().getDisplayMetrics().densityDpi;
+ double width = densityDpi * page.getWidth();
+ double height = densityDpi * page.getHeight();
final double docRatio = width / height;
width = 2048;
@@ -166,19 +195,38 @@ private String getPage(String filePath, int pageNumber) {
canvas.drawColor(Color.WHITE);
// Render to bitmap
page.render(bitmap, null, null, PdfRenderer.Page.RENDER_MODE_FOR_DISPLAY);
+ String ret;
try {
- return createTempPreview(bitmap, filePath, pageNumber);
+ ret = createTempPreview(bitmap, filePath, pageNumber);
} finally {
- // close the page
page.close();
- // close the renderer
renderer.close();
}
+ return ret;
} catch (Exception ex) {
System.out.println(ex.getMessage());
ex.printStackTrace();
}
-
return null;
}
+
+ @Override
+ public void onAttachedToActivity(@NonNull ActivityPluginBinding binding) {
+ activity = binding.getActivity();
+ }
+
+ @Override
+ public void onDetachedFromActivityForConfigChanges() {
+ activity = null;
+ }
+
+ @Override
+ public void onReattachedToActivityForConfigChanges(@NonNull ActivityPluginBinding binding) {
+ activity = binding.getActivity();
+ }
+
+ @Override
+ public void onDetachedFromActivity() {
+ activity = null;
+ }
}
diff --git a/example/android/.project b/example/android/.project
deleted file mode 100644
index 17c95d4..0000000
--- a/example/android/.project
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
- android
- Project android_ created by Buildship.
-
-
-
-
- org.eclipse.buildship.core.gradleprojectbuilder
-
-
-
-
-
- org.eclipse.buildship.core.gradleprojectnature
-
-
diff --git a/example/android/.settings/org.eclipse.buildship.core.prefs b/example/android/.settings/org.eclipse.buildship.core.prefs
deleted file mode 100644
index 5628deb..0000000
--- a/example/android/.settings/org.eclipse.buildship.core.prefs
+++ /dev/null
@@ -1,13 +0,0 @@
-arguments=--scan
-auto.sync=false
-build.scans.enabled=false
-connection.gradle.distribution=GRADLE_DISTRIBUTION(VERSION(6.0-20191016123526+0000))
-connection.project.dir=
-eclipse.preferences.version=1
-gradle.user.home=
-java.home=/Library/Java/JavaVirtualMachines/jdk-11.0.4.jdk/Contents/Home
-jvm.arguments=
-offline.mode=false
-override.workspace.settings=true
-show.console.view=true
-show.executions.view=true
diff --git a/example/android/app/.classpath b/example/android/app/.classpath
deleted file mode 100644
index eb19361..0000000
--- a/example/android/app/.classpath
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
diff --git a/example/android/app/.project b/example/android/app/.project
deleted file mode 100644
index ac485d7..0000000
--- a/example/android/app/.project
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
- app
- Project app created by Buildship.
-
-
-
-
- org.eclipse.jdt.core.javabuilder
-
-
-
-
- org.eclipse.buildship.core.gradleprojectbuilder
-
-
-
-
-
- org.eclipse.jdt.core.javanature
- org.eclipse.buildship.core.gradleprojectnature
-
-
diff --git a/example/android/app/.settings/org.eclipse.buildship.core.prefs b/example/android/app/.settings/org.eclipse.buildship.core.prefs
deleted file mode 100644
index b1886ad..0000000
--- a/example/android/app/.settings/org.eclipse.buildship.core.prefs
+++ /dev/null
@@ -1,2 +0,0 @@
-connection.project.dir=..
-eclipse.preferences.version=1
diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle
index de2e629..ffaf493 100644
--- a/example/android/app/build.gradle
+++ b/example/android/app/build.gradle
@@ -8,7 +8,7 @@ if (localPropertiesFile.exists()) {
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
- throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
+ throw new Exception("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
@@ -25,7 +25,7 @@ apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
- compileSdkVersion 28
+ compileSdkVersion 30
lintOptions {
disable 'InvalidPackage'
@@ -35,7 +35,7 @@ android {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "pt.tribeiro.flutter_pdf_viewer_example"
minSdkVersion 16
- targetSdkVersion 28
+ targetSdkVersion 30
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@@ -55,7 +55,7 @@ flutter {
}
dependencies {
- testImplementation 'junit:junit:4.12'
- androidTestImplementation 'androidx.test.ext:junit:1.1.1'
- androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
+ testImplementation 'junit:junit:4.13.1'
+ androidTestImplementation 'androidx.test.ext:junit:1.1.2'
+ androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}
diff --git a/example/android/app/src/main/AndroidManifest.xml b/example/android/app/src/main/AndroidManifest.xml
index e0cb5b2..0236abb 100644
--- a/example/android/app/src/main/AndroidManifest.xml
+++ b/example/android/app/src/main/AndroidManifest.xml
@@ -1,7 +1,9 @@
-
-
+
+
diff --git a/example/android/build.gradle b/example/android/build.gradle
index bb8a303..fab3c2e 100644
--- a/example/android/build.gradle
+++ b/example/android/build.gradle
@@ -5,7 +5,7 @@ buildscript {
}
dependencies {
- classpath 'com.android.tools.build:gradle:3.2.1'
+ classpath 'com.android.tools.build:gradle:4.1.3'
}
}
diff --git a/example/android/gradle.properties b/example/android/gradle.properties
index 38c8d45..94adc3a 100644
--- a/example/android/gradle.properties
+++ b/example/android/gradle.properties
@@ -1,4 +1,3 @@
org.gradle.jvmargs=-Xmx1536M
-android.enableR8=true
android.useAndroidX=true
android.enableJetifier=true
diff --git a/example/android/gradle/wrapper/gradle-wrapper.properties b/example/android/gradle/wrapper/gradle-wrapper.properties
index 2819f02..828299d 100644
--- a/example/android/gradle/wrapper/gradle-wrapper.properties
+++ b/example/android/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
-#Fri Jun 23 08:50:38 CEST 2017
+#Thu May 27 13:16:22 TRT 2021
distributionBase=GRADLE_USER_HOME
+distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
distributionPath=wrapper/dists
-zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
+zipStoreBase=GRADLE_USER_HOME
diff --git a/example/ios/Flutter/AppFrameworkInfo.plist b/example/ios/Flutter/AppFrameworkInfo.plist
index 9367d48..8d4492f 100644
--- a/example/ios/Flutter/AppFrameworkInfo.plist
+++ b/example/ios/Flutter/AppFrameworkInfo.plist
@@ -21,6 +21,6 @@
CFBundleVersion
1.0
MinimumOSVersion
- 8.0
+ 9.0
diff --git a/example/ios/Flutter/Flutter.podspec b/example/ios/Flutter/Flutter.podspec
new file mode 100644
index 0000000..663d5b2
--- /dev/null
+++ b/example/ios/Flutter/Flutter.podspec
@@ -0,0 +1,18 @@
+#
+# NOTE: This podspec is NOT to be published. It is only used as a local source!
+# This is a generated file; do not edit or check into version control.
+#
+
+Pod::Spec.new do |s|
+ s.name = 'Flutter'
+ s.version = '1.0.0'
+ s.summary = 'High-performance, high-fidelity mobile apps.'
+ s.homepage = 'https://flutter.io'
+ s.license = { :type => 'MIT' }
+ s.author = { 'Flutter Dev Team' => 'flutter-dev@googlegroups.com' }
+ s.source = { :git => 'https://github.com/flutter/engine', :tag => s.version.to_s }
+ s.ios.deployment_target = '9.0'
+ # Framework linking is handled by Flutter tooling, not CocoaPods.
+ # Add a placeholder to satisfy `s.dependency 'Flutter'` plugin podspecs.
+ s.vendored_frameworks = 'path/to/nothing'
+end
diff --git a/example/ios/Podfile b/example/ios/Podfile
index d077b08..f7d6a5e 100644
--- a/example/ios/Podfile
+++ b/example/ios/Podfile
@@ -10,60 +10,29 @@ project 'Runner', {
'Release' => :release,
}
-def parse_KV_file(file, separator='=')
- file_abs_path = File.expand_path(file)
- if !File.exists? file_abs_path
- return [];
+def flutter_root
+ generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
+ unless File.exist?(generated_xcode_build_settings_path)
+ raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end
- pods_ary = []
- skip_line_start_symbols = ["#", "/"]
- File.foreach(file_abs_path) { |line|
- next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ }
- plugin = line.split(pattern=separator)
- if plugin.length == 2
- podname = plugin[0].strip()
- path = plugin[1].strip()
- podpath = File.expand_path("#{path}", file_abs_path)
- pods_ary.push({:name => podname, :path => podpath});
- else
- puts "Invalid plugin specification: #{line}"
- end
- }
- return pods_ary
+
+ File.foreach(generated_xcode_build_settings_path) do |line|
+ matches = line.match(/FLUTTER_ROOT\=(.*)/)
+ return matches[1].strip if matches
+ end
+ raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end
-target 'Runner' do
- # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
- # referring to absolute paths on developers' machines.
- system('rm -rf .symlinks')
- system('mkdir -p .symlinks/plugins')
+require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
- # Flutter Pods
- generated_xcode_build_settings = parse_KV_file('./Flutter/Generated.xcconfig')
- if generated_xcode_build_settings.empty?
- puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter packages get is executed first."
- end
- generated_xcode_build_settings.map { |p|
- if p[:name] == 'FLUTTER_FRAMEWORK_DIR'
- symlink = File.join('.symlinks', 'flutter')
- File.symlink(File.dirname(p[:path]), symlink)
- pod 'Flutter', :path => File.join(symlink, File.basename(p[:path]))
- end
- }
+flutter_ios_podfile_setup
- # Plugin Pods
- plugin_pods = parse_KV_file('../.flutter-plugins')
- plugin_pods.map { |p|
- symlink = File.join('.symlinks', 'plugins', p[:name])
- File.symlink(p[:path], symlink)
- pod p[:name], :path => File.join(symlink, 'ios')
- }
+target 'Runner' do
+ flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end
post_install do |installer|
installer.pods_project.targets.each do |target|
- target.build_configurations.each do |config|
- config.build_settings['ENABLE_BITCODE'] = 'NO'
- end
+ flutter_additional_ios_build_settings(target)
end
end
diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock
index 17071d9..d21683b 100644
--- a/example/ios/Podfile.lock
+++ b/example/ios/Podfile.lock
@@ -1,43 +1,43 @@
PODS:
- - Flutter (1.0.0)
- - flutter_plugin_pdf_viewer (1.0.4):
+ - advance_pdf_viewer (1.0.5):
- Flutter
+ - Flutter (1.0.0)
- FMDB (2.7.5):
- FMDB/standard (= 2.7.5)
- FMDB/standard (2.7.5)
- - path_provider (0.0.1):
+ - path_provider_ios (0.0.1):
- Flutter
- - sqflite (0.0.1):
+ - sqflite (0.0.2):
- Flutter
- - FMDB (~> 2.7.2)
+ - FMDB (>= 2.7.5)
DEPENDENCIES:
- - Flutter (from `.symlinks/flutter/ios`)
- - flutter_plugin_pdf_viewer (from `.symlinks/plugins/flutter_plugin_pdf_viewer/ios`)
- - path_provider (from `.symlinks/plugins/path_provider/ios`)
+ - advance_pdf_viewer (from `.symlinks/plugins/advance_pdf_viewer/ios`)
+ - Flutter (from `Flutter`)
+ - path_provider_ios (from `.symlinks/plugins/path_provider_ios/ios`)
- sqflite (from `.symlinks/plugins/sqflite/ios`)
SPEC REPOS:
- https://github.com/cocoapods/specs.git:
+ trunk:
- FMDB
EXTERNAL SOURCES:
+ advance_pdf_viewer:
+ :path: ".symlinks/plugins/advance_pdf_viewer/ios"
Flutter:
- :path: ".symlinks/flutter/ios"
- flutter_plugin_pdf_viewer:
- :path: ".symlinks/plugins/flutter_plugin_pdf_viewer/ios"
- path_provider:
- :path: ".symlinks/plugins/path_provider/ios"
+ :path: Flutter
+ path_provider_ios:
+ :path: ".symlinks/plugins/path_provider_ios/ios"
sqflite:
:path: ".symlinks/plugins/sqflite/ios"
SPEC CHECKSUMS:
- Flutter: 9d0fac939486c9aba2809b7982dfdbb47a7b0296
- flutter_plugin_pdf_viewer: 17f908f9d9c947bc74df607f323631c9403d8362
+ advance_pdf_viewer: 5c832f382b4ca84fe735f893b7e91aa830c27d7b
+ Flutter: 50d75fe2f02b26cc09d224853bb45737f8b3214a
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
- path_provider: 09407919825bfe3c2deae39453b7a5b44f467873
- sqflite: d1612813fa7db7c667bed9f1d1b508deffc56999
+ path_provider_ios: 7d7ce634493af4477d156294792024ec3485acd5
+ sqflite: 6d358c025f5b867b29ed92fc697fd34924e11904
-PODFILE CHECKSUM: aff02bfeed411c636180d6812254b2daeea14d09
+PODFILE CHECKSUM: 8e679eca47255a8ca8067c4c67aab20e64cb974d
-COCOAPODS: 1.5.3
+COCOAPODS: 1.11.2
diff --git a/example/ios/Runner.xcodeproj/project.pbxproj b/example/ios/Runner.xcodeproj/project.pbxproj
index 4aee550..259ae9a 100644
--- a/example/ios/Runner.xcodeproj/project.pbxproj
+++ b/example/ios/Runner.xcodeproj/project.pbxproj
@@ -3,17 +3,13 @@
archiveVersion = 1;
classes = {
};
- objectVersion = 46;
+ objectVersion = 50;
objects = {
/* Begin PBXBuildFile section */
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
- 3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; };
- 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
6D55BAC56DE10BABF0AC1F65 /* libPods-Runner.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 891A8C9FF5B821D232AB24A2 /* libPods-Runner.a */; };
- 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; };
- 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; };
978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; };
97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; };
@@ -29,8 +25,6 @@
dstPath = "";
dstSubfolderSpec = 10;
files = (
- 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */,
- 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */,
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
@@ -40,21 +34,22 @@
/* Begin PBXFileReference section */
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; };
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; };
+ 261B8F2B90675232BFD11D30 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Pods/Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; };
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; };
- 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = ""; };
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; };
7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; };
7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; };
891A8C9FF5B821D232AB24A2 /* libPods-Runner.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Runner.a"; sourceTree = BUILT_PRODUCTS_DIR; };
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; };
9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; };
- 9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = ""; };
97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
97C146F21CF9000F007C117D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; };
97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; };
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
+ AD925B29B8AA2BE1BBD3FA75 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; };
+ F34B8A221C50DAEAF0F62311 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -62,8 +57,6 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
- 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */,
- 3B80C3941E831B6300D905FE /* App.framework in Frameworks */,
6D55BAC56DE10BABF0AC1F65 /* libPods-Runner.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
@@ -82,6 +75,9 @@
95832890FED17C9D15108BDA /* Pods */ = {
isa = PBXGroup;
children = (
+ F34B8A221C50DAEAF0F62311 /* Pods-Runner.debug.xcconfig */,
+ AD925B29B8AA2BE1BBD3FA75 /* Pods-Runner.release.xcconfig */,
+ 261B8F2B90675232BFD11D30 /* Pods-Runner.profile.xcconfig */,
);
name = Pods;
sourceTree = "";
@@ -89,9 +85,7 @@
9740EEB11CF90186004384FC /* Flutter */ = {
isa = PBXGroup;
children = (
- 3B80C3931E831B6300D905FE /* App.framework */,
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */,
- 9740EEBA1CF902C7004384FC /* Flutter.framework */,
9740EEB21CF90195004384FC /* Debug.xcconfig */,
7AFA3C8E1D35360C0083082E /* Release.xcconfig */,
9740EEB31CF90195004384FC /* Generated.xcconfig */,
@@ -156,7 +150,6 @@
97C146EC1CF9000F007C117D /* Resources */,
9705A1C41CF9048500538489 /* Embed Frameworks */,
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
- 03FA7B63A3760F7F81A4C00F /* [CP] Embed Pods Frameworks */,
);
buildRules = (
);
@@ -173,7 +166,7 @@
97C146E61CF9000F007C117D /* Project object */ = {
isa = PBXProject;
attributes = {
- LastUpgradeCheck = 0910;
+ LastUpgradeCheck = 1300;
ORGANIZATIONNAME = "The Chromium Authors";
TargetAttributes = {
97C146ED1CF9000F007C117D = {
@@ -215,28 +208,6 @@
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
- 03FA7B63A3760F7F81A4C00F /* [CP] Embed Pods Frameworks */ = {
- isa = PBXShellScriptBuildPhase;
- buildActionMask = 2147483647;
- files = (
- );
- inputFileListPaths = (
- );
- inputPaths = (
- "${SRCROOT}/Pods/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh",
- "${PODS_ROOT}/../.symlinks/flutter/ios/Flutter.framework",
- );
- name = "[CP] Embed Pods Frameworks";
- outputFileListPaths = (
- );
- outputPaths = (
- "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Flutter.framework",
- );
- runOnlyForDeploymentPostprocessing = 0;
- shellPath = /bin/sh;
- shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
- showEnvVarsInLog = 0;
- };
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
@@ -249,7 +220,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
- shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin";
+ shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin";
};
3F2081737C9EFB1B7CA0E85F /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
@@ -324,7 +295,6 @@
/* Begin XCBuildConfiguration section */
249021D3217E4FDB00AE95B9 /* Profile */ = {
isa = XCBuildConfiguration;
- baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
@@ -362,7 +332,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 8.0;
+ IPHONEOS_DEPLOYMENT_TARGET = 9.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
@@ -383,7 +353,10 @@
"$(PROJECT_DIR)/Flutter",
);
INFOPLIST_FILE = Runner/Info.plist;
- LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
+ LD_RUNPATH_SEARCH_PATHS = (
+ "$(inherited)",
+ "@executable_path/Frameworks",
+ );
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
@@ -396,7 +369,6 @@
};
97C147031CF9000F007C117D /* Debug */ = {
isa = XCBuildConfiguration;
- baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
@@ -440,7 +412,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 8.0;
+ IPHONEOS_DEPLOYMENT_TARGET = 9.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
@@ -450,7 +422,6 @@
};
97C147041CF9000F007C117D /* Release */ = {
isa = XCBuildConfiguration;
- baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
@@ -488,7 +459,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 8.0;
+ IPHONEOS_DEPLOYMENT_TARGET = 9.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
@@ -508,7 +479,10 @@
"$(PROJECT_DIR)/Flutter",
);
INFOPLIST_FILE = Runner/Info.plist;
- LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
+ LD_RUNPATH_SEARCH_PATHS = (
+ "$(inherited)",
+ "@executable_path/Frameworks",
+ );
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
@@ -531,7 +505,10 @@
"$(PROJECT_DIR)/Flutter",
);
INFOPLIST_FILE = Runner/Info.plist;
- LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
+ LD_RUNPATH_SEARCH_PATHS = (
+ "$(inherited)",
+ "@executable_path/Frameworks",
+ );
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
diff --git a/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata
index 1d526a1..919434a 100644
--- a/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata
+++ b/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata
@@ -2,6 +2,6 @@
+ location = "self:">
diff --git a/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
index 786d6aa..f156018 100644
--- a/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
+++ b/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
@@ -1,6 +1,6 @@
-
-
-
- BuildSystemType
- Original
-
-
diff --git a/example/lib/main.dart b/example/lib/main.dart
index 40a1bcf..2cd6f8f 100644
--- a/example/lib/main.dart
+++ b/example/lib/main.dart
@@ -1,7 +1,9 @@
import 'package:flutter/material.dart';
import 'package:advance_pdf_viewer/advance_pdf_viewer.dart';
-void main() => runApp(MyApp());
+void main() => runApp(MaterialApp(
+ home: MyApp(),
+ ));
class MyApp extends StatefulWidget {
@override
@@ -30,7 +32,7 @@ class _MyAppState extends State {
document = await PDFDocument.fromAsset('assets/sample2.pdf');
} else if (value == 2) {
document = await PDFDocument.fromURL(
- "http://conorlastowka.com/book/CitationNeededBook-Sample.pdf",
+ "https://unec.edu.az/application/uploads/2014/12/pdf-sample.pdf",
/* cacheManager: CacheManager(
Config(
"customCacheKey",
@@ -43,86 +45,85 @@ class _MyAppState extends State {
document = await PDFDocument.fromAsset('assets/sample.pdf');
}
setState(() => _isLoading = false);
+ Navigator.pop(context);
}
@override
Widget build(BuildContext context) {
- return MaterialApp(
- home: Scaffold(
- drawer: Drawer(
- child: Column(
- children: [
- SizedBox(height: 36),
- ListTile(
- title: Text('Load from Assets'),
- onTap: () {
- changePDF(1);
- },
- ),
- ListTile(
- title: Text('Load from URL'),
- onTap: () {
- changePDF(2);
- },
- ),
- ListTile(
- title: Text('Restore default'),
- onTap: () {
- changePDF(3);
- },
- ),
- ],
- ),
- ),
- appBar: AppBar(
- title: const Text('FlutterPluginPDFViewer'),
+ return Scaffold(
+ drawer: Drawer(
+ child: Column(
+ children: [
+ SizedBox(height: 36),
+ ListTile(
+ title: Text('Load from Assets'),
+ onTap: () {
+ changePDF(1);
+ },
+ ),
+ ListTile(
+ title: Text('Load from URL'),
+ onTap: () {
+ changePDF(2);
+ },
+ ),
+ ListTile(
+ title: Text('Restore default'),
+ onTap: () {
+ changePDF(3);
+ },
+ ),
+ ],
),
- body: Center(
- child: _isLoading
- ? Center(child: CircularProgressIndicator())
- : PDFViewer(
- document: document,
- zoomSteps: 1,
- //uncomment below line to preload all pages
- // lazyLoad: false,
- // uncomment below line to scroll vertically
- // scrollDirection: Axis.vertical,
+ ),
+ appBar: AppBar(
+ title: const Text('FlutterPluginPDFViewer'),
+ ),
+ body: Center(
+ child: _isLoading
+ ? Center(child: CircularProgressIndicator())
+ : PDFViewer(
+ document: document,
+ zoomSteps: 1,
+ //uncomment below line to preload all pages
+ // lazyLoad: false,
+ // uncomment below line to scroll vertically
+ // scrollDirection: Axis.vertical,
- //uncomment below code to replace bottom navigation with your own
- /* navigationBuilder:
- (context, page, totalPages, jumpToPage, animateToPage) {
- return ButtonBar(
- alignment: MainAxisAlignment.spaceEvenly,
- children: [
- IconButton(
- icon: Icon(Icons.first_page),
- onPressed: () {
- jumpToPage()(page: 0);
- },
- ),
- IconButton(
- icon: Icon(Icons.arrow_back),
- onPressed: () {
- animateToPage(page: page - 2);
- },
- ),
- IconButton(
- icon: Icon(Icons.arrow_forward),
- onPressed: () {
- animateToPage(page: page);
- },
- ),
- IconButton(
- icon: Icon(Icons.last_page),
- onPressed: () {
- jumpToPage(page: totalPages - 1);
- },
- ),
- ],
- );
- }, */
- ),
- ),
+ //uncomment below code to replace bottom navigation with your own
+ /* navigationBuilder:
+ (context, page, totalPages, jumpToPage, animateToPage) {
+ return ButtonBar(
+ alignment: MainAxisAlignment.spaceEvenly,
+ children: [
+ IconButton(
+ icon: Icon(Icons.first_page),
+ onPressed: () {
+ jumpToPage()(page: 0);
+ },
+ ),
+ IconButton(
+ icon: Icon(Icons.arrow_back),
+ onPressed: () {
+ animateToPage(page: page - 2);
+ },
+ ),
+ IconButton(
+ icon: Icon(Icons.arrow_forward),
+ onPressed: () {
+ animateToPage(page: page);
+ },
+ ),
+ IconButton(
+ icon: Icon(Icons.last_page),
+ onPressed: () {
+ jumpToPage(page: totalPages - 1);
+ },
+ ),
+ ],
+ );
+ }, */
+ ),
),
);
}
diff --git a/example/pubspec.lock b/example/pubspec.lock
index 4702643..92116da 100644
--- a/example/pubspec.lock
+++ b/example/pubspec.lock
@@ -7,21 +7,14 @@ packages:
path: ".."
relative: true
source: path
- version: "2.0.0"
- archive:
- dependency: transitive
- description:
- name: archive
- url: "https://pub.dartlang.org"
- source: hosted
- version: "3.1.2"
+ version: "2.0.1"
async:
dependency: transitive
description:
name: async
url: "https://pub.dartlang.org"
source: hosted
- version: "2.6.1"
+ version: "2.8.2"
boolean_selector:
dependency: transitive
description:
@@ -35,14 +28,14 @@ packages:
name: characters
url: "https://pub.dartlang.org"
source: hosted
- version: "1.1.0"
+ version: "1.2.0"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.dartlang.org"
source: hosted
- version: "1.2.0"
+ version: "1.3.1"
clock:
dependency: transitive
description:
@@ -63,7 +56,7 @@ packages:
name: crypto
url: "https://pub.dartlang.org"
source: hosted
- version: "3.0.0"
+ version: "3.0.1"
cupertino_icons:
dependency: "direct main"
description:
@@ -103,7 +96,7 @@ packages:
name: flutter_cache_manager
url: "https://pub.dartlang.org"
source: hosted
- version: "3.0.2"
+ version: "3.3.0"
flutter_test:
dependency: "direct dev"
description: flutter
@@ -123,13 +116,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "4.0.0"
- image:
- dependency: transitive
- description:
- name: image
- url: "https://pub.dartlang.org"
- source: hosted
- version: "3.0.2"
infinite_listview:
dependency: transitive
description:
@@ -143,14 +129,14 @@ packages:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
- version: "0.12.10"
+ version: "0.12.11"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
- version: "1.3.0"
+ version: "1.7.0"
numberpicker:
dependency: transitive
description:
@@ -171,14 +157,28 @@ packages:
name: path_provider
url: "https://pub.dartlang.org"
source: hosted
- version: "2.0.1"
+ version: "2.0.8"
+ path_provider_android:
+ dependency: transitive
+ description:
+ name: path_provider_android
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "2.0.11"
+ path_provider_ios:
+ dependency: transitive
+ description:
+ name: path_provider_ios
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "2.0.7"
path_provider_linux:
dependency: transitive
description:
name: path_provider_linux
url: "https://pub.dartlang.org"
source: hosted
- version: "2.0.0"
+ version: "2.1.2"
path_provider_macos:
dependency: transitive
description:
@@ -199,7 +199,7 @@ packages:
name: path_provider_windows
url: "https://pub.dartlang.org"
source: hosted
- version: "2.0.0"
+ version: "2.0.4"
pedantic:
dependency: transitive
description:
@@ -207,13 +207,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.11.0"
- petitparser:
- dependency: transitive
- description:
- name: petitparser
- url: "https://pub.dartlang.org"
- source: hosted
- version: "4.0.2"
platform:
dependency: transitive
description:
@@ -309,7 +302,7 @@ packages:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
- version: "0.3.0"
+ version: "0.4.3"
typed_data:
dependency: transitive
description:
@@ -330,7 +323,7 @@ packages:
name: vector_math
url: "https://pub.dartlang.org"
source: hosted
- version: "2.1.0"
+ version: "2.1.1"
win32:
dependency: transitive
description:
@@ -345,13 +338,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.0"
- xml:
- dependency: transitive
- description:
- name: xml
- url: "https://pub.dartlang.org"
- source: hosted
- version: "5.0.2"
sdks:
- dart: ">=2.12.0 <3.0.0"
- flutter: ">=1.24.0-10"
+ dart: ">=2.14.0 <3.0.0"
+ flutter: ">=2.5.0"
diff --git a/flutter_plugin_pdf_viewer.iml b/flutter_plugin_pdf_viewer.iml
deleted file mode 100644
index 1bf5f5c..0000000
--- a/flutter_plugin_pdf_viewer.iml
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ios/Classes/FlutterPluginPdfViewerPlugin.m b/ios/Classes/FlutterPluginPdfViewerPlugin.m
index 5919a46..4e3dde1 100644
--- a/ios/Classes/FlutterPluginPdfViewerPlugin.m
+++ b/ios/Classes/FlutterPluginPdfViewerPlugin.m
@@ -1,7 +1,6 @@
#import "FlutterPluginPdfViewerPlugin.h"
static NSString* const kDirectory = @"FlutterPluginPdfViewer";
-static NSString* const kFilePath = @"file:///";
static NSString* kFileName = @"";
@implementation FlutterPluginPdfViewerPlugin
@@ -31,14 +30,10 @@ - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result {
-(NSString *)getNumberOfPages:(NSString *)url
{
- NSURL * sourcePDFUrl;
- if([url containsString:kFilePath]){
- sourcePDFUrl = [NSURL URLWithString:url];
- }else{
- sourcePDFUrl = [NSURL URLWithString:[kFilePath stringByAppendingString:url]];
- }
- CGPDFDocumentRef SourcePDFDocument = CGPDFDocumentCreateWithURL((__bridge CFURLRef)sourcePDFUrl);
- size_t numberOfPages = CGPDFDocumentGetNumberOfPages(SourcePDFDocument);
+ NSURL * sourcePDFUrl = [[NSURL alloc] initFileURLWithPath:url];
+ CGPDFDocumentRef sourcePDFDocument = CGPDFDocumentCreateWithURL((__bridge CFURLRef)sourcePDFUrl);
+ size_t numberOfPages = CGPDFDocumentGetNumberOfPages(sourcePDFDocument);
+ CGPDFDocumentRelease(sourcePDFDocument);
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
NSString *temporaryDirectory = [paths objectAtIndex:0];
NSString *filePathAndDirectory = [temporaryDirectory stringByAppendingPathComponent:kDirectory];
@@ -62,20 +57,14 @@ -(NSString *)getNumberOfPages:(NSString *)url
kFileName = [[NSUUID UUID] UUIDString];
NSLog(@"[FlutterPluginPdfViewer] File has %zd pages", numberOfPages);
- NSLog(@"[FlutterPluginPdfViewer] File will be saved in cache as %@", kFileName);
return [NSString stringWithFormat:@"%zd", numberOfPages];
}
-(NSString*)getPage:(NSString *)url ofPage:(size_t)pageNumber
{
- NSURL * sourcePDFUrl;
- if([url containsString:kFilePath]){
- sourcePDFUrl = [NSURL URLWithString:url];
- }else{
- sourcePDFUrl = [NSURL URLWithString:[kFilePath stringByAppendingString:url]];
- }
- CGPDFDocumentRef SourcePDFDocument = CGPDFDocumentCreateWithURL((__bridge CFURLRef)sourcePDFUrl);
- size_t numberOfPages = CGPDFDocumentGetNumberOfPages(SourcePDFDocument);
+ NSURL * sourcePDFUrl = [[NSURL alloc] initFileURLWithPath:url];
+ CGPDFDocumentRef sourcePDFDocument = CGPDFDocumentCreateWithURL((__bridge CFURLRef)sourcePDFUrl);
+ size_t numberOfPages = CGPDFDocumentGetNumberOfPages(sourcePDFDocument);
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
NSString *temporaryDirectory = [paths objectAtIndex:0];
NSString *filePathAndDirectory = [temporaryDirectory stringByAppendingPathComponent:kDirectory];
@@ -93,11 +82,11 @@ -(NSString*)getPage:(NSString *)url ofPage:(size_t)pageNumber
NSLog(@"Create directory error: %@", error);
return nil;
}
- CGPDFPageRef SourcePDFPage = CGPDFDocumentGetPage(SourcePDFDocument, pageNumber);
- CGPDFPageRetain(SourcePDFPage);
+ CGPDFPageRef sourcePDFPage = CGPDFDocumentGetPage(sourcePDFDocument, pageNumber);
+ CGPDFPageRetain(sourcePDFPage);
NSString *relativeOutputFilePath = [NSString stringWithFormat:@"%@/%@-%d.png", kDirectory, kFileName, (int)pageNumber];
NSString *imageFilePath = [temporaryDirectory stringByAppendingPathComponent:relativeOutputFilePath];
- CGRect sourceRect = CGPDFPageGetBoxRect(SourcePDFPage, kCGPDFMediaBox);
+ CGRect sourceRect = CGPDFPageGetBoxRect(sourcePDFPage, kCGPDFMediaBox);
UIGraphicsBeginPDFContextToFile(imageFilePath, sourceRect, nil);
// Calculate resolution
// Set DPI to 300
@@ -115,12 +104,14 @@ -(NSString*)getPage:(NSString *)url ofPage:(size_t)pageNumber
CGContextTranslateCTM(currentContext, 0.0, height);
CGContextScaleCTM(currentContext, dpi, -dpi);
CGContextSaveGState(currentContext);
- CGContextDrawPDFPage (currentContext, SourcePDFPage);
+ CGContextDrawPDFPage (currentContext, sourcePDFPage);
CGContextRestoreGState(currentContext);
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
[UIImagePNGRepresentation(image) writeToFile: imageFilePath atomically:YES];
+ CGPDFPageRelease(sourcePDFPage);
+ CGPDFDocumentRelease(sourcePDFDocument);
return imageFilePath;
}
-@end
\ No newline at end of file
+@end
diff --git a/lib/advance_pdf_viewer.dart b/lib/advance_pdf_viewer.dart
index 9dbc068..94a3f6a 100644
--- a/lib/advance_pdf_viewer.dart
+++ b/lib/advance_pdf_viewer.dart
@@ -1,7 +1,8 @@
library advance_pdf_viewer;
+export 'package:flutter_cache_manager/flutter_cache_manager.dart';
+
export 'src/document.dart' show PDFDocument;
export 'src/page.dart' show PDFPage;
-export 'src/viewer.dart' show PDFViewer, IndicatorPosition;
export 'src/tooltip.dart' show PDFViewerTooltip;
-export 'package:flutter_cache_manager/flutter_cache_manager.dart';
+export 'src/viewer.dart' show PDFViewer, IndicatorPosition;
diff --git a/lib/src/document.dart b/lib/src/document.dart
index d159e72..669cda8 100644
--- a/lib/src/document.dart
+++ b/lib/src/document.dart
@@ -1,30 +1,31 @@
import 'dart:async';
import 'dart:io';
+import 'package:advance_pdf_viewer/src/page.dart';
import 'package:flutter/services.dart';
import 'package:flutter_cache_manager/flutter_cache_manager.dart';
-import 'package:advance_pdf_viewer/src/page.dart';
import 'package:path_provider/path_provider.dart';
class PDFDocument {
static const MethodChannel _channel =
- const MethodChannel('flutter_plugin_pdf_viewer');
+ MethodChannel('flutter_plugin_pdf_viewer');
String? _filePath;
late int count;
- List _pages = [];
+ final _pages = [];
bool _preloaded = false;
+ String? get filePath => _filePath;
/// Load a PDF File from a given File
/// [File file], file to be loaded
///
static Future fromFile(File file) async {
- PDFDocument document = PDFDocument();
+ final document = PDFDocument();
document._filePath = file.path;
try {
- var pageCount = await _channel
+ final pageCount = await _channel
.invokeMethod('getNumberOfPages', {'filePath': file.path});
- document.count = document.count = int.parse(pageCount);
+ document.count = document.count = int.parse(pageCount as String);
} catch (e) {
throw Exception('Error reading PDF!');
}
@@ -40,14 +41,14 @@ class PDFDocument {
static Future fromURL(String url,
{Map? headers, CacheManager? cacheManager}) async {
// Download into cache
- File f = await (cacheManager ?? DefaultCacheManager())
+ final f = await (cacheManager ?? DefaultCacheManager())
.getSingleFile(url, headers: headers);
- PDFDocument document = PDFDocument();
+ final document = PDFDocument();
document._filePath = f.path;
try {
- var pageCount =
+ final pageCount =
await _channel.invokeMethod('getNumberOfPages', {'filePath': f.path});
- document.count = document.count = int.parse(pageCount);
+ document.count = document.count = int.parse(pageCount as String);
} catch (e) {
throw Exception('Error reading PDF!');
}
@@ -60,20 +61,20 @@ class PDFDocument {
static Future fromAsset(String asset) async {
File file;
try {
- var dir = await getApplicationDocumentsDirectory();
- file = File("${dir.path}/file.pdf");
- var data = await rootBundle.load(asset);
- var bytes = data.buffer.asUint8List();
+ final dir = await getApplicationDocumentsDirectory();
+ file = File("${dir.path}/${DateTime.now().millisecondsSinceEpoch}.pdf");
+ final data = await rootBundle.load(asset);
+ final bytes = data.buffer.asUint8List();
await file.writeAsBytes(bytes, flush: true);
} catch (e) {
throw Exception('Error parsing asset file!');
}
- PDFDocument document = PDFDocument();
+ final document = PDFDocument();
document._filePath = file.path;
try {
- var pageCount = await _channel
+ final pageCount = await _channel
.invokeMethod('getNumberOfPages', {'filePath': file.path});
- document.count = document.count = int.parse(pageCount);
+ document.count = document.count = int.parse(pageCount as String);
} catch (e) {
throw Exception('Error reading PDF!');
}
@@ -93,10 +94,10 @@ class PDFDocument {
}) async {
assert(page > 0);
if (_preloaded && _pages.isNotEmpty) return _pages[page - 1];
- var data = await _channel
+ final data = await _channel
.invokeMethod('getPage', {'filePath': _filePath, 'pageNumber': page});
- return new PDFPage(
- data,
+ return PDFPage(
+ data as String?,
page,
onZoomChanged: onZoomChanged,
zoomSteps: zoomSteps ?? 3,
@@ -118,7 +119,7 @@ class PDFDocument {
final data = await _channel.invokeMethod(
'getPage', {'filePath': _filePath, 'pageNumber': countvar});
_pages.add(PDFPage(
- data,
+ data as String?,
countvar,
onZoomChanged: onZoomChanged,
zoomSteps: zoomSteps ?? 3,
@@ -134,14 +135,23 @@ class PDFDocument {
// Stream all pages
Stream getAll({final Function(double)? onZoomChanged}) {
return Future.forEach(List.filled(count, null), (i) async {
- print(i);
final data = await _channel
.invokeMethod('getPage', {'filePath': _filePath, 'pageNumber': i});
- return new PDFPage(
- data,
+ return PDFPage(
+ data as String?,
1,
onZoomChanged: onZoomChanged,
);
}).asStream() as Stream;
}
+
+ @override
+ bool operator ==(Object other) =>
+ identical(this, other) ||
+ other is PDFDocument &&
+ runtimeType == other.runtimeType &&
+ _filePath == other._filePath;
+
+ @override
+ int get hashCode => Object.hash(_filePath, count);
}
diff --git a/lib/src/page.dart b/lib/src/page.dart
index bc6c7df..d691e2c 100644
--- a/lib/src/page.dart
+++ b/lib/src/page.dart
@@ -19,7 +19,7 @@ class PDFPage extends StatefulWidget {
final double minScale;
final double maxScale;
final double panLimit;
- PDFPage(
+ const PDFPage(
this.imgPath,
this.num, {
this.onZoomChanged,
@@ -50,25 +50,27 @@ class _PDFPageState extends State {
}
}
- _repaint() {
+ void _repaint() {
provider = FileImage(File(widget.imgPath!));
final resolver = provider.resolve(createLocalImageConfiguration(context));
- resolver.addListener(ImageStreamListener((imgInfo, alreadyPainted) {
- if (!alreadyPainted) setState(() {});
- }));
+ resolver.addListener(
+ ImageStreamListener(
+ (imgInfo, alreadyPainted) {
+ if (!alreadyPainted && mounted) setState(() {});
+ },
+ ),
+ );
}
@override
Widget build(BuildContext context) {
- return Container(
- decoration: null,
- child: ZoomableWidget(
- onZoomChanged: widget.onZoomChanged,
- zoomSteps: widget.zoomSteps,
- minScale: widget.minScale,
- panLimit: widget.panLimit,
- maxScale: widget.maxScale,
- child: Image(image: provider),
- ));
+ return ZoomableWidget(
+ onZoomChanged: widget.onZoomChanged,
+ zoomSteps: widget.zoomSteps,
+ minScale: widget.minScale,
+ panLimit: widget.panLimit,
+ maxScale: widget.maxScale,
+ child: Image(image: provider),
+ );
}
}
diff --git a/lib/src/page_picker.dart b/lib/src/page_picker.dart
index 36013fe..78ca579 100644
--- a/lib/src/page_picker.dart
+++ b/lib/src/page_picker.dart
@@ -3,7 +3,7 @@ import 'package:flutter/widgets.dart';
import 'package:numberpicker/numberpicker.dart';
class PagePicker extends StatefulWidget {
- PagePicker({
+ const PagePicker({
required this.title,
required this.maxValue,
required this.initialValue,
@@ -40,8 +40,8 @@ class _PagePickerState extends State {
),
actions: [
TextButton(
- child: widget.numberPickerConfirmWidget ?? Text('OK'),
onPressed: () => Navigator.of(context).pop(_currentValue),
+ child: widget.numberPickerConfirmWidget ?? const Text('OK'),
),
],
);
diff --git a/lib/src/viewer.dart b/lib/src/viewer.dart
index c1383a3..a0d74a8 100644
--- a/lib/src/viewer.dart
+++ b/lib/src/viewer.dart
@@ -1,7 +1,6 @@
+import 'package:advance_pdf_viewer/advance_pdf_viewer.dart';
import 'package:advance_pdf_viewer/src/page_picker.dart';
import 'package:flutter/material.dart';
-import 'package:advance_pdf_viewer/advance_pdf_viewer.dart';
-import 'package:numberpicker/numberpicker.dart';
/// enum to describe indicator position
enum IndicatorPosition { topLeft, topRight, bottomLeft, bottomRight }
@@ -58,7 +57,7 @@ class PDFViewer extends StatefulWidget {
)? navigationBuilder;
final Widget? progressIndicator;
- PDFViewer({
+ const PDFViewer({
Key? key,
required this.document,
this.scrollDirection,
@@ -83,7 +82,7 @@ class PDFViewer extends StatefulWidget {
this.pickerIconColor,
this.onPageChanged,
}) : super(key: key);
-
+ @override
_PDFViewerState createState() => _PDFViewerState();
}
@@ -93,57 +92,62 @@ class _PDFViewerState extends State {
bool _swipeEnabled = true;
List? _pages;
late PageController _pageController;
- final Duration animationDuration = Duration(milliseconds: 200);
- final Curve animationCurve = Curves.easeIn;
+ final animationDuration = const Duration(milliseconds: 200);
+ final animationCurve = Curves.easeIn;
@override
void initState() {
super.initState();
+ _initialize();
+ }
+
+ void _initialize() {
_pages = List.filled(widget.document.count, null);
_pageController = widget.controller ?? PageController();
_pageNumber = _pageController.initialPage + 1;
- if (!widget.lazyLoad)
- widget.document.preloadPages(
- onZoomChanged: onZoomChanged,
- zoomSteps: widget.zoomSteps,
- minScale: widget.minScale,
- maxScale: widget.maxScale,
- panLimit: widget.panLimit,
- );
+ if (!widget.lazyLoad) _preloadPages();
+ }
+
+ @override
+ void didUpdateWidget(PDFViewer oldWidget) {
+ super.didUpdateWidget(oldWidget);
+ if (oldWidget.document.filePath != widget.document.filePath) {
+ _initialize();
+ _isLoading = true;
+ _loadPage();
+ }
}
@override
void didChangeDependencies() {
super.didChangeDependencies();
- _pageNumber = _pageController.initialPage + 1;
- _isLoading = true;
- _pages = List.filled(widget.document.count,null);
- // _loadAllPages();
+ _initialize();
_loadPage();
}
- @override
- void didUpdateWidget(PDFViewer oldWidget) {
- super.didUpdateWidget(oldWidget);
- }
+ Future _preloadPages() async {
+ int countvar = 1;
+ for (final _ in List.filled(widget.document.count, null)) {
+ final data = await widget.document.get(
+ page: countvar,
+ onZoomChanged: onZoomChanged,
+ zoomSteps: widget.zoomSteps,
+ minScale: widget.minScale,
+ maxScale: widget.maxScale,
+ panLimit: widget.panLimit,
+ );
+ _pages![countvar - 1] = data;
- onZoomChanged(double scale) {
- if (scale != 1.0) {
- setState(() {
- _swipeEnabled = false;
- });
- } else {
- setState(() {
- _swipeEnabled = true;
- });
+ countvar++;
}
}
- _loadPage() async {
+ void onZoomChanged(double scale) =>
+ setState(() => _swipeEnabled = scale == 1.0);
+
+ Future _loadPage() async {
if (_pages![_pageNumber - 1] != null) return;
- setState(() {
- _isLoading = true;
- });
+ setState(() => _isLoading = true);
final data = await widget.document.get(
page: _pageNumber,
onZoomChanged: onZoomChanged,
@@ -153,29 +157,29 @@ class _PDFViewerState extends State {
panLimit: widget.panLimit,
);
_pages![_pageNumber - 1] = data;
- if (mounted) {
- setState(() {
- _isLoading = false;
- });
- }
+ if (mounted) setState(() => _isLoading = false);
}
- _animateToPage({int? page}) {
- _pageController.animateToPage(page != null ? page : _pageNumber - 1,
+ void _animateToPage({int? page}) {
+ _pageController.animateToPage(page ?? _pageNumber - 1,
duration: animationDuration, curve: animationCurve);
}
- _jumpToPage({int? page}) {
- _pageController.jumpToPage(page != null ? page : _pageNumber - 1);
+ void _jumpToPage({int? page}) {
+ _pageController.jumpToPage(page ?? _pageNumber - 1);
}
Widget _drawIndicator() {
- Widget child = GestureDetector(
+ final child = GestureDetector(
onTap:
widget.showPicker && widget.document.count > 1 ? _pickPage : null,
child: Container(
- padding:
- EdgeInsets.only(top: 4.0, left: 16.0, bottom: 4.0, right: 16.0),
+ padding: const EdgeInsets.only(
+ top: 4.0,
+ left: 16.0,
+ bottom: 4.0,
+ right: 16.0,
+ ),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4.0),
color: widget.indicatorBackground),
@@ -199,21 +203,20 @@ class _PDFViewerState extends State {
}
}
- _pickPage() {
- showDialog(
- context: context,
- builder: (BuildContext context) {
- return PagePicker(
- title: widget.tooltip.pick,
- maxValue: widget.document.count,
- initialValue: _pageNumber,
- );
- }).then((int? value) {
- if (value != null) {
- _pageNumber = value;
- _jumpToPage();
- }
- });
+ Future _pickPage() async {
+ final value = await showDialog(
+ context: context,
+ builder: (_) => PagePicker(
+ title: widget.tooltip.pick,
+ maxValue: widget.document.count,
+ initialValue: _pageNumber,
+ ),
+ );
+
+ if (value != null) {
+ _pageNumber = value;
+ _jumpToPage();
+ }
}
@override
@@ -225,11 +228,9 @@ class _PDFViewerState extends State {
physics:
_swipeEnabled && widget.enableSwipeNavigation && !_isLoading
? null
- : NeverScrollableScrollPhysics(),
+ : const NeverScrollableScrollPhysics(),
onPageChanged: (page) {
- setState(() {
- _pageNumber = page + 1;
- });
+ setState(() => _pageNumber = page + 1);
_loadPage();
widget.onPageChanged?.call(page);
},
@@ -238,28 +239,26 @@ class _PDFViewerState extends State {
itemCount: _pages?.length ?? 0,
itemBuilder: (context, index) => _pages![index] == null
? Center(
- child:
- widget.progressIndicator ?? CircularProgressIndicator(),
+ child: widget.progressIndicator ??
+ const CircularProgressIndicator.adaptive(),
)
: _pages![index]!,
),
- (widget.showIndicator && !_isLoading)
- ? _drawIndicator()
- : Container(),
+ if (widget.showIndicator && !_isLoading) _drawIndicator(),
],
),
floatingActionButton: widget.showPicker && widget.document.count > 1
? FloatingActionButton(
elevation: 4.0,
tooltip: widget.tooltip.jump,
- child: Icon(
- Icons.view_carousel,
- color: widget.pickerIconColor ?? Colors.white,
- ),
backgroundColor: widget.pickerButtonColor ?? Colors.blue,
onPressed: () {
_pickPage();
},
+ child: Icon(
+ Icons.view_carousel,
+ color: widget.pickerIconColor ?? Colors.white,
+ ),
)
: null,
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
@@ -273,12 +272,12 @@ class _PDFViewerState extends State {
_animateToPage,
)
: BottomAppBar(
- child: new Row(
+ child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Expanded(
child: IconButton(
- icon: Icon(Icons.first_page),
+ icon: const Icon(Icons.first_page),
tooltip: widget.tooltip.first,
onPressed: _pageNumber == 1 || _isLoading
? null
@@ -290,7 +289,7 @@ class _PDFViewerState extends State {
),
Expanded(
child: IconButton(
- icon: Icon(Icons.chevron_left),
+ icon: const Icon(Icons.chevron_left),
tooltip: widget.tooltip.previous,
onPressed: _pageNumber == 1 || _isLoading
? null
@@ -303,12 +302,10 @@ class _PDFViewerState extends State {
},
),
),
- widget.showPicker
- ? Expanded(child: Text(''))
- : SizedBox(width: 1),
+ if (widget.showPicker) const Spacer(),
Expanded(
child: IconButton(
- icon: Icon(Icons.chevron_right),
+ icon: const Icon(Icons.chevron_right),
tooltip: widget.tooltip.next,
onPressed:
_pageNumber == widget.document.count || _isLoading
@@ -324,7 +321,7 @@ class _PDFViewerState extends State {
),
Expanded(
child: IconButton(
- icon: Icon(Icons.last_page),
+ icon: const Icon(Icons.last_page),
tooltip: widget.tooltip.last,
onPressed:
_pageNumber == widget.document.count || _isLoading
diff --git a/lib/src/zoomable_widget.dart b/lib/src/zoomable_widget.dart
index eb14c6b..ad21205 100644
--- a/lib/src/zoomable_widget.dart
+++ b/lib/src/zoomable_widget.dart
@@ -4,43 +4,29 @@ import 'dart:math';
import 'package:flutter/widgets.dart';
class ZoomableWidget extends StatefulWidget {
- ZoomableWidget({
+ const ZoomableWidget({
Key? key,
- this.minScale: 0.7,
- this.maxScale: 1.4,
- this.initialScale: 1.0,
- this.initialOffset: Offset.zero,
- this.initialRotation: 0.0,
- this.enableZoom: true,
- this.panLimit: 1.0,
- this.singleFingerPan: true,
- this.multiFingersPan: true,
- this.enableRotate: false,
+ this.minScale = 0.7,
+ this.maxScale = 1.4,
+ this.initialScale = 1.0,
+ this.initialOffset = Offset.zero,
+ this.initialRotation = 0.0,
+ this.enableZoom = true,
+ this.panLimit = 1.0,
+ this.singleFingerPan = true,
+ this.multiFingersPan = true,
+ this.enableRotate = false,
this.child,
this.onTap,
- this.zoomSteps: 0,
- this.autoCenter: false,
- this.bounceBackBoundary: true,
- this.enableFling: true,
- this.flingFactor: 1.0,
+ this.zoomSteps = 0,
+ this.autoCenter = false,
+ this.bounceBackBoundary = true,
+ this.enableFling = true,
+ this.flingFactor = 1.0,
this.onZoomChanged,
- this.resetDuration: const Duration(milliseconds: 250),
- this.resetCurve: Curves.easeInOut,
- }) : assert(minScale != null),
- assert(maxScale != null),
- assert(initialScale != null),
- assert(initialOffset != null),
- assert(initialRotation != null),
- assert(enableZoom != null),
- assert(panLimit != null),
- assert(singleFingerPan != null),
- assert(multiFingersPan != null),
- assert(enableRotate != null),
- assert(zoomSteps != null),
- assert(autoCenter != null),
- assert(bounceBackBoundary != null),
- assert(enableFling != null),
- assert(flingFactor != null);
+ this.resetDuration = const Duration(milliseconds: 250),
+ this.resetCurve = Curves.easeInOut,
+ }) : super(key: key);
/// The minimum size for scaling.
final double minScale;
@@ -133,7 +119,7 @@ class _ZoomableWidgetState extends State {
void _onScaleStart(ScaleStartDetails details) {
if (_childSize == Size.zero) {
- final RenderBox renderbox = _key.currentContext!.findRenderObject() as RenderBox;
+ final renderbox = _key.currentContext!.findRenderObject()! as RenderBox;
_childSize = renderbox.size;
}
setState(() {
@@ -145,44 +131,35 @@ class _ZoomableWidgetState extends State {
}
void _onScaleUpdate(ScaleUpdateDetails details) {
- Size boundarySize = _boundarySize;
+ final boundarySize = _boundarySize;
- Size _marginSize = const Size(100.0, 100.0);
+ const _marginSize = Size(100.0, 100.0);
_duration = const Duration(milliseconds: 50);
_curve = Curves.easeOut;
setState(() {
- if (widget.enableRotate)
- _rotation = (_previousRotation + details.rotation).clamp(-pi, pi);
+ if (widget.enableRotate) _rotation = (_previousRotation + details.rotation).clamp(-pi, pi);
if (widget.enableZoom && details.scale != 1.0) {
- _zoom = (_previousZoom * details.scale)
- .clamp(widget.minScale, widget.maxScale);
+ _zoom = (_previousZoom * details.scale).clamp(widget.minScale, widget.maxScale);
if (widget.onZoomChanged != null) widget.onZoomChanged!(_zoom);
}
});
- if ((widget.singleFingerPan && details.scale == 1.0) ||
- (widget.multiFingersPan && details.scale != 1.0)) {
- Offset _panRealOffset = (details.focalPoint -
- _zoomOriginOffset +
- _previousPanOffset * _previousZoom) /
- _zoom;
+ if ((widget.singleFingerPan && details.scale == 1.0) || (widget.multiFingersPan && details.scale != 1.0)) {
+ final _panRealOffset = (details.focalPoint - _zoomOriginOffset + _previousPanOffset * _previousZoom) / _zoom;
if (widget.panLimit == 0.0) {
_pan = _panRealOffset;
} else {
- Offset _baseOffset = Offset(
- _panRealOffset.dx
- .clamp(-boundarySize.width / 2, boundarySize.width / 2),
- _panRealOffset.dy
- .clamp(-boundarySize.height / 2, boundarySize.height / 2),
+ final _baseOffset = Offset(
+ _panRealOffset.dx.clamp(-boundarySize.width / 2, boundarySize.width / 2),
+ _panRealOffset.dy.clamp(-boundarySize.height / 2, boundarySize.height / 2),
);
Offset _marginOffset = _panRealOffset - _baseOffset;
- double _widthFactor = sqrt(_marginOffset.dx.abs()) / _marginSize.width;
- double _heightFactor =
- sqrt(_marginOffset.dy.abs()) / _marginSize.height;
+ final _widthFactor = sqrt(_marginOffset.dx.abs()) / _marginSize.width;
+ final _heightFactor = sqrt(_marginOffset.dy.abs()) / _marginSize.height;
_marginOffset = Offset(
_marginOffset.dx * _widthFactor * 2,
_marginOffset.dy * _heightFactor * 2,
@@ -194,7 +171,7 @@ class _ZoomableWidgetState extends State {
}
void _onScaleEnd(ScaleEndDetails details) {
- Size boundarySize = _boundarySize;
+ final boundarySize = _boundarySize;
_duration = widget.resetDuration;
_curve = widget.resetCurve;
@@ -204,8 +181,7 @@ class _ZoomableWidgetState extends State {
if (magnitude > 800.0 * _zoom && widget.enableFling) {
final Offset direction = velocity / magnitude;
final double distance = (Offset.zero & context.size!).shortestSide;
- final Offset endOffset =
- _pan + direction * distance * widget.flingFactor * 0.5;
+ final Offset endOffset = _pan + direction * distance * widget.flingFactor * 0.5;
_pan = Offset(
endOffset.dx.clamp(-boundarySize.width / 2, boundarySize.width / 2),
endOffset.dy.clamp(-boundarySize.height / 2, boundarySize.height / 2),
@@ -222,14 +198,13 @@ class _ZoomableWidgetState extends State {
}
Size get _boundarySize {
- Size _boundarySize = Size(
+ final _boundarySize = Size(
(_containerSize.width == _childSize.width)
? (_containerSize.width - _childSize.width / _zoom).abs()
: (_containerSize.width - _childSize.width * _zoom).abs() / _zoom,
(_containerSize.height == _childSize.height)
? (_containerSize.height - _childSize.height / _zoom).abs()
- : (_containerSize.height - _childSize.height * _zoom).abs() /
- _zoom,
+ : (_containerSize.height - _childSize.height * _zoom).abs() / _zoom,
) *
widget.panLimit;
@@ -242,8 +217,7 @@ class _ZoomableWidgetState extends State {
_duration = widget.resetDuration;
_curve = widget.resetCurve;
- if (widget.zoomSteps > 0)
- _stepLength = (widget.maxScale - 1.0) / widget.zoomSteps;
+ if (widget.zoomSteps > 0) _stepLength = (widget.maxScale - 1.0) / widget.zoomSteps;
double _tmpZoom = _zoom + _stepLength;
if (_tmpZoom > widget.maxScale || _stepLength == 0.0) _tmpZoom = 1.0;
@@ -263,7 +237,7 @@ class _ZoomableWidgetState extends State {
@override
Widget build(BuildContext context) {
- if (widget.child == null) return SizedBox();
+ if (widget.child == null) return const SizedBox();
return CustomMultiChildLayout(
delegate: _ZoomableWidgetLayout(),
@@ -278,8 +252,7 @@ class _ZoomableWidgetState extends State {
rotation: _rotation,
child: LayoutBuilder(
builder: (BuildContext context, BoxConstraints constraints) {
- _containerSize =
- Size(constraints.maxWidth, constraints.maxHeight);
+ _containerSize = Size(constraints.maxWidth, constraints.maxHeight);
return Center(
child: Container(key: _key, child: widget.child),
);
@@ -290,12 +263,12 @@ class _ZoomableWidgetState extends State {
LayoutId(
id: _ZoomableWidgetLayout.gestureContainer,
child: GestureDetector(
- child: Container(color: Color(0)),
onScaleStart: _onScaleStart,
onScaleUpdate: _onScaleUpdate,
onScaleEnd: widget.bounceBackBoundary ? _onScaleEnd : null,
onDoubleTap: _handleDoubleTap,
onTap: widget.onTap,
+ child: Container(color: const Color(0x00000000)),
),
),
],
@@ -306,16 +279,14 @@ class _ZoomableWidgetState extends State {
class _ZoomableWidgetLayout extends MultiChildLayoutDelegate {
_ZoomableWidgetLayout();
- static final String gestureContainer = 'gesturecontainer';
- static final String painter = 'painter';
+ static const String gestureContainer = 'gesturecontainer';
+ static const String painter = 'painter';
@override
void performLayout(Size size) {
- layoutChild(gestureContainer,
- BoxConstraints.tightFor(width: size.width, height: size.height));
+ layoutChild(gestureContainer, BoxConstraints.tightFor(width: size.width, height: size.height));
positionChild(gestureContainer, Offset.zero);
- layoutChild(painter,
- BoxConstraints.tightFor(width: size.width, height: size.height));
+ layoutChild(painter, BoxConstraints.tightFor(width: size.width, height: size.height));
positionChild(painter, Offset.zero);
}
@@ -339,8 +310,7 @@ class _ZoomableChild extends ImplicitlyAnimatedWidget {
final Widget child;
@override
- ImplicitlyAnimatedWidgetState createState() =>
- _ZoomableChildState();
+ ImplicitlyAnimatedWidgetState createState() => _ZoomableChildState();
}
class _ZoomableChildState extends AnimatedWidgetBaseState<_ZoomableChild> {
@@ -350,24 +320,19 @@ class _ZoomableChildState extends AnimatedWidgetBaseState<_ZoomableChild> {
DoubleTween? _rotation;
@override
- void forEachTween(visitor) {
- _zoom = visitor(
- _zoom, widget.zoom, (dynamic value) => DoubleTween(begin: value)) as DoubleTween?;
- _panOffset = visitor(_panOffset, widget.panOffset,
- (dynamic value) => OffsetTween(begin: value)) as OffsetTween?;
- _rotation = visitor(_rotation, widget.rotation,
- (dynamic value) => DoubleTween(begin: value)) as DoubleTween?;
+ void forEachTween(TweenVisitor visitor) {
+ _zoom = visitor(_zoom, widget.zoom, (dynamic value) => DoubleTween(begin: value as double?)) as DoubleTween?;
+ _panOffset = visitor(_panOffset, widget.panOffset, (dynamic value) => OffsetTween(begin: value as Offset?)) as OffsetTween?;
+ _rotation = visitor(_rotation, widget.rotation, (dynamic value) => DoubleTween(begin: value as double?)) as DoubleTween?;
}
@override
Widget build(BuildContext context) {
return Transform(
alignment: Alignment.center,
- origin: Offset(-(_panOffset!.evaluate(animation)?.dx ?? 0),
- -(_panOffset!.evaluate(animation)?.dy ?? 0)),
+ origin: Offset(-(_panOffset!.evaluate(animation)?.dx ?? 0), -(_panOffset!.evaluate(animation)?.dy ?? 0)),
transform: Matrix4.identity()
- ..translate(_panOffset?.evaluate(animation)?.dx,
- _panOffset?.evaluate(animation)?.dy ?? 0)
+ ..translate(_panOffset?.evaluate(animation)?.dx, _panOffset?.evaluate(animation)?.dy ?? 0)
..scale(_zoom!.evaluate(animation), _zoom!.evaluate(animation)),
child: Transform.rotate(
angle: _rotation!.evaluate(animation) ?? 0,
@@ -381,12 +346,12 @@ class DoubleTween extends Tween {
DoubleTween({double? begin, double? end}) : super(begin: begin, end: end);
@override
- double lerp(double t) => (begin! + (end! - begin!) * t);
+ double lerp(double t) => begin! + (end! - begin!) * t;
}
class OffsetTween extends Tween {
OffsetTween({Offset? begin, Offset? end}) : super(begin: begin, end: end);
@override
- Offset lerp(double t) => (begin! + (end! - begin!) * t);
+ Offset lerp(double t) => begin! + (end! - begin!) * t;
}
diff --git a/pubspec.lock b/pubspec.lock
index 742a2bb..163ac25 100644
--- a/pubspec.lock
+++ b/pubspec.lock
@@ -1,13 +1,6 @@
# Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile
packages:
- archive:
- dependency: transitive
- description:
- name: archive
- url: "https://pub.dartlang.org"
- source: hosted
- version: "3.1.2"
async:
dependency: transitive
description:
@@ -21,7 +14,7 @@ packages:
name: characters
url: "https://pub.dartlang.org"
source: hosted
- version: "1.1.0"
+ version: "1.2.0"
charcode:
dependency: transitive
description:
@@ -56,7 +49,7 @@ packages:
name: ffi
url: "https://pub.dartlang.org"
source: hosted
- version: "1.0.0"
+ version: "1.1.0"
file:
dependency: transitive
description:
@@ -75,7 +68,7 @@ packages:
name: flutter_cache_manager
url: "https://pub.dartlang.org"
source: hosted
- version: "3.0.2"
+ version: "3.3.0"
http:
dependency: transitive
description:
@@ -90,13 +83,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "4.0.0"
- image:
- dependency: transitive
- description:
- name: image
- url: "https://pub.dartlang.org"
- source: hosted
- version: "3.0.2"
infinite_listview:
dependency: transitive
description:
@@ -104,13 +90,20 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
+ lint:
+ dependency: "direct dev"
+ description:
+ name: lint
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "1.5.3"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
- version: "1.3.0"
+ version: "1.7.0"
numberpicker:
dependency: "direct main"
description:
@@ -131,14 +124,28 @@ packages:
name: path_provider
url: "https://pub.dartlang.org"
source: hosted
- version: "2.0.1"
+ version: "2.0.8"
+ path_provider_android:
+ dependency: transitive
+ description:
+ name: path_provider_android
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "2.0.11"
+ path_provider_ios:
+ dependency: transitive
+ description:
+ name: path_provider_ios
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "2.0.7"
path_provider_linux:
dependency: transitive
description:
name: path_provider_linux
url: "https://pub.dartlang.org"
source: hosted
- version: "2.0.0"
+ version: "2.1.2"
path_provider_macos:
dependency: transitive
description:
@@ -159,7 +166,7 @@ packages:
name: path_provider_windows
url: "https://pub.dartlang.org"
source: hosted
- version: "2.0.1"
+ version: "2.0.4"
pedantic:
dependency: transitive
description:
@@ -167,13 +174,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.11.0"
- petitparser:
- dependency: transitive
- description:
- name: petitparser
- url: "https://pub.dartlang.org"
- source: hosted
- version: "4.1.0"
platform:
dependency: transitive
description:
@@ -269,7 +269,7 @@ packages:
name: vector_math
url: "https://pub.dartlang.org"
source: hosted
- version: "2.1.0"
+ version: "2.1.1"
win32:
dependency: transitive
description:
@@ -284,13 +284,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.0"
- xml:
- dependency: transitive
- description:
- name: xml
- url: "https://pub.dartlang.org"
- source: hosted
- version: "5.1.1"
sdks:
- dart: ">=2.13.0 <3.0.0"
- flutter: ">=1.24.0-10"
+ dart: ">=2.14.0 <3.0.0"
+ flutter: ">=2.5.0"
diff --git a/pubspec.yaml b/pubspec.yaml
index b639174..f371b77 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,18 +1,21 @@
name: advance_pdf_viewer
description: A flutter plugin for handling PDF files. Works on both Android & iOS
-version: 2.0.0
+version: 2.0.1
homepage: https://github.com/lohanidamodar/pdf_viewer
environment:
- sdk: '>=2.12.0 <3.0.0'
+ sdk: ">=2.12.0 <3.0.0"
flutter: ">=1.17.0 <2.0.0"
dependencies:
flutter:
sdk: flutter
- flutter_cache_manager: ^3.0.2
+ flutter_cache_manager: ^3.3.0
numberpicker: ^2.1.1
- path_provider: ^2.0.1
+ path_provider: ^2.0.8
+
+dev_dependencies:
+ lint: ^1.5.3
flutter:
plugin: