diff --git a/android/.idea/.name b/android/.idea/.name deleted file mode 100644 index e83efa8..0000000 --- a/android/.idea/.name +++ /dev/null @@ -1 +0,0 @@ -file_picker \ No newline at end of file diff --git a/android/.idea/modules.xml b/android/.idea/modules.xml deleted file mode 100644 index c734d99..0000000 --- a/android/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/android/.idea/runConfigurations.xml b/android/.idea/runConfigurations.xml deleted file mode 100644 index 7f68460..0000000 --- a/android/.idea/runConfigurations.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/android/gradle/wrapper/gradle-wrapper.jar b/android/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 7a3265e..0000000 Binary files a/android/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/android/gradlew b/android/gradlew deleted file mode 100644 index cccdd3d..0000000 --- a/android/gradlew +++ /dev/null @@ -1,172 +0,0 @@ -#!/usr/bin/env sh - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn () { - echo "$*" -} - -die () { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=$(save "$@") - -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" - -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" -fi - -exec "$JAVACMD" "$@" diff --git a/android/gradlew.bat b/android/gradlew.bat deleted file mode 100644 index e95643d..0000000 --- a/android/gradlew.bat +++ /dev/null @@ -1,84 +0,0 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/example/android/gradle/wrapper/gradle-wrapper.jar b/example/android/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 13372ae..0000000 Binary files a/example/android/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/example/android/gradlew b/example/android/gradlew deleted file mode 100755 index 9d82f78..0000000 --- a/example/android/gradlew +++ /dev/null @@ -1,160 +0,0 @@ -#!/usr/bin/env bash - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn ( ) { - echo "$*" -} - -die ( ) { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; -esac - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules -function splitJvmOpts() { - JVM_OPTS=("$@") -} -eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS -JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" - -exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/example/android/gradlew.bat b/example/android/gradlew.bat deleted file mode 100644 index aec9973..0000000 --- a/example/android/gradlew.bat +++ /dev/null @@ -1,90 +0,0 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windowz variants - -if not "%OS%" == "Windows_NT" goto win9xME_args -if "%@eval[2+2]" == "4" goto 4NT_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* -goto execute - -:4NT_args -@rem Get arguments from the 4NT Shell from JP Software -set CMD_LINE_ARGS=%$ - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/example/file_picker_example.iml b/example/file_picker_example.iml deleted file mode 100644 index e5c8371..0000000 --- a/example/file_picker_example.iml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/example/file_picker_example_android.iml b/example/file_picker_example_android.iml deleted file mode 100644 index b050030..0000000 --- a/example/file_picker_example_android.iml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/example/ios/Podfile b/example/ios/Podfile deleted file mode 100644 index 7c81246..0000000 --- a/example/ios/Podfile +++ /dev/null @@ -1,87 +0,0 @@ -# Uncomment this line to define a global platform for your project -# platform :ios, '9.0' - -# CocoaPods analytics sends network stats synchronously affecting flutter build latency. -ENV['COCOAPODS_DISABLE_STATS'] = 'true' - -project 'Runner', { - 'Debug' => :debug, - 'Profile' => :release, - 'Release' => :release, -} - -def parse_KV_file(file, separator='=') - file_abs_path = File.expand_path(file) - if !File.exists? file_abs_path - return []; - end - generated_key_values = {} - skip_line_start_symbols = ["#", "/"] - File.foreach(file_abs_path) do |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) - generated_key_values[podname] = podpath - else - puts "Invalid plugin specification: #{line}" - end - end - generated_key_values -end - -target 'Runner' do - # Flutter Pod - use_frameworks! - copied_flutter_dir = File.join(__dir__, 'Flutter') - copied_framework_path = File.join(copied_flutter_dir, 'Flutter.framework') - copied_podspec_path = File.join(copied_flutter_dir, 'Flutter.podspec') - unless File.exist?(copied_framework_path) && File.exist?(copied_podspec_path) - # Copy Flutter.framework and Flutter.podspec to Flutter/ to have something to link against if the xcode backend script has not run yet. - # That script will copy the correct debug/profile/release version of the framework based on the currently selected Xcode configuration. - # CocoaPods will not embed the framework on pod install (before any build phases can generate) if the dylib does not exist. - - generated_xcode_build_settings_path = File.join(copied_flutter_dir, 'Generated.xcconfig') - unless File.exist?(generated_xcode_build_settings_path) - raise "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first" - end - generated_xcode_build_settings = parse_KV_file(generated_xcode_build_settings_path) - cached_framework_dir = generated_xcode_build_settings['FLUTTER_FRAMEWORK_DIR']; - - unless File.exist?(copied_framework_path) - FileUtils.cp_r(File.join(cached_framework_dir, 'Flutter.framework'), copied_flutter_dir) - end - unless File.exist?(copied_podspec_path) - FileUtils.cp(File.join(cached_framework_dir, 'Flutter.podspec'), copied_flutter_dir) - end - end - - # Keep pod path relative so it can be checked into Podfile.lock. - pod 'Flutter', :path => 'Flutter' - - # Plugin Pods - - # 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') - plugin_pods = parse_KV_file('../.flutter-plugins') - plugin_pods.each do |name, path| - symlink = File.join('.symlinks', 'plugins', name) - File.symlink(path, symlink) - pod name, :path => File.join(symlink, 'ios') - end -end - -# Prevent Cocoapods from embedding a second Flutter framework and causing an error with the new Xcode build system. -install! 'cocoapods', :disable_input_output_paths => true - -post_install do |installer| - installer.pods_project.targets.each do |target| - target.build_configurations.each do |config| - config.build_settings['ENABLE_BITCODE'] = 'NO' - end - end -end \ No newline at end of file diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock deleted file mode 100644 index 6ccd59a..0000000 --- a/example/ios/Podfile.lock +++ /dev/null @@ -1,80 +0,0 @@ -PODS: - - DKImagePickerController/Core (4.2.2): - - DKImagePickerController/ImageDataManager - - DKImagePickerController/Resource - - DKImagePickerController/ImageDataManager (4.2.2) - - DKImagePickerController/PhotoGallery (4.2.2): - - DKImagePickerController/Core - - DKPhotoGallery - - DKImagePickerController/Resource (4.2.2) - - DKPhotoGallery (0.0.14): - - DKPhotoGallery/Core (= 0.0.14) - - DKPhotoGallery/Model (= 0.0.14) - - DKPhotoGallery/Preview (= 0.0.14) - - DKPhotoGallery/Resource (= 0.0.14) - - SDWebImage - - SDWebImageFLPlugin - - DKPhotoGallery/Core (0.0.14): - - DKPhotoGallery/Model - - DKPhotoGallery/Preview - - SDWebImage - - SDWebImageFLPlugin - - DKPhotoGallery/Model (0.0.14): - - SDWebImage - - SDWebImageFLPlugin - - DKPhotoGallery/Preview (0.0.14): - - DKPhotoGallery/Model - - DKPhotoGallery/Resource - - SDWebImage - - SDWebImageFLPlugin - - DKPhotoGallery/Resource (0.0.14): - - SDWebImage - - SDWebImageFLPlugin - - file_picker (0.0.1): - - DKImagePickerController/PhotoGallery - - Flutter - - FLAnimatedImage (1.0.12) - - Flutter (1.0.0) - - flutter_plugin_android_lifecycle (0.0.1): - - Flutter - - SDWebImage (5.7.3): - - SDWebImage/Core (= 5.7.3) - - SDWebImage/Core (5.7.3) - - SDWebImageFLPlugin (0.4.0): - - FLAnimatedImage (>= 1.0.11) - - SDWebImage/Core (~> 5.6) - -DEPENDENCIES: - - file_picker (from `.symlinks/plugins/file_picker/ios`) - - Flutter (from `Flutter`) - - flutter_plugin_android_lifecycle (from `.symlinks/plugins/flutter_plugin_android_lifecycle/ios`) - -SPEC REPOS: - trunk: - - DKImagePickerController - - DKPhotoGallery - - FLAnimatedImage - - SDWebImage - - SDWebImageFLPlugin - -EXTERNAL SOURCES: - file_picker: - :path: ".symlinks/plugins/file_picker/ios" - Flutter: - :path: Flutter - flutter_plugin_android_lifecycle: - :path: ".symlinks/plugins/flutter_plugin_android_lifecycle/ios" - -SPEC CHECKSUMS: - DKImagePickerController: 4a3e7948a848c4348e600b3fe5ce41478835fa10 - DKPhotoGallery: 0290d32343574f06eaa4c26f8f2f8a1035e916be - file_picker: 3e6c3790de664ccf9b882732d9db5eaf6b8d4eb1 - FLAnimatedImage: 4a0b56255d9b05f18b6dd7ee06871be5d3b89e31 - Flutter: 0e3d915762c693b495b44d77113d4970485de6ec - flutter_plugin_android_lifecycle: dc0b544e129eebb77a6bfb1239d4d1c673a60a35 - SDWebImage: 97351f6582ceca541ea294ba66a1fcb342a331c2 - SDWebImageFLPlugin: 6c2295fb1242d44467c6c87dc5db6b0a13228fd8 - -PODFILE CHECKSUM: d5067366bad8216f789a99f6384e7bef21d4a19b - -COCOAPODS: 1.9.1 diff --git a/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist deleted file mode 100644 index 18d9810..0000000 --- a/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +++ /dev/null @@ -1,8 +0,0 @@ - - - - - IDEDidComputeMac32BitWarning - - - diff --git a/CHANGELOG.md b/file_picker/CHANGELOG.md similarity index 100% rename from CHANGELOG.md rename to file_picker/CHANGELOG.md diff --git a/LICENSE b/file_picker/LICENSE similarity index 100% rename from LICENSE rename to file_picker/LICENSE diff --git a/README.md b/file_picker/README.md similarity index 100% rename from README.md rename to file_picker/README.md diff --git a/android/.classpath b/file_picker/android/.classpath similarity index 100% rename from android/.classpath rename to file_picker/android/.classpath diff --git a/android/.gitignore b/file_picker/android/.gitignore similarity index 100% rename from android/.gitignore rename to file_picker/android/.gitignore diff --git a/android/.project b/file_picker/android/.project similarity index 100% rename from android/.project rename to file_picker/android/.project diff --git a/android/.settings/org.eclipse.buildship.core.prefs b/file_picker/android/.settings/org.eclipse.buildship.core.prefs similarity index 100% rename from android/.settings/org.eclipse.buildship.core.prefs rename to file_picker/android/.settings/org.eclipse.buildship.core.prefs diff --git a/android/build.gradle b/file_picker/android/build.gradle similarity index 100% rename from android/build.gradle rename to file_picker/android/build.gradle diff --git a/android/gradle.properties b/file_picker/android/gradle.properties similarity index 100% rename from android/gradle.properties rename to file_picker/android/gradle.properties diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/file_picker/android/gradle/wrapper/gradle-wrapper.properties similarity index 100% rename from android/gradle/wrapper/gradle-wrapper.properties rename to file_picker/android/gradle/wrapper/gradle-wrapper.properties diff --git a/android/settings.gradle b/file_picker/android/settings.gradle similarity index 100% rename from android/settings.gradle rename to file_picker/android/settings.gradle diff --git a/android/src/main/AndroidManifest.xml b/file_picker/android/src/main/AndroidManifest.xml similarity index 100% rename from android/src/main/AndroidManifest.xml rename to file_picker/android/src/main/AndroidManifest.xml diff --git a/android/src/main/java/com/mr/flutter/plugin/filepicker/FilePickerDelegate.java b/file_picker/android/src/main/java/com/mr/flutter/plugin/filepicker/FilePickerDelegate.java similarity index 100% rename from android/src/main/java/com/mr/flutter/plugin/filepicker/FilePickerDelegate.java rename to file_picker/android/src/main/java/com/mr/flutter/plugin/filepicker/FilePickerDelegate.java diff --git a/android/src/main/java/com/mr/flutter/plugin/filepicker/FilePickerPlugin.java b/file_picker/android/src/main/java/com/mr/flutter/plugin/filepicker/FilePickerPlugin.java similarity index 100% rename from android/src/main/java/com/mr/flutter/plugin/filepicker/FilePickerPlugin.java rename to file_picker/android/src/main/java/com/mr/flutter/plugin/filepicker/FilePickerPlugin.java diff --git a/android/src/main/java/com/mr/flutter/plugin/filepicker/FileUtils.java b/file_picker/android/src/main/java/com/mr/flutter/plugin/filepicker/FileUtils.java similarity index 100% rename from android/src/main/java/com/mr/flutter/plugin/filepicker/FileUtils.java rename to file_picker/android/src/main/java/com/mr/flutter/plugin/filepicker/FileUtils.java diff --git a/file_picker/example/.flutter-plugins-dependencies b/file_picker/example/.flutter-plugins-dependencies new file mode 100644 index 0000000..9e05f92 --- /dev/null +++ b/file_picker/example/.flutter-plugins-dependencies @@ -0,0 +1 @@ +{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"file_picker","path":"/Users/miguelruivo/Personal/plugins/flutter_file_picker/file_picker/","dependencies":[]}],"android":[{"name":"file_picker","path":"/Users/miguelruivo/Personal/plugins/flutter_file_picker/file_picker/","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"flutter_plugin_android_lifecycle","path":"/Users/miguelruivo/devtools/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_plugin_android_lifecycle-1.0.6/","dependencies":[]}],"macos":[],"linux":[],"windows":[],"web":[{"name":"file_picker_web","path":"/Users/miguelruivo/devtools/flutter/.pub-cache/hosted/pub.dartlang.org/file_picker_web-1.0.0/","dependencies":[]}]},"dependencyGraph":[{"name":"file_picker","dependencies":["flutter_plugin_android_lifecycle","file_picker_web"]},{"name":"file_picker_web","dependencies":[]},{"name":"flutter_plugin_android_lifecycle","dependencies":[]}],"date_created":"2020-06-11 19:26:41.155074","version":"1.17.3"} \ No newline at end of file diff --git a/example/.gitignore b/file_picker/example/.gitignore similarity index 100% rename from example/.gitignore rename to file_picker/example/.gitignore diff --git a/example/.metadata b/file_picker/example/.metadata similarity index 100% rename from example/.metadata rename to file_picker/example/.metadata diff --git a/example/android/.gitignore b/file_picker/example/android/.gitignore similarity index 100% rename from example/android/.gitignore rename to file_picker/example/android/.gitignore diff --git a/example/android/.project b/file_picker/example/android/.project similarity index 100% rename from example/android/.project rename to file_picker/example/android/.project diff --git a/example/android/.settings/org.eclipse.buildship.core.prefs b/file_picker/example/android/.settings/org.eclipse.buildship.core.prefs similarity index 100% rename from example/android/.settings/org.eclipse.buildship.core.prefs rename to file_picker/example/android/.settings/org.eclipse.buildship.core.prefs diff --git a/example/android/app/.classpath b/file_picker/example/android/app/.classpath similarity index 100% rename from example/android/app/.classpath rename to file_picker/example/android/app/.classpath diff --git a/example/android/app/.project b/file_picker/example/android/app/.project similarity index 100% rename from example/android/app/.project rename to file_picker/example/android/app/.project diff --git a/example/android/app/.settings/org.eclipse.buildship.core.prefs b/file_picker/example/android/app/.settings/org.eclipse.buildship.core.prefs similarity index 100% rename from example/android/app/.settings/org.eclipse.buildship.core.prefs rename to file_picker/example/android/app/.settings/org.eclipse.buildship.core.prefs diff --git a/example/android/app/build.gradle b/file_picker/example/android/app/build.gradle similarity index 100% rename from example/android/app/build.gradle rename to file_picker/example/android/app/build.gradle diff --git a/example/android/app/src/main/AndroidManifest.xml b/file_picker/example/android/app/src/main/AndroidManifest.xml similarity index 100% rename from example/android/app/src/main/AndroidManifest.xml rename to file_picker/example/android/app/src/main/AndroidManifest.xml diff --git a/example/android/app/src/main/java/com/mr/flutter/plugin/filepickerexample/MainActivity.java b/file_picker/example/android/app/src/main/java/com/mr/flutter/plugin/filepickerexample/MainActivity.java similarity index 100% rename from example/android/app/src/main/java/com/mr/flutter/plugin/filepickerexample/MainActivity.java rename to file_picker/example/android/app/src/main/java/com/mr/flutter/plugin/filepickerexample/MainActivity.java diff --git a/example/android/app/src/main/res/drawable/launch_background.xml b/file_picker/example/android/app/src/main/res/drawable/launch_background.xml similarity index 100% rename from example/android/app/src/main/res/drawable/launch_background.xml rename to file_picker/example/android/app/src/main/res/drawable/launch_background.xml diff --git a/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/file_picker/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png similarity index 100% rename from example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png rename to file_picker/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png diff --git a/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/file_picker/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png similarity index 100% rename from example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png rename to file_picker/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png diff --git a/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/file_picker/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png similarity index 100% rename from example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png rename to file_picker/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png diff --git a/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/file_picker/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png similarity index 100% rename from example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png rename to file_picker/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png diff --git a/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/file_picker/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png similarity index 100% rename from example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png rename to file_picker/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png diff --git a/example/android/app/src/main/res/values/styles.xml b/file_picker/example/android/app/src/main/res/values/styles.xml similarity index 100% rename from example/android/app/src/main/res/values/styles.xml rename to file_picker/example/android/app/src/main/res/values/styles.xml diff --git a/example/android/build.gradle b/file_picker/example/android/build.gradle similarity index 100% rename from example/android/build.gradle rename to file_picker/example/android/build.gradle diff --git a/example/android/gradle.properties b/file_picker/example/android/gradle.properties similarity index 100% rename from example/android/gradle.properties rename to file_picker/example/android/gradle.properties diff --git a/example/android/gradle/wrapper/gradle-wrapper.properties b/file_picker/example/android/gradle/wrapper/gradle-wrapper.properties similarity index 100% rename from example/android/gradle/wrapper/gradle-wrapper.properties rename to file_picker/example/android/gradle/wrapper/gradle-wrapper.properties diff --git a/example/android/settings.gradle b/file_picker/example/android/settings.gradle similarity index 100% rename from example/android/settings.gradle rename to file_picker/example/android/settings.gradle diff --git a/example/example.gif b/file_picker/example/example.gif similarity index 100% rename from example/example.gif rename to file_picker/example/example.gif diff --git a/example/example_ios.gif b/file_picker/example/example_ios.gif similarity index 100% rename from example/example_ios.gif rename to file_picker/example/example_ios.gif diff --git a/example/ios/.gitignore b/file_picker/example/ios/.gitignore similarity index 100% rename from example/ios/.gitignore rename to file_picker/example/ios/.gitignore diff --git a/example/ios/Flutter/AppFrameworkInfo.plist b/file_picker/example/ios/Flutter/AppFrameworkInfo.plist similarity index 100% rename from example/ios/Flutter/AppFrameworkInfo.plist rename to file_picker/example/ios/Flutter/AppFrameworkInfo.plist diff --git a/example/ios/Flutter/Debug.xcconfig b/file_picker/example/ios/Flutter/Debug.xcconfig similarity index 100% rename from example/ios/Flutter/Debug.xcconfig rename to file_picker/example/ios/Flutter/Debug.xcconfig diff --git a/example/ios/Flutter/Flutter.podspec b/file_picker/example/ios/Flutter/Flutter.podspec similarity index 100% rename from example/ios/Flutter/Flutter.podspec rename to file_picker/example/ios/Flutter/Flutter.podspec diff --git a/example/ios/Flutter/Release.xcconfig b/file_picker/example/ios/Flutter/Release.xcconfig similarity index 100% rename from example/ios/Flutter/Release.xcconfig rename to file_picker/example/ios/Flutter/Release.xcconfig diff --git a/file_picker/example/ios/Flutter/flutter_export_environment.sh b/file_picker/example/ios/Flutter/flutter_export_environment.sh new file mode 100755 index 0000000..48e2dc6 --- /dev/null +++ b/file_picker/example/ios/Flutter/flutter_export_environment.sh @@ -0,0 +1,12 @@ +#!/bin/sh +# This is a generated file; do not edit or check into version control. +export "FLUTTER_ROOT=/Users/miguelruivo/devtools/flutter" +export "FLUTTER_APPLICATION_PATH=/Users/miguelruivo/Personal/plugins/flutter_file_picker/file_picker/example" +export "FLUTTER_TARGET=/Users/miguelruivo/Personal/plugins/flutter_file_picker/file_picker/example/lib/main.dart" +export "FLUTTER_BUILD_DIR=build" +export "SYMROOT=${SOURCE_ROOT}/../build/ios" +export "OTHER_LDFLAGS=$(inherited) -framework Flutter" +export "FLUTTER_FRAMEWORK_DIR=/Users/miguelruivo/devtools/flutter/bin/cache/artifacts/engine/ios" +export "FLUTTER_BUILD_NAME=1.0.0" +export "FLUTTER_BUILD_NUMBER=1" +export "TRACK_WIDGET_CREATION=true" diff --git a/example/ios/Runner.xcodeproj/project.pbxproj b/file_picker/example/ios/Runner.xcodeproj/project.pbxproj similarity index 100% rename from example/ios/Runner.xcodeproj/project.pbxproj rename to file_picker/example/ios/Runner.xcodeproj/project.pbxproj diff --git a/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/file_picker/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata similarity index 100% rename from example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata rename to file_picker/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata diff --git a/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/file_picker/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist similarity index 100% rename from example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist rename to file_picker/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/file_picker/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme similarity index 100% rename from example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme rename to file_picker/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme diff --git a/example/ios/Runner.xcworkspace/contents.xcworkspacedata b/file_picker/example/ios/Runner.xcworkspace/contents.xcworkspacedata similarity index 100% rename from example/ios/Runner.xcworkspace/contents.xcworkspacedata rename to file_picker/example/ios/Runner.xcworkspace/contents.xcworkspacedata diff --git a/example/ios/Runner/AppDelegate.h b/file_picker/example/ios/Runner/AppDelegate.h similarity index 100% rename from example/ios/Runner/AppDelegate.h rename to file_picker/example/ios/Runner/AppDelegate.h diff --git a/example/ios/Runner/AppDelegate.m b/file_picker/example/ios/Runner/AppDelegate.m similarity index 100% rename from example/ios/Runner/AppDelegate.m rename to file_picker/example/ios/Runner/AppDelegate.m diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/file_picker/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json similarity index 100% rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json rename to file_picker/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png b/file_picker/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png similarity index 100% rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png rename to file_picker/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png b/file_picker/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png similarity index 100% rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png rename to file_picker/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png b/file_picker/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png similarity index 100% rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png rename to file_picker/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png b/file_picker/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png similarity index 100% rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png rename to file_picker/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png b/file_picker/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png similarity index 100% rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png rename to file_picker/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png b/file_picker/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png similarity index 100% rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png rename to file_picker/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png b/file_picker/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png similarity index 100% rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png rename to file_picker/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png b/file_picker/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png similarity index 100% rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png rename to file_picker/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png b/file_picker/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png similarity index 100% rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png rename to file_picker/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png b/file_picker/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png similarity index 100% rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png rename to file_picker/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png b/file_picker/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png similarity index 100% rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png rename to file_picker/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png b/file_picker/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png similarity index 100% rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png rename to file_picker/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png b/file_picker/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png similarity index 100% rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png rename to file_picker/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png b/file_picker/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png similarity index 100% rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png rename to file_picker/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png b/file_picker/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png similarity index 100% rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png rename to file_picker/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png diff --git a/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json b/file_picker/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json similarity index 100% rename from example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json rename to file_picker/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json diff --git a/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png b/file_picker/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png similarity index 100% rename from example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png rename to file_picker/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png diff --git a/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png b/file_picker/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png similarity index 100% rename from example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png rename to file_picker/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png diff --git a/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png b/file_picker/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png similarity index 100% rename from example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png rename to file_picker/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png diff --git a/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md b/file_picker/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md similarity index 100% rename from example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md rename to file_picker/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md diff --git a/example/ios/Runner/Base.lproj/LaunchScreen.storyboard b/file_picker/example/ios/Runner/Base.lproj/LaunchScreen.storyboard similarity index 100% rename from example/ios/Runner/Base.lproj/LaunchScreen.storyboard rename to file_picker/example/ios/Runner/Base.lproj/LaunchScreen.storyboard diff --git a/example/ios/Runner/Base.lproj/Main.storyboard b/file_picker/example/ios/Runner/Base.lproj/Main.storyboard similarity index 100% rename from example/ios/Runner/Base.lproj/Main.storyboard rename to file_picker/example/ios/Runner/Base.lproj/Main.storyboard diff --git a/example/ios/Runner/Info.plist b/file_picker/example/ios/Runner/Info.plist similarity index 100% rename from example/ios/Runner/Info.plist rename to file_picker/example/ios/Runner/Info.plist diff --git a/example/ios/Runner/main.m b/file_picker/example/ios/Runner/main.m similarity index 100% rename from example/ios/Runner/main.m rename to file_picker/example/ios/Runner/main.m diff --git a/example/lib/main.dart b/file_picker/example/lib/main.dart similarity index 100% rename from example/lib/main.dart rename to file_picker/example/lib/main.dart diff --git a/example/lib/main_desktop.dart b/file_picker/example/lib/main_desktop.dart similarity index 100% rename from example/lib/main_desktop.dart rename to file_picker/example/lib/main_desktop.dart diff --git a/example/lib/src/file_picker_demo.dart b/file_picker/example/lib/src/file_picker_demo.dart similarity index 100% rename from example/lib/src/file_picker_demo.dart rename to file_picker/example/lib/src/file_picker_demo.dart diff --git a/example/pubspec.yaml b/file_picker/example/pubspec.yaml similarity index 100% rename from example/pubspec.yaml rename to file_picker/example/pubspec.yaml diff --git a/go/README.md b/file_picker/go/README.md similarity index 100% rename from go/README.md rename to file_picker/go/README.md diff --git a/go/file_darwin.go b/file_picker/go/file_darwin.go similarity index 100% rename from go/file_darwin.go rename to file_picker/go/file_darwin.go diff --git a/go/file_linux.go b/file_picker/go/file_linux.go similarity index 100% rename from go/file_linux.go rename to file_picker/go/file_linux.go diff --git a/go/file_unsupported.go b/file_picker/go/file_unsupported.go similarity index 100% rename from go/file_unsupported.go rename to file_picker/go/file_unsupported.go diff --git a/go/file_windows.go b/file_picker/go/file_windows.go similarity index 100% rename from go/file_windows.go rename to file_picker/go/file_windows.go diff --git a/go/go.mod b/file_picker/go/go.mod similarity index 100% rename from go/go.mod rename to file_picker/go/go.mod diff --git a/go/go.sum b/file_picker/go/go.sum similarity index 100% rename from go/go.sum rename to file_picker/go/go.sum diff --git a/go/import.go.tmpl b/file_picker/go/import.go.tmpl similarity index 100% rename from go/import.go.tmpl rename to file_picker/go/import.go.tmpl diff --git a/go/plugin.go b/file_picker/go/plugin.go similarity index 100% rename from go/plugin.go rename to file_picker/go/plugin.go diff --git a/ios/.gitignore b/file_picker/ios/.gitignore similarity index 100% rename from ios/.gitignore rename to file_picker/ios/.gitignore diff --git a/ios/Assets/.gitkeep b/file_picker/ios/Assets/.gitkeep similarity index 100% rename from ios/Assets/.gitkeep rename to file_picker/ios/Assets/.gitkeep diff --git a/ios/Classes/FilePickerPlugin.h b/file_picker/ios/Classes/FilePickerPlugin.h similarity index 100% rename from ios/Classes/FilePickerPlugin.h rename to file_picker/ios/Classes/FilePickerPlugin.h diff --git a/ios/Classes/FilePickerPlugin.m b/file_picker/ios/Classes/FilePickerPlugin.m similarity index 100% rename from ios/Classes/FilePickerPlugin.m rename to file_picker/ios/Classes/FilePickerPlugin.m diff --git a/ios/Classes/FileUtils.h b/file_picker/ios/Classes/FileUtils.h similarity index 100% rename from ios/Classes/FileUtils.h rename to file_picker/ios/Classes/FileUtils.h diff --git a/ios/Classes/FileUtils.m b/file_picker/ios/Classes/FileUtils.m similarity index 100% rename from ios/Classes/FileUtils.m rename to file_picker/ios/Classes/FileUtils.m diff --git a/ios/Classes/ImageUtils.h b/file_picker/ios/Classes/ImageUtils.h similarity index 100% rename from ios/Classes/ImageUtils.h rename to file_picker/ios/Classes/ImageUtils.h diff --git a/ios/Classes/ImageUtils.m b/file_picker/ios/Classes/ImageUtils.m similarity index 100% rename from ios/Classes/ImageUtils.m rename to file_picker/ios/Classes/ImageUtils.m diff --git a/ios/file_picker.podspec b/file_picker/ios/file_picker.podspec similarity index 100% rename from ios/file_picker.podspec rename to file_picker/ios/file_picker.podspec diff --git a/lib/file_picker.dart b/file_picker/lib/file_picker.dart similarity index 56% rename from lib/file_picker.dart rename to file_picker/lib/file_picker.dart index 0ba1df2..cb43eb9 100644 --- a/lib/file_picker.dart +++ b/file_picker/lib/file_picker.dart @@ -1,22 +1,25 @@ import 'dart:async'; import 'dart:io'; -import 'package:flutter/foundation.dart'; -import 'package:flutter/services.dart'; +import 'package:file_picker_platform_interface/file_picker_platform_interface.dart'; -enum FileType { - any, - media, - image, - video, - audio, - custom, -} +export 'package:file_picker_platform_interface/file_picker_platform_interface.dart' show FileType; + +final FilePickerPlatform _filePickerPlatform = FilePickerPlatform.instance; class FilePicker { FilePicker._(); - static const MethodChannel _channel = const MethodChannel('miguelruivo.flutter.plugins.filepicker'); - static const String _tag = 'FilePicker'; + + /// Returns an absolute file path from the calling platform. + /// + /// Extension filters are allowed with `FileType.custom`, when used, make sure to provide a `List` + /// of [allowedExtensions] (e.g. [`pdf`, `svg`, `jpg`].). + /// Defaults to `FileType.any` which will display all file types. + static Future getFilePath({FileType type = FileType.any, List allowedExtensions}) async => + await _filePickerPlatform.getFiles( + type: type, + allowedExtensions: allowedExtensions, + ); /// Returns an iterable `Map` where the `key` is the name of the file /// and the `value` the path. @@ -25,25 +28,46 @@ class FilePicker { /// If provided, make sure you select `FileType.custom` as type. /// Defaults to `FileType.any`, which allows any combination of files to be multi selected at once. static Future> getMultiFilePath({FileType type = FileType.any, List allowedExtensions}) async => - await _getPath(describeEnum(type), true, allowedExtensions); - - /// Returns an absolute file path from the calling platform. - /// - /// Extension filters are allowed with `FileType.custom`, when used, make sure to provide a `List` - /// of [allowedExtensions] (e.g. [`pdf`, `svg`, `jpg`].). - /// Defaults to `FileType.any` which will display all file types. - static Future getFilePath({FileType type = FileType.any, List allowedExtensions}) async => - await _getPath(describeEnum(type), false, allowedExtensions); + await _filePickerPlatform.getFiles( + type: type, + allowMultiple: true, + allowedExtensions: allowedExtensions, + ); /// Returns a `File` object from the selected file path. /// /// This is an utility method that does the same of `getFilePath()` but saving some boilerplate if /// you are planing to create a `File` for the returned path. static Future getFile({FileType type = FileType.any, List allowedExtensions}) async { - final String filePath = await _getPath(describeEnum(type), false, allowedExtensions); + final String filePath = await _filePickerPlatform.getFiles( + type: type, + allowedExtensions: allowedExtensions, + ); return filePath != null ? File(filePath) : null; } + /// Returns a `List` object from the selected files paths. + /// + /// This is an utility method that does the same of `getMultiFilePath()` but saving some boilerplate if + /// you are planing to create a list of `File`s for the returned paths. + static Future> getMultiFile({FileType type = FileType.any, List allowedExtensions}) async { + final Map paths = await _filePickerPlatform.getFiles( + type: type, + allowMultiple: true, + allowedExtensions: allowedExtensions, + ); + + return paths != null && paths.isNotEmpty ? paths.values.map((path) => File(path)).toList() : null; + } + + /// Selects a directory and returns its absolute path. + /// + /// On Android, this requires to be running on SDK 21 or above, else won't work. + /// Returns `null` if folder path couldn't be resolved. + static Future getDirectoryPath() async { + return _filePickerPlatform.getDirectoryPath(); + } + /// Asks the underlying platform to remove any temporary files created by this plugin. /// /// This typically relates to cached files that are stored in the cache directory of @@ -52,56 +76,6 @@ class FilePicker { /// /// Returns `true` if the files were removed with success, `false` otherwise. static Future clearTemporaryFiles() async { - return _channel.invokeMethod('clear'); - } - - /// Returns a `List` object from the selected files paths. - /// - /// This is an utility method that does the same of `getMultiFilePath()` but saving some boilerplate if - /// you are planing to create a list of `File`s for the returned paths. - static Future> getMultiFile({FileType type = FileType.any, List allowedExtensions}) async { - final Map paths = await _getPath(describeEnum(type), true, allowedExtensions); - return paths != null && paths.isNotEmpty ? paths.values.map((path) => File(path)).toList() : null; - } - - /// Selects a directory and returns its absolute path. - /// - /// On Android, this requires to be running on SDK 21 or above, else won't work. - /// Returns `null` if folder path couldn't be resolved. - static Future getDirectoryPath() async { - try { - return await _channel.invokeMethod('dir'); - } on PlatformException catch (ex) { - if (ex.code == "unknown_path") { - print( - '[$_tag] Could not resolve directory path. Maybe it\'s a protected one or unsupported (such as Downloads folder). If you are on Android, make sure that you are on SDK 21 or above.'); - } - return null; - } - } - - static Future _getPath(String type, bool allowMultipleSelection, List allowedExtensions) async { - if (type != 'custom' && (allowedExtensions?.isNotEmpty ?? false)) { - throw Exception('If you are using a custom extension filter, please use the FileType.custom instead.'); - } - try { - dynamic result = await _channel.invokeMethod(type, { - 'allowMultipleSelection': allowMultipleSelection, - 'allowedExtensions': allowedExtensions, - }); - if (result != null && allowMultipleSelection) { - if (result is String) { - result = [result]; - } - return Map.fromIterable(result, key: (path) => path.split('/').last, value: (path) => path); - } - return result; - } on PlatformException catch (e) { - print('[$_tag] Platform exception: $e'); - rethrow; - } catch (e) { - print('[$_tag] Unsupported operation. Method not found. The exception thrown was: $e'); - rethrow; - } + return _filePickerPlatform.clearTemporaryFiles(); } } diff --git a/pubspec.yaml b/file_picker/pubspec.yaml similarity index 83% rename from pubspec.yaml rename to file_picker/pubspec.yaml index 0c5b600..e15edf5 100644 --- a/pubspec.yaml +++ b/file_picker/pubspec.yaml @@ -7,6 +7,8 @@ dependencies: flutter: sdk: flutter flutter_plugin_android_lifecycle: ^1.0.6 + file_picker_platform_interface: ^1.1.0 + file_picker_web: ^1.0.0 environment: sdk: ">=2.0.0 <3.0.0" @@ -20,4 +22,7 @@ flutter: pluginClass: FilePickerPlugin ios: pluginClass: FilePickerPlugin + web: + default_package: file_picker_web + diff --git a/file_picker_platform_interface/CHANGELOG.md b/file_picker_platform_interface/CHANGELOG.md new file mode 100644 index 0000000..e17155d --- /dev/null +++ b/file_picker_platform_interface/CHANGELOG.md @@ -0,0 +1,23 @@ +## [1.1.0] - Adds directory pick + +Implements `getDirectoryPath()` + +## [1.0.0] - Updates method channel + +Implements `getFiles()` + +## [0.0.3] - Updates interface + +Removes `getFilePath()` + +## [0.0.2] - Updates interface + +Updates methods from File Picker interface + +## [0.0.1+1] - Update README + +Updates README + +## [0.0.1] - Create Platform Interface + +Added Filer Picker platform interface. diff --git a/file_picker_platform_interface/LICENSE b/file_picker_platform_interface/LICENSE new file mode 100644 index 0000000..6ceb585 --- /dev/null +++ b/file_picker_platform_interface/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 Miguel Ruivo + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/file_picker_platform_interface/README.md b/file_picker_platform_interface/README.md new file mode 100644 index 0000000..9b8f456 --- /dev/null +++ b/file_picker_platform_interface/README.md @@ -0,0 +1,26 @@ +# file_picker_platform_interface + +A common platform interface for the [`file_picker`][1] plugin. + +This interface allows platform-specific implementations of the `file_picker` +plugin, as well as the plugin itself, to ensure they are supporting the +same interface. + +# Usage + +To implement a new platform-specific implementation of `file_picker`, extend +[`FilePickerPlatform`][2] with an implementation that performs the +platform-specific behavior, and when you register your plugin, set the default +`FilePickerPlatform` by calling +`FilePickerPlatform.instance = MyPlatformFilePicker()`. + +# Note on breaking changes + +Strongly prefer non-breaking changes (such as adding a method to the interface) +over breaking changes for this package. + +See https://flutter.dev/go/platform-interface-breaking-changes for a discussion +on why a less-clean interface is preferable to a breaking change. + +[1]: ../file_picker +[2]: lib/file_picker_platform_interface.dart diff --git a/file_picker_platform_interface/lib/file_picker_platform_interface.dart b/file_picker_platform_interface/lib/file_picker_platform_interface.dart new file mode 100644 index 0000000..c199d8b --- /dev/null +++ b/file_picker_platform_interface/lib/file_picker_platform_interface.dart @@ -0,0 +1,65 @@ +import 'package:plugin_platform_interface/plugin_platform_interface.dart'; + +import 'method_channel_file_picker.dart'; + +enum FileType { + any, + media, + image, + video, + audio, + custom, +} + +/// The interface that implementations of file_picker must implement. +/// +/// Platform implementations should extend this class rather than implement it as `file_picker` +/// does not consider newly added methods to be breaking changes. Extending this class +/// (using `extends`) ensures that the subclass will get the default implementation, while +/// platform implementations that `implements` this interface will be broken by newly added +/// [FilePickerPlatform] methods. +abstract class FilePickerPlatform extends PlatformInterface { + /// Constructs a UrlLauncherPlatform. + FilePickerPlatform() : super(token: _token); + + static final Object _token = Object(); + + static FilePickerPlatform _instance = MethodChannelFilePicker(); + + static FilePickerPlatform get instance => _instance; + + static set instance(FilePickerPlatform instance) { + PlatformInterface.verifyToken(instance, _token); + _instance = instance; + } + + /// Retrieves the file(s) from the underlying platform + /// + /// Default [type] set to `FileType.any` with [allowMultiple] set to `false` + /// Optionally, [allowedExtensions] might be provided (e.g. [`pdf`, `svg`, `jpg`].). + /// + /// Allows `dynamic` return as files may be resolved to different types, based + /// on each platform implementation. For example, when using _dart:html_ with Flutter Web + /// or _dart:io_ with Flutter, different `File` instances could be used. + Future getFiles({ + FileType type = FileType.any, + List allowedExtensions, + bool allowMultiple = false, + }) async => + throw UnimplementedError('getFiles() has not been implemented.'); + + /// Asks the underlying platform to remove any temporary files created by this plugin. + /// + /// This typically relates to cached files that are stored in the cache directory of + /// each platform and it isn't required to invoke this as the system should take care + /// of it whenever needed. However, this will force the cleanup if you want to manage those on your own. + /// + /// Returns `true` if the files were removed with success, `false` otherwise. + Future clearTemporaryFiles() async => throw UnimplementedError('clearTemporaryFiles() has not been implemented.'); + + /// Selects a directory and returns its absolute path. + /// + /// On Android, this requires to be running on SDK 21 or above, else won't work. + /// Returns `null` if folder path couldn't be resolved. + Future getDirectoryPath() async => throw UnimplementedError('getDirectoryPath() has not been implemented.'); +} diff --git a/file_picker_platform_interface/lib/method_channel_file_picker.dart b/file_picker_platform_interface/lib/method_channel_file_picker.dart new file mode 100644 index 0000000..c2443d6 --- /dev/null +++ b/file_picker_platform_interface/lib/method_channel_file_picker.dart @@ -0,0 +1,65 @@ +import 'package:flutter/foundation.dart'; +import 'package:flutter/services.dart'; + +import 'file_picker_platform_interface.dart'; + +const MethodChannel _channel = MethodChannel('miguelruivo.flutter.plugins.filepicker'); + +/// An implementation of [FilePickerPlatform] that uses method channels. +class MethodChannelFilePicker extends FilePickerPlatform { + static const String _tag = 'MethodChannelFilePicker'; + + @override + Future getFiles({ + FileType type = FileType.any, + List allowedExtensions, + bool allowMultiple = false, + }) => + _getPath(type, allowMultiple, allowedExtensions); + + @override + Future clearTemporaryFiles() async => _channel.invokeMethod('clear'); + + @override + Future getDirectoryPath() async { + try { + return await _channel.invokeMethod('dir'); + } on PlatformException catch (ex) { + if (ex.code == "unknown_path") { + print( + '[$_tag] Could not resolve directory path. Maybe it\'s a protected one or unsupported (such as Downloads folder). If you are on Android, make sure that you are on SDK 21 or above.'); + } + return null; + } + } + + Future _getPath( + FileType fileType, + bool allowMultipleSelection, + List allowedExtensions, + ) async { + final String type = describeEnum(fileType); + if (type != 'custom' && (allowedExtensions?.isNotEmpty ?? false)) { + throw Exception('If you are using a custom extension filter, please use the FileType.custom instead.'); + } + try { + dynamic result = await _channel.invokeMethod(type, { + 'allowMultipleSelection': allowMultipleSelection, + 'allowedExtensions': allowedExtensions, + }); + if (result != null && allowMultipleSelection) { + if (result is String) { + result = [result]; + } + return Map.fromIterable(result, key: (path) => path.split('/').last, value: (path) => path); + } + return result; + } on PlatformException catch (e) { + print('[$_tag] Platform exception: $e'); + rethrow; + } catch (e) { + print('[$_tag] Unsupported operation. Method not found. The exception thrown was: $e'); + rethrow; + } + } +} diff --git a/file_picker_platform_interface/pubspec.yaml b/file_picker_platform_interface/pubspec.yaml new file mode 100644 index 0000000..e0357e5 --- /dev/null +++ b/file_picker_platform_interface/pubspec.yaml @@ -0,0 +1,16 @@ +name: file_picker_platform_interface +description: A common platform interface for the file_picker plugin +homepage: https://github.com/miguelpruivo/plugins_flutter_file_picker/file_picker_platform_interface +version: 1.1.0 + +environment: + sdk: ">=2.1.0 <3.0.0" + +dependencies: + flutter: + sdk: flutter + plugin_platform_interface: ^1.0.1 + +dev_dependencies: + flutter_test: + sdk: flutter diff --git a/file_picker_web/CHANGELOG.md b/file_picker_web/CHANGELOG.md new file mode 100644 index 0000000..1a9c02d --- /dev/null +++ b/file_picker_web/CHANGELOG.md @@ -0,0 +1,11 @@ +## 1.0.0 + +Adds public API documentation and updates file_picker_platform_interface dependency. + +## 0.0.2 + +Added no-op iOS podspec to prevent build issues on iOS. + +## 0.0.1 + +Creation of File Picker Web project draft (not yet usable) diff --git a/file_picker_web/LICENSE b/file_picker_web/LICENSE new file mode 100644 index 0000000..6ab60fa --- /dev/null +++ b/file_picker_web/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 Miguel Ruivo + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/file_picker_web/README.md b/file_picker_web/README.md new file mode 100644 index 0000000..2c636a1 --- /dev/null +++ b/file_picker_web/README.md @@ -0,0 +1,29 @@ +# file_picker_web + +The web implementation of [`file_picker`][1]. + +## Usage + +### Import the package +To use this plugin in your Flutter Web app, simply add it as a dependency in +your pubspec alongside the base `file_picker` plugin. + +_(This is only temporary: in the future we hope to make this package an +"endorsed" implementation of `file_picker`, so that it is automatically +included in your Flutter Web app when you depend on `package:file_picker`.)_ + +This is what the above means to your `pubspec.yaml`: + +```yaml +... +dependencies: + ... + file_picker_web: ^0.0.1 + ... +``` + +### Use the plugin +Once you have the `file_picker_web` dependency in your pubspec, you should +be able to use `package:file_picker` as normal. + +[1]: ../file_picker/file_picker diff --git a/file_picker_web/example/.gitignore b/file_picker_web/example/.gitignore new file mode 100644 index 0000000..1ba9c33 --- /dev/null +++ b/file_picker_web/example/.gitignore @@ -0,0 +1,43 @@ +# Miscellaneous +*.class +*.log +*.pyc +*.swp +.DS_Store +.atom/ +.buildlog/ +.history +.svn/ + +# IntelliJ related +*.iml +*.ipr +*.iws +.idea/ + +# The .vscode folder contains launch configuration and tasks you configure in +# VS Code which you may wish to be included in version control, so this line +# is commented out by default. +#.vscode/ + +# Flutter/Dart/Pub related +**/doc/api/ +.dart_tool/ +.flutter-plugins +.flutter-plugins-dependencies +.packages +.pub-cache/ +.pub/ +/build/ + +# Web related +lib/generated_plugin_registrant.dart + +# Symbolication related +app.*.symbols + +# Obfuscation related +app.*.map.json + +# Exceptions to above rules. +!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages diff --git a/file_picker_web/example/.metadata b/file_picker_web/example/.metadata new file mode 100644 index 0000000..bb25afd --- /dev/null +++ b/file_picker_web/example/.metadata @@ -0,0 +1,10 @@ +# 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. + +version: + revision: e6b34c2b5c96bb95325269a29a84e83ed8909b5f + channel: beta + +project_type: app diff --git a/file_picker_web/example/README.md b/file_picker_web/example/README.md new file mode 100644 index 0000000..bce5708 --- /dev/null +++ b/file_picker_web/example/README.md @@ -0,0 +1,16 @@ +# file_picker_web_example + +Demonstrates how to use the file_picker_web plugin. + +## Getting Started + +This project is a starting point for a Flutter application. + +A few resources to get you started if this is your first Flutter project: + +- [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab) +- [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook) + +For help getting started with Flutter, view our +[online documentation](https://flutter.dev/docs), which offers tutorials, +samples, guidance on mobile development, and a full API reference. diff --git a/file_picker_web/example/lib/main.dart b/file_picker_web/example/lib/main.dart new file mode 100644 index 0000000..658fdbc --- /dev/null +++ b/file_picker_web/example/lib/main.dart @@ -0,0 +1,65 @@ +// ignore: avoid_web_libraries_in_flutter +import 'dart:html'; +import 'package:file_picker_web/file_picker_web.dart'; +import 'package:flutter/material.dart'; + +void main() { + runApp(MyApp()); +} + +class MyApp extends StatefulWidget { + @override + _MyAppState createState() => _MyAppState(); +} + +class _MyAppState extends State { + List _files = []; + + void _pickFiles() async { + _files = await FilePicker.getFile() ?? []; + setState(() {}); + } + + @override + Widget build(BuildContext context) { + return MaterialApp( + home: Scaffold( + appBar: AppBar( + title: const Text('Plugin example app'), + ), + body: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + Expanded( + child: _files.isNotEmpty + ? ListView.separated( + itemBuilder: (BuildContext context, int index) => + Text(_files[index].name), + itemCount: _files.length, + separatorBuilder: (_, __) => const Divider( + thickness: 5.0, + ), + ) + : Center( + child: Text( + 'Pick some files', + textAlign: TextAlign.center, + ), + ), + ), + Padding( + padding: const EdgeInsets.all(15.0), + child: RaisedButton( + onPressed: _pickFiles, + child: Text('Pick Files'), + ), + ) + ], + ), + ), + ), + ); + } +} diff --git a/file_picker_web/example/pubspec.yaml b/file_picker_web/example/pubspec.yaml new file mode 100644 index 0000000..dc463fb --- /dev/null +++ b/file_picker_web/example/pubspec.yaml @@ -0,0 +1,27 @@ +name: file_picker_web_example +description: Demonstrates how to use the file_picker_web plugin. + +# The following line prevents the package from being accidentally published to +# pub.dev using `pub publish`. This is preferred for private packages. +publish_to: 'none' # Remove this line if you wish to publish to pub.dev + +environment: + sdk: ">=2.7.0 <3.0.0" + +dependencies: + flutter: + sdk: flutter + + file_picker_web: + path: ../ + + cupertino_icons: ^0.1.3 + +dev_dependencies: + flutter_test: + sdk: flutter + + +flutter: + + uses-material-design: true diff --git a/file_picker_web/example/web/favicon.png b/file_picker_web/example/web/favicon.png new file mode 100644 index 0000000..8aaa46a Binary files /dev/null and b/file_picker_web/example/web/favicon.png differ diff --git a/file_picker_web/example/web/icons/Icon-192.png b/file_picker_web/example/web/icons/Icon-192.png new file mode 100644 index 0000000..b749bfe Binary files /dev/null and b/file_picker_web/example/web/icons/Icon-192.png differ diff --git a/file_picker_web/example/web/icons/Icon-512.png b/file_picker_web/example/web/icons/Icon-512.png new file mode 100644 index 0000000..88cfd48 Binary files /dev/null and b/file_picker_web/example/web/icons/Icon-512.png differ diff --git a/file_picker_web/example/web/index.html b/file_picker_web/example/web/index.html new file mode 100644 index 0000000..c1b8f5a --- /dev/null +++ b/file_picker_web/example/web/index.html @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + file_picker_web_example + + + + + + + + diff --git a/file_picker_web/example/web/manifest.json b/file_picker_web/example/web/manifest.json new file mode 100644 index 0000000..3f21237 --- /dev/null +++ b/file_picker_web/example/web/manifest.json @@ -0,0 +1,23 @@ +{ + "name": "file_picker_web_example", + "short_name": "file_picker_web_example", + "start_url": ".", + "display": "minimal-ui", + "background_color": "#0175C2", + "theme_color": "#0175C2", + "description": "Demonstrates how to use the file_picker_web plugin.", + "orientation": "portrait-primary", + "prefer_related_applications": false, + "icons": [ + { + "src": "icons/Icon-192.png", + "sizes": "192x192", + "type": "image/png" + }, + { + "src": "icons/Icon-512.png", + "sizes": "512x512", + "type": "image/png" + } + ] +} diff --git a/file_picker_web/ios/file_picker_web.podspec b/file_picker_web/ios/file_picker_web.podspec new file mode 100644 index 0000000..5e4bb8c --- /dev/null +++ b/file_picker_web/ios/file_picker_web.podspec @@ -0,0 +1,20 @@ +# +# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html +# +Pod::Spec.new do |s| + s.name = 'file_picker_web' + s.version = '0.0.1' + s.summary = 'No-op implementation of file_picker_web web plugin to avoid build issues on iOS' + s.description = <<-DESC + temp fake video_player_web plugin + DESC + s.homepage = 'https://github.com/miguelpruivo/plugins_flutter_file_picker/file_picker_web' + s.license = { :file => '../LICENSE' } + s.author = { 'Miguel Ruivo' => 'miguel@miguelruivo.com' } + s.source = { :path => '.' } + s.source_files = 'Classes/**/*' + s.public_header_files = 'Classes/**/*.h' + s.dependency 'Flutter' + + s.ios.deployment_target = '8.0' + end \ No newline at end of file diff --git a/file_picker_web/lib/file_picker_web.dart b/file_picker_web/lib/file_picker_web.dart new file mode 100644 index 0000000..160665e --- /dev/null +++ b/file_picker_web/lib/file_picker_web.dart @@ -0,0 +1,77 @@ +import 'dart:async'; + +import 'package:file_picker_platform_interface/file_picker_platform_interface.dart'; +import 'package:flutter_web_plugins/flutter_web_plugins.dart'; +import 'dart:html' as html; + +class FilePicker extends FilePickerPlatform { + FilePicker._(); + static final FilePicker _instance = FilePicker._(); + + static void registerWith(Registrar registrar) { + FilePickerPlatform.instance = _instance; + } + + /// Opens browser file picker window to select multiple files. + /// [type] defaults to `FileType.any` which allows all file types to be picked. Optionally, + /// [allowedExtensions] can be used (eg. `[.jpg, .pdf]`) to restrict picking types + /// + /// Returns a `List` + static Future> getMultiFile( + {FileType type = FileType.any, List allowedExtensions}) async { + return await _instance.getFiles( + type: type, allowMultiple: true, allowedExtensions: allowedExtensions); + } + + /// Opens browser file picker window to select a single file. + /// [type] defaults to `FileType.any` which allows all file types to be picked. Optionally, + /// [allowedExtensions] can be used (eg. `[.jpg, .pdf]`) to restrict picking types + /// + /// Returns a `html.File` + static Future getFile( + {FileType type = FileType.any, List allowedExtensions}) async { + return (await _instance.getFiles( + type: type, allowedExtensions: allowedExtensions)) + .first; + } + + @override + Future getFiles({ + FileType type = FileType.any, + List allowedExtensions, + bool allowMultiple = false, + }) async { + final Completer> pickedFiles = Completer>(); + html.InputElement uploadInput = html.FileUploadInputElement(); + uploadInput.multiple = allowMultiple; + uploadInput.accept = _fileType(type, allowedExtensions); + uploadInput.click(); + uploadInput.onChange + .listen((event) => pickedFiles.complete(uploadInput.files)); + return await pickedFiles.future; + } + + static String _fileType(FileType type, List allowedExtensions) { + switch (type) { + case FileType.any: + return ''; + + case FileType.audio: + return 'audio/*'; + + case FileType.image: + return 'image/*'; + + case FileType.video: + return 'video/*'; + + case FileType.media: + return 'video/*|image/*'; + + case FileType.custom: + return allowedExtensions.reduce((value, element) => '$value,$element'); + break; + } + return ''; + } +} diff --git a/file_picker_web/pubspec.yaml b/file_picker_web/pubspec.yaml new file mode 100644 index 0000000..f9c4159 --- /dev/null +++ b/file_picker_web/pubspec.yaml @@ -0,0 +1,27 @@ +name: file_picker_web +description: Web platform implementation of file_picker +homepage: https://github.com/miguelpruivo/plugins_flutter_file_picker/file_picker_web +version: 1.0.0 + +environment: + sdk: ">=2.7.0 <3.0.0" + flutter: ">=1.10.0" + +dependencies: + file_picker_platform_interface: ^1.0.0 + flutter: + sdk: flutter + flutter_web_plugins: + sdk: flutter + +dev_dependencies: + flutter_test: + sdk: flutter + + +flutter: + plugin: + platforms: + web: + pluginClass: FilePicker + fileName: file_picker_web.dart