diff --git a/CHANGELOG.md b/CHANGELOG.md
index 26ba3fb..9082821 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,10 @@
# Change log
+## 1.0.2
+
+- Little optimization
+- added FilesAccessPermission
+
## 1.0.1
- Reads dir from controller to let developer specify initial path before displaying
diff --git a/README.md b/README.md
index 7924603..2d0048c 100644
--- a/README.md
+++ b/README.md
@@ -12,9 +12,7 @@ Designed to feel like part of the Flutter framework.
✅ Android
✅ Linux
❌ Windows ([in progress](https://github.com/4-alok/file_manager/tree/windows-support))
-❌ Web
❌ MacOS (active issue: [MacOS support](https://github.com/DevsOnFlutter/file_manager/issues/8))
-❌ iOS (active issue: [iOS support](https://github.com/DevsOnFlutter/file_manager/issues/7))
## Usage
@@ -31,13 +29,17 @@ dependencies:
### Give storage permission to application
-**Android:** Beside needing to add **WRITE_EXTERNAL_STORAGE** and **READ_EXTERNAL_STORAGE** to your android/app/src/main/AndroidManifest.xml.
+## Android
+
+ Beside needing to add **WRITE_EXTERNAL_STORAGE** , **READ_EXTERNAL_STORAGE** and **MANAGE_EXTERNAL_STORAGE** to your android/app/src/main/AndroidManifest.xml.
```xml
+
+
...
```
@@ -47,12 +49,23 @@ also add for Android 10
```xml
```
**You also need Runtime Request Permission**
allow storage permission from app setting manually or you may use any package such as [`permission_handler`](https://pub.dev/packages/permission_handler).
+or use `FileManager` to request permission at runtime.
+
+```dart
+ // request permission
+ await controller.requestFilesAccessPermission();
+
+ or
+
+ await FileManager.requestFilesAccessPermission();
+```
+
### Basic setup
diff --git a/example/.metadata b/example/.metadata
index 3733535..e56506f 100644
--- a/example/.metadata
+++ b/example/.metadata
@@ -1,10 +1,42 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
-# This file should be version controlled and should not be manually edited.
+# This file should be version controlled.
version:
- revision: 02c026b03cd31dd3f867e5faeb7e104cce174c5f
- channel: stable
+ revision: f076b7bac36b97c5a3169529290835c91f445dca
+ channel: master
project_type: app
+
+# Tracks metadata for the flutter migrate command
+migration:
+ platforms:
+ - platform: root
+ create_revision: f076b7bac36b97c5a3169529290835c91f445dca
+ base_revision: f076b7bac36b97c5a3169529290835c91f445dca
+ - platform: android
+ create_revision: f076b7bac36b97c5a3169529290835c91f445dca
+ base_revision: f076b7bac36b97c5a3169529290835c91f445dca
+ - platform: linux
+ create_revision: f076b7bac36b97c5a3169529290835c91f445dca
+ base_revision: f076b7bac36b97c5a3169529290835c91f445dca
+ - platform: macos
+ create_revision: f076b7bac36b97c5a3169529290835c91f445dca
+ base_revision: f076b7bac36b97c5a3169529290835c91f445dca
+ - platform: web
+ create_revision: f076b7bac36b97c5a3169529290835c91f445dca
+ base_revision: f076b7bac36b97c5a3169529290835c91f445dca
+ - platform: windows
+ create_revision: f076b7bac36b97c5a3169529290835c91f445dca
+ base_revision: f076b7bac36b97c5a3169529290835c91f445dca
+
+ # User provided section
+
+ # List of Local paths (relative to this file) that should be
+ # ignored by the migrate tool.
+ #
+ # Files that are not part of the templates will be ignored by default.
+ unmanaged_files:
+ - 'lib/main.dart'
+ - 'ios/Runner.xcodeproj/project.pbxproj'
diff --git a/example/analysis_options.yaml b/example/analysis_options.yaml
new file mode 100644
index 0000000..61b6c4d
--- /dev/null
+++ b/example/analysis_options.yaml
@@ -0,0 +1,29 @@
+# This file configures the analyzer, which statically analyzes Dart code to
+# check for errors, warnings, and lints.
+#
+# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
+# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
+# invoked from the command line by running `flutter analyze`.
+
+# The following line activates a set of recommended lints for Flutter apps,
+# packages, and plugins designed to encourage good coding practices.
+include: package:flutter_lints/flutter.yaml
+
+linter:
+ # The lint rules applied to this project can be customized in the
+ # section below to disable rules from the `package:flutter_lints/flutter.yaml`
+ # included above or to enable additional rules. A list of all available lints
+ # and their documentation is published at
+ # https://dart-lang.github.io/linter/lints/index.html.
+ #
+ # Instead of disabling a lint rule for the entire project in the
+ # section below, it can also be suppressed for a single line of code
+ # or a specific dart file by using the `// ignore: name_of_lint` and
+ # `// ignore_for_file: name_of_lint` syntax on the line or in the file
+ # producing the lint.
+ rules:
+ # avoid_print: false # Uncomment to disable the `avoid_print` rule
+ # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
+
+# Additional information about this file can be found at
+# https://dart.dev/guides/language/analysis-options
diff --git a/example/android/.gitignore b/example/android/.gitignore
index 0a741cb..6f56801 100644
--- a/example/android/.gitignore
+++ b/example/android/.gitignore
@@ -9,3 +9,5 @@ GeneratedPluginRegistrant.java
# Remember to never publicly share your keystore.
# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
key.properties
+**/*.keystore
+**/*.jks
diff --git a/example/android/.project b/example/android/.project
deleted file mode 100644
index 3964dd3..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 ef3d374..0000000
--- a/example/android/.settings/org.eclipse.buildship.core.prefs
+++ /dev/null
@@ -1,13 +0,0 @@
-arguments=
-auto.sync=false
-build.scans.enabled=false
-connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER)
-connection.project.dir=
-eclipse.preferences.version=1
-gradle.user.home=
-java.home=C\:/Program Files/Java/jdk-14.0.1
-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 993fef6..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 6ca2344..4c908eb 100644
--- a/example/android/app/build.gradle
+++ b/example/android/app/build.gradle
@@ -26,7 +26,18 @@ apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
- compileSdkVersion 30
+ namespace "com.example.example"
+ compileSdkVersion flutter.compileSdkVersion
+ ndkVersion flutter.ndkVersion
+
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
+ }
+
+ kotlinOptions {
+ jvmTarget = '1.8'
+ }
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
@@ -35,8 +46,10 @@ android {
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.example"
- minSdkVersion 16
- targetSdkVersion 30
+ // You can update the following values to match your application needs.
+ // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
+ minSdkVersion flutter.minSdkVersion
+ targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
diff --git a/example/android/app/src/debug/AndroidManifest.xml b/example/android/app/src/debug/AndroidManifest.xml
index c208884..399f698 100644
--- a/example/android/app/src/debug/AndroidManifest.xml
+++ b/example/android/app/src/debug/AndroidManifest.xml
@@ -1,6 +1,6 @@
-
-
diff --git a/example/android/app/src/main/AndroidManifest.xml b/example/android/app/src/main/AndroidManifest.xml
index e38e269..49930de 100644
--- a/example/android/app/src/main/AndroidManifest.xml
+++ b/example/android/app/src/main/AndroidManifest.xml
@@ -3,12 +3,16 @@
+
+
-
-
diff --git a/example/android/app/src/main/kotlin/com/example/example/MainActivity.kt b/example/android/app/src/main/kotlin/com/example/example/MainActivity.kt
index e793a00..e66e6cd 100644
--- a/example/android/app/src/main/kotlin/com/example/example/MainActivity.kt
+++ b/example/android/app/src/main/kotlin/com/example/example/MainActivity.kt
@@ -1,6 +1,30 @@
package com.example.example
import io.flutter.embedding.android.FlutterActivity
+import io.flutter.embedding.engine.FlutterEngine
+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 android.provider.Settings
+import android.content.Intent
+import android.net.Uri
class MainActivity: FlutterActivity() {
+ private val MANAGE_STORAGE_RC = 1001
+
+ override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
+ super.configureFlutterEngine(flutterEngine)
+ MethodChannel(flutterEngine.dartExecutor.binaryMessenger, "myapp/channel").setMethodCallHandler { call: MethodCall, result: Result ->
+ if (call.method == "requestFilesAccessPermission") {
+ val intent = Intent(Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION)
+ intent.addCategory(Intent.CATEGORY_DEFAULT)
+ intent.data = Uri.parse("package:$packageName")
+ startActivityForResult(intent, MANAGE_STORAGE_RC)
+ result.success(true)
+ } else {
+ result.notImplemented()
+ }
+ }
+ }
}
diff --git a/example/android/app/src/main/res/values-night/styles.xml b/example/android/app/src/main/res/values-night/styles.xml
index 449a9f9..06952be 100644
--- a/example/android/app/src/main/res/values-night/styles.xml
+++ b/example/android/app/src/main/res/values-night/styles.xml
@@ -3,14 +3,14 @@