├── ios ├── Assets │ └── .gitkeep ├── Classes │ ├── FlutterFileReaderPlugin.h │ ├── FileReaderWKWebView.swift │ ├── FlutterFileReaderPlugin.m │ ├── FileReaderFactory.swift │ ├── SwiftFlutterFileReaderPlugin.swift │ └── FileReaderView.swift ├── .gitignore └── flutter_filereader.podspec ├── .gitattributes ├── example ├── android │ ├── settings_aar.gradle │ ├── app │ │ ├── proguard-rules.pro │ │ ├── src │ │ │ ├── main │ │ │ │ ├── res │ │ │ │ │ ├── mipmap-hdpi │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-mdpi │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-xhdpi │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── xml │ │ │ │ │ │ ├── provide_file_paths.xml │ │ │ │ │ │ └── android_q_net_security_config.xml │ │ │ │ │ ├── drawable │ │ │ │ │ │ └── launch_background.xml │ │ │ │ │ └── values │ │ │ │ │ │ └── styles.xml │ │ │ │ ├── java │ │ │ │ │ └── com │ │ │ │ │ │ └── webview │ │ │ │ │ │ └── flutter_filereader_example │ │ │ │ │ │ ├── MainActivity.java │ │ │ │ │ │ └── EmbedderV1Activity.java │ │ │ │ └── AndroidManifest.xml │ │ │ ├── debug │ │ │ │ └── AndroidManifest.xml │ │ │ └── profile │ │ │ │ └── AndroidManifest.xml │ │ └── build.gradle │ ├── gradle.properties │ ├── .gitignore │ ├── gradle │ │ └── wrapper │ │ │ └── gradle-wrapper.properties │ ├── settings.gradle │ └── build.gradle ├── ios │ ├── Runner │ │ ├── Runner-Bridging-Header.h │ │ ├── Assets.xcassets │ │ │ ├── LaunchImage.imageset │ │ │ │ ├── LaunchImage.png │ │ │ │ ├── LaunchImage@2x.png │ │ │ │ ├── LaunchImage@3x.png │ │ │ │ ├── README.md │ │ │ │ └── Contents.json │ │ │ └── AppIcon.appiconset │ │ │ │ ├── Icon-App-20x20@1x.png │ │ │ │ ├── Icon-App-20x20@2x.png │ │ │ │ ├── Icon-App-20x20@3x.png │ │ │ │ ├── Icon-App-29x29@1x.png │ │ │ │ ├── Icon-App-29x29@2x.png │ │ │ │ ├── Icon-App-29x29@3x.png │ │ │ │ ├── Icon-App-40x40@1x.png │ │ │ │ ├── Icon-App-40x40@2x.png │ │ │ │ ├── Icon-App-40x40@3x.png │ │ │ │ ├── Icon-App-60x60@2x.png │ │ │ │ ├── Icon-App-60x60@3x.png │ │ │ │ ├── Icon-App-76x76@1x.png │ │ │ │ ├── Icon-App-76x76@2x.png │ │ │ │ ├── Icon-App-1024x1024@1x.png │ │ │ │ ├── Icon-App-83.5x83.5@2x.png │ │ │ │ └── Contents.json │ │ ├── AppDelegate.swift │ │ ├── Base.lproj │ │ │ ├── Main.storyboard │ │ │ └── LaunchScreen.storyboard │ │ └── Info.plist │ ├── Flutter │ │ ├── Debug.xcconfig │ │ ├── Release.xcconfig │ │ ├── flutter_export_environment.sh │ │ └── AppFrameworkInfo.plist │ ├── Runner.xcodeproj │ │ ├── project.xcworkspace │ │ │ └── contents.xcworkspacedata │ │ ├── xcshareddata │ │ │ └── xcschemes │ │ │ │ └── Runner.xcscheme │ │ └── project.pbxproj │ ├── Runner.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ ├── .gitignore │ ├── Podfile.lock │ └── Podfile ├── README.md ├── assets │ └── files │ │ ├── doc.doc │ │ ├── jpg.jpg │ │ ├── pdf.pdf │ │ ├── png.png │ │ ├── ppt.ppt │ │ ├── txt.txt │ │ ├── xls.xls │ │ ├── docx.docx │ │ ├── jpeg1.jpeg │ │ ├── pptx.pptx │ │ └── xlsx.xlsx ├── .metadata ├── lib │ ├── file.dart │ └── main.dart ├── .gitignore ├── .flutter-plugins-dependencies └── pubspec.yaml ├── android ├── settings.gradle ├── gradle.properties ├── .gitignore ├── src │ └── main │ │ ├── res │ │ └── xml │ │ │ └── android_q_net_security_config.xml │ │ ├── AndroidManifest.xml │ │ └── java │ │ └── com │ │ └── webview │ │ └── filereader │ │ ├── X5FileReaderFactory.java │ │ ├── NetBroadcastReceiver.java │ │ ├── NetUtil.java │ │ ├── X5FileReaderView.java │ │ └── FlutterFileReaderPlugin.java ├── libs │ └── tbs_sdk_thirdapp_v4.3.0.165_44065_sharewithdownloadwithfile_withoutGame_obfs_20210628_103707.jar ├── build.gradle ├── gradlew.bat ├── gradlew └── proguard-rules.pro ├── .gitignore ├── .idea ├── encodings.xml ├── libraries │ └── Flutter_for_Android.xml ├── runConfigurations │ └── example_lib_main_dart.xml ├── vcs.xml ├── modules.xml ├── codeStyles │ └── Project.xml └── workspace.xml ├── .metadata ├── CHANGELOG.md ├── LICENSE ├── README.md ├── lib ├── filereader.dart └── flutter_filereader.dart ├── pubspec.yaml └── flutter_filereader.iml /ios/Assets/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.* linguist-language=dart 2 | -------------------------------------------------------------------------------- /example/android/settings_aar.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | -------------------------------------------------------------------------------- /android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'flutter_filereader' 2 | -------------------------------------------------------------------------------- /example/ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.enableR8=true 3 | -------------------------------------------------------------------------------- /example/android/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | -printconfiguration /Users/hujie/Desktop/r8.txt -------------------------------------------------------------------------------- /example/README.md: -------------------------------------------------------------------------------- 1 | # flutter_filereader_example 2 | 3 | 4 | 5 | ## Getting Started 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/assets/files/doc.doc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fluttercandies/flutter_filereader/HEAD/example/assets/files/doc.doc -------------------------------------------------------------------------------- /example/assets/files/jpg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fluttercandies/flutter_filereader/HEAD/example/assets/files/jpg.jpg -------------------------------------------------------------------------------- /example/assets/files/pdf.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fluttercandies/flutter_filereader/HEAD/example/assets/files/pdf.pdf -------------------------------------------------------------------------------- /example/assets/files/png.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fluttercandies/flutter_filereader/HEAD/example/assets/files/png.png -------------------------------------------------------------------------------- /example/assets/files/ppt.ppt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fluttercandies/flutter_filereader/HEAD/example/assets/files/ppt.ppt -------------------------------------------------------------------------------- /example/assets/files/txt.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fluttercandies/flutter_filereader/HEAD/example/assets/files/txt.txt -------------------------------------------------------------------------------- /example/assets/files/xls.xls: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fluttercandies/flutter_filereader/HEAD/example/assets/files/xls.xls -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .dart_tool/ 3 | 4 | .packages 5 | .pub/ 6 | .idea 7 | 8 | build/ 9 | /example/pubspec.lock 10 | -------------------------------------------------------------------------------- /example/assets/files/docx.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fluttercandies/flutter_filereader/HEAD/example/assets/files/docx.docx -------------------------------------------------------------------------------- /example/assets/files/jpeg1.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fluttercandies/flutter_filereader/HEAD/example/assets/files/jpeg1.jpeg -------------------------------------------------------------------------------- /example/assets/files/pptx.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fluttercandies/flutter_filereader/HEAD/example/assets/files/pptx.pptx -------------------------------------------------------------------------------- /example/assets/files/xlsx.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fluttercandies/flutter_filereader/HEAD/example/assets/files/xlsx.xlsx -------------------------------------------------------------------------------- /android/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | -------------------------------------------------------------------------------- /example/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /ios/Classes/FlutterFileReaderPlugin.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface FlutterFileReaderPlugin: NSObject 4 | @end 5 | -------------------------------------------------------------------------------- /example/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | android.enableR8=true 5 | -------------------------------------------------------------------------------- /example/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /example/android/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | /.gradle 3 | /captures/ 4 | /gradlew 5 | /gradlew.bat 6 | /local.properties 7 | GeneratedPluginRegistrant.java 8 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fluttercandies/flutter_filereader/HEAD/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fluttercandies/flutter_filereader/HEAD/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fluttercandies/flutter_filereader/HEAD/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fluttercandies/flutter_filereader/HEAD/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fluttercandies/flutter_filereader/HEAD/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fluttercandies/flutter_filereader/HEAD/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fluttercandies/flutter_filereader/HEAD/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fluttercandies/flutter_filereader/HEAD/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /android/src/main/res/xml/android_q_net_security_config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 |     4 | 5 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fluttercandies/flutter_filereader/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fluttercandies/flutter_filereader/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fluttercandies/flutter_filereader/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fluttercandies/flutter_filereader/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fluttercandies/flutter_filereader/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fluttercandies/flutter_filereader/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fluttercandies/flutter_filereader/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fluttercandies/flutter_filereader/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fluttercandies/flutter_filereader/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fluttercandies/flutter_filereader/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fluttercandies/flutter_filereader/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fluttercandies/flutter_filereader/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fluttercandies/flutter_filereader/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/xml/provide_file_paths.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fluttercandies/flutter_filereader/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fluttercandies/flutter_filereader/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/xml/android_q_net_security_config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /android/libs/tbs_sdk_thirdapp_v4.3.0.165_44065_sharewithdownloadwithfile_withoutGame_obfs_20210628_103707.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fluttercandies/flutter_filereader/HEAD/android/libs/tbs_sdk_thirdapp_v4.3.0.165_44065_sharewithdownloadwithfile_withoutGame_obfs_20210628_103707.jar -------------------------------------------------------------------------------- /ios/Classes/FileReaderWKWebView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // FileReaderWKWebView.swift 3 | // flutter_downloader 4 | // 5 | // Created by 胡杰 on 2019/10/21. 6 | // 7 | 8 | import UIKit 9 | import WebKit 10 | 11 | class FileReaderWKWebView : WKWebView { 12 | 13 | 14 | 15 | 16 | } 17 | -------------------------------------------------------------------------------- /example/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Tue Apr 21 17:26:32 CST 2020 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip 7 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Classes/FlutterFileReaderPlugin.m: -------------------------------------------------------------------------------- 1 | #import "FlutterFileReaderPlugin.h" 2 | #import 3 | 4 | @implementation FlutterFileReaderPlugin 5 | + (void)registerWithRegistrar:(NSObject*)registrar { 6 | [SwiftFlutterFileReaderPlugin registerWithRegistrar:registrar]; 7 | } 8 | @end 9 | -------------------------------------------------------------------------------- /.idea/libraries/Flutter_for_Android.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: 7fc14a55af64462763d28abfb4e610086c6e0f39 8 | channel: dev 9 | 10 | project_type: plugin 11 | -------------------------------------------------------------------------------- /example/.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: 7fc14a55af64462763d28abfb4e610086c6e0f39 8 | channel: dev 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /.idea/runConfigurations/example_lib_main_dart.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import Flutter 3 | 4 | @UIApplicationMain 5 | @objc class AppDelegate: FlutterAppDelegate { 6 | override func application( 7 | _ application: UIApplication, 8 | didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]? 9 | ) -> Bool { 10 | GeneratedPluginRegistrant.register(with: self) 11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /example/android/app/src/main/java/com/webview/flutter_filereader_example/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.webview.flutter_filereader_example; 2 | 3 | import android.os.Bundle; 4 | import android.util.Log; 5 | 6 | import io.flutter.embedding.android.FlutterActivity; 7 | 8 | 9 | public class MainActivity extends FlutterActivity { 10 | @Override 11 | protected void onCreate(Bundle savedInstanceState) { 12 | super.onCreate(savedInstanceState); 13 | Log.e("FileReader", "v2 初始化"); 14 | } 15 | 16 | } -------------------------------------------------------------------------------- /example/android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /ios/.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | .vagrant/ 3 | .sconsign.dblite 4 | .svn/ 5 | 6 | .DS_Store 7 | *.swp 8 | profile 9 | 10 | DerivedData/ 11 | build/ 12 | GeneratedPluginRegistrant.h 13 | GeneratedPluginRegistrant.m 14 | 15 | .generated/ 16 | 17 | *.pbxuser 18 | *.mode1v3 19 | *.mode2v3 20 | *.perspectivev3 21 | 22 | !default.pbxuser 23 | !default.mode1v3 24 | !default.mode2v3 25 | !default.perspectivev3 26 | 27 | xcuserdata 28 | 29 | *.moved-aside 30 | 31 | *.pyc 32 | *sync/ 33 | Icon? 34 | .tags* 35 | 36 | /Flutter/Generated.xcconfig 37 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 3.0.0 2 | * support nullsafety 3 | * update tbs version 4 | * remove android READ_PHONE_STATE permission 5 | * remove android:networkSecurityConfig.you can config it in you project 6 | 7 | ## 2.2.0 8 | * fiexd some bug on Android 9 | * iOS support swift version 5.0 10 | 11 | ## 2.1.0 12 | * Android支持arm64位的机器 13 | 14 | 15 | ## 2.0.0 16 | * 插件支持1.12.x方式加载 17 | 18 | 19 | ## 1.0.0 20 | 21 | * 本地文件浏览的工具 22 | * IOS支持文件类型`docx,doc,xlsx,xls,pptx,ppt,pdf,txt,jpg,jpeg,png` 23 | * Android支持文件类型`docx,doc,xlsx,xls,pptx,ppt,pdf,txt` 24 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /example/android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def flutterProjectRoot = rootProject.projectDir.parentFile.toPath() 4 | 5 | def plugins = new Properties() 6 | def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins') 7 | if (pluginsFile.exists()) { 8 | pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) } 9 | } 10 | 11 | plugins.each { name, path -> 12 | def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile() 13 | include ":$name" 14 | project(":$name").projectDir = pluginDirectory 15 | } 16 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2019 shingohu 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. -------------------------------------------------------------------------------- /example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 12 | 13 | -------------------------------------------------------------------------------- /example/ios/Flutter/flutter_export_environment.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # This is a generated file; do not edit or check into version control. 3 | export "FLUTTER_ROOT=/Users/hujie/Develop/FlutterSDK/flutter-2.x" 4 | export "FLUTTER_APPLICATION_PATH=/Users/hujie/Develop/Flutter/flutter_filereader/example" 5 | export "FLUTTER_TARGET=lib/main.dart" 6 | export "FLUTTER_BUILD_DIR=build" 7 | export "SYMROOT=${SOURCE_ROOT}/../build/ios" 8 | export "FLUTTER_BUILD_NAME=1.3.6" 9 | export "FLUTTER_BUILD_NUMBER=11" 10 | export "DART_OBFUSCATION=false" 11 | export "TRACK_WIDGET_CREATION=false" 12 | export "TREE_SHAKE_ICONS=false" 13 | export "PACKAGE_CONFIG=.packages" 14 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /example/android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | google() 4 | jcenter() 5 | mavenCentral() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:4.2.1' 10 | } 11 | } 12 | 13 | allprojects { 14 | repositories { 15 | google() 16 | jcenter() 17 | mavenCentral() 18 | } 19 | } 20 | 21 | rootProject.buildDir = '../build' 22 | subprojects { 23 | project.buildDir = "${rootProject.buildDir}/${project.name}" 24 | } 25 | subprojects { 26 | project.evaluationDependsOn(':app') 27 | } 28 | 29 | task clean(type: Delete) { 30 | delete rootProject.buildDir 31 | } 32 | -------------------------------------------------------------------------------- /example/ios/.gitignore: -------------------------------------------------------------------------------- 1 | *.mode1v3 2 | *.mode2v3 3 | *.moved-aside 4 | *.pbxuser 5 | *.perspectivev3 6 | **/*sync/ 7 | .sconsign.dblite 8 | .tags* 9 | **/.vagrant/ 10 | **/DerivedData/ 11 | Icon? 12 | **/Pods/ 13 | **/.symlinks/ 14 | profile 15 | xcuserdata 16 | **/.generated/ 17 | Flutter/App.framework 18 | Flutter/Flutter.framework 19 | Flutter/Flutter.podspec 20 | Flutter/Generated.xcconfig 21 | Flutter/app.flx 22 | Flutter/app.zip 23 | Flutter/flutter_assets/ 24 | Flutter/flutter_export_environment.sh 25 | ServiceDefinitions.json 26 | Runner/GeneratedPluginRegistrant.* 27 | 28 | # Exceptions to above rules. 29 | !default.mode1v3 30 | !default.mode2v3 31 | !default.pbxuser 32 | !default.perspectivev3 33 | -------------------------------------------------------------------------------- /example/lib/file.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_filereader/flutter_filereader.dart'; 3 | 4 | class FileReaderPage extends StatefulWidget { 5 | final String? filePath; 6 | 7 | FileReaderPage({Key? key, required this.filePath}) : super(key: key); 8 | 9 | @override 10 | _FileReaderPageState createState() => _FileReaderPageState(); 11 | } 12 | 13 | class _FileReaderPageState extends State { 14 | @override 15 | Widget build(BuildContext context) { 16 | return Scaffold( 17 | appBar: AppBar( 18 | title: Text("文档"), 19 | ), 20 | body: FileReaderView( 21 | filePath: widget.filePath, 22 | ), 23 | ); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /ios/flutter_filereader.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html 3 | # 4 | Pod::Spec.new do |s| 5 | s.name = 'flutter_filereader' 6 | s.version = '0.0.1' 7 | s.summary = 'A new Flutter plugin.' 8 | s.description = <<-DESC 9 | A new Flutter plugin. 10 | DESC 11 | s.homepage = 'http://example.com' 12 | s.license = { :file => '../LICENSE' } 13 | s.author = { 'Your Company' => 'email@example.com' } 14 | s.source = { :path => '.' } 15 | s.source_files = 'Classes/**/*' 16 | s.public_header_files = 'Classes/**/*.h' 17 | s.dependency 'Flutter' 18 | s.swift_version= '5.0' 19 | 20 | s.ios.deployment_target = '8.0' 21 | end 22 | 23 | -------------------------------------------------------------------------------- /example/ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 8.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /example/android/app/src/main/java/com/webview/flutter_filereader_example/EmbedderV1Activity.java: -------------------------------------------------------------------------------- 1 | package com.webview.flutter_filereader_example; 2 | 3 | import android.os.Bundle; 4 | import android.util.Log; 5 | 6 | import com.baseflow.permissionhandler.PermissionHandlerPlugin; 7 | import com.webview.filereader.FlutterFileReaderPlugin; 8 | 9 | import io.flutter.app.FlutterActivity; 10 | import io.flutter.plugins.pathprovider.PathProviderPlugin; 11 | 12 | public class EmbedderV1Activity extends FlutterActivity { 13 | 14 | @Override 15 | protected void onCreate(Bundle savedInstanceState) { 16 | super.onCreate(savedInstanceState); 17 | Log.e("FileReader", "v1 初始化"); 18 | FlutterFileReaderPlugin.registerWith(registrarFor("wv.io/FileReader")); 19 | PermissionHandlerPlugin.registerWith(registrarFor("flutter.baseflow.com/permissions/methods")); 20 | PathProviderPlugin.registerWith(registrarFor("plugins.flutter.io/path_provider")); 21 | 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /ios/Classes/FileReaderFactory.swift: -------------------------------------------------------------------------------- 1 | // 2 | // FileReaderFactory.swift 3 | // flutter_filereader 4 | // 5 | // Created by 胡杰 on 2019/3/6. 6 | // 7 | 8 | import UIKit 9 | 10 | class FileReaderFactory: NSObject,FlutterPlatformViewFactory { 11 | 12 | var _messenger : FlutterBinaryMessenger? 13 | 14 | init(messenger : FlutterBinaryMessenger) { 15 | super.init() 16 | 17 | self._messenger = messenger 18 | 19 | 20 | } 21 | 22 | 23 | 24 | func createArgsCodec() -> FlutterMessageCodec & NSObjectProtocol { 25 | return FlutterStandardMessageCodec.sharedInstance() 26 | } 27 | 28 | 29 | 30 | 31 | 32 | func create(withFrame frame: CGRect, viewIdentifier viewId: Int64, arguments args: Any?) -> FlutterPlatformView { 33 | 34 | 35 | return FileReaderView(withFrame: frame, viewIdentifier: viewId, arguments: args, binaryMessenger: _messenger!) 36 | 37 | } 38 | 39 | 40 | } 41 | -------------------------------------------------------------------------------- /android/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 19 | 20 | 21 | 22 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | group 'com.webview.flutter_filereader' 2 | version '1.0-SNAPSHOT' 3 | buildscript { 4 | repositories { 5 | google() 6 | jcenter() 7 | mavenCentral() 8 | } 9 | 10 | dependencies { 11 | classpath 'com.android.tools.build:gradle:4.2.1' 12 | } 13 | } 14 | rootProject.allprojects { 15 | repositories { 16 | google() 17 | jcenter() 18 | mavenCentral() 19 | } 20 | } 21 | apply plugin: 'com.android.library' 22 | android { 23 | compileSdkVersion 28 24 | 25 | defaultConfig { 26 | minSdkVersion 16 27 | } 28 | lintOptions { 29 | disable 'InvalidPackage' 30 | } 31 | 32 | buildTypes { 33 | release { 34 | consumerProguardFiles 'proguard-rules.pro' 35 | } 36 | debug { 37 | consumerProguardFiles 'proguard-rules.pro' 38 | } 39 | } 40 | } 41 | 42 | dependencies { 43 | //43903开始 支持文件打开和webview,支持64位,修复稳定性问题 44 | //44065还没发布到厂库 45 | //api 'com.tencent.tbs.tbssdk:sdk:43939' 46 | 47 | api fileTree(include: ['*.jar'], dir: 'libs') 48 | 49 | } -------------------------------------------------------------------------------- /android/src/main/java/com/webview/filereader/X5FileReaderFactory.java: -------------------------------------------------------------------------------- 1 | package com.webview.filereader; 2 | 3 | import android.content.Context; 4 | 5 | import java.util.Map; 6 | 7 | import io.flutter.plugin.common.BinaryMessenger; 8 | import io.flutter.plugin.common.StandardMessageCodec; 9 | import io.flutter.plugin.platform.PlatformView; 10 | import io.flutter.plugin.platform.PlatformViewFactory; 11 | 12 | 13 | public class X5FileReaderFactory extends PlatformViewFactory { 14 | 15 | 16 | private final BinaryMessenger messenger; 17 | private FlutterFileReaderPlugin plugin; 18 | private Context mContext; 19 | 20 | 21 | public X5FileReaderFactory(BinaryMessenger messenger, Context context,FlutterFileReaderPlugin plugin) { 22 | super(StandardMessageCodec.INSTANCE); 23 | this.messenger = messenger; 24 | this.mContext = context; 25 | this.plugin = plugin; 26 | 27 | } 28 | 29 | @Override 30 | public PlatformView create(Context context, int i, Object args) { 31 | Map params = (Map) args; 32 | 33 | return new X5FileReaderView(mContext, messenger, i, params,plugin); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /android/src/main/java/com/webview/filereader/NetBroadcastReceiver.java: -------------------------------------------------------------------------------- 1 | package com.webview.filereader; 2 | 3 | import android.content.BroadcastReceiver; 4 | import android.content.Context; 5 | import android.content.Intent; 6 | import android.net.ConnectivityManager; 7 | import android.util.Log; 8 | 9 | 10 | /** 11 | * Created by hanbin on 2017/9/12. 12 | */ 13 | 14 | public class NetBroadcastReceiver extends BroadcastReceiver { 15 | 16 | public NetChangeListener listener; 17 | 18 | NetBroadcastReceiver(NetChangeListener listener) { 19 | this.listener = listener; 20 | } 21 | 22 | @Override 23 | public void onReceive(Context context, Intent intent) { 24 | 25 | // 如果相等的话就说明网络状态发生了变化 26 | Log.i("NetBroadcastReceiver", "NetBroadcastReceiver changed"); 27 | if (intent.getAction() != null && intent.getAction().equals(ConnectivityManager.CONNECTIVITY_ACTION)) { 28 | int netWorkState = NetUtil.getNetWorkState(context); 29 | // 当网络发生变化,判断当前网络状态,并通过NetEvent回调当前网络状态 30 | if (listener != null) { 31 | listener.onChangeListener(netWorkState); 32 | } 33 | } 34 | } 35 | 36 | // 自定义接口 37 | public interface NetChangeListener { 38 | void onChangeListener(int status); 39 | } 40 | 41 | } -------------------------------------------------------------------------------- /android/src/main/java/com/webview/filereader/NetUtil.java: -------------------------------------------------------------------------------- 1 | package com.webview.filereader; 2 | 3 | import android.content.Context; 4 | import android.net.ConnectivityManager; 5 | import android.net.NetworkInfo; 6 | 7 | /** 8 | * Created by hanbin on 2017/9/12. 9 | */ 10 | 11 | public class NetUtil { 12 | /** 13 | * 没有网络 14 | */ 15 | public static final int NETWORK_NONE = -1; 16 | /** 17 | * 移动网络 18 | */ 19 | public static final int NETWORK_MOBILE = 0; 20 | /** 21 | * 无线网络 22 | */ 23 | public static final int NETWORK_WIFI = 1; 24 | 25 | public static int getNetWorkState(Context context) { 26 | //得到连接管理器对象 27 | ConnectivityManager connectivityManager = (ConnectivityManager) context 28 | .getSystemService(Context.CONNECTIVITY_SERVICE); 29 | if (connectivityManager != null) { 30 | NetworkInfo activeNetworkInfo = connectivityManager 31 | .getActiveNetworkInfo(); 32 | //如果网络连接,判断该网络类型 33 | if (activeNetworkInfo != null && activeNetworkInfo.isConnected()) { 34 | if (activeNetworkInfo.getType() == (ConnectivityManager.TYPE_WIFI)) { 35 | return NETWORK_WIFI;//wifi 36 | } else if (activeNetworkInfo.getType() == (ConnectivityManager.TYPE_MOBILE)) { 37 | return NETWORK_MOBILE;//mobile 38 | } 39 | } else { 40 | //网络异常 41 | return NETWORK_NONE; 42 | } 43 | } 44 | return NETWORK_NONE; 45 | } 46 | } -------------------------------------------------------------------------------- /example/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # Visual Studio Code related 19 | .vscode/ 20 | 21 | # Flutter/Dart/Pub related 22 | **/doc/api/ 23 | .dart_tool/ 24 | .flutter-plugins 25 | .packages 26 | .pub-cache/ 27 | .pub/ 28 | /build/ 29 | 30 | # Android related 31 | **/android/**/gradle-wrapper.jar 32 | **/android/.gradle 33 | **/android/captures/ 34 | **/android/gradlew 35 | **/android/gradlew.bat 36 | **/android/local.properties 37 | **/android/**/GeneratedPluginRegistrant.java 38 | 39 | # iOS/XCode related 40 | **/ios/**/*.mode1v3 41 | **/ios/**/*.mode2v3 42 | **/ios/**/*.moved-aside 43 | **/ios/**/*.pbxuser 44 | **/ios/**/*.perspectivev3 45 | **/ios/**/*sync/ 46 | **/ios/**/.sconsign.dblite 47 | **/ios/**/.tags* 48 | **/ios/**/.vagrant/ 49 | **/ios/**/DerivedData/ 50 | **/ios/**/Icon? 51 | **/ios/**/Pods/ 52 | **/ios/**/.symlinks/ 53 | **/ios/**/profile 54 | **/ios/**/xcuserdata 55 | **/ios/.generated/ 56 | **/ios/Flutter/App.framework 57 | **/ios/Flutter/Flutter.framework 58 | **/ios/Flutter/Generated.xcconfig 59 | **/ios/Flutter/app.flx 60 | **/ios/Flutter/app.zip 61 | **/ios/Flutter/flutter_assets/ 62 | **/ios/ServiceDefinitions.json 63 | **/ios/Runner/GeneratedPluginRegistrant.* 64 | 65 | # Exceptions to above rules. 66 | !**/ios/**/default.mode1v3 67 | !**/ios/**/default.mode2v3 68 | !**/ios/**/default.pbxuser 69 | !**/ios/**/default.perspectivev3 70 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 71 | -------------------------------------------------------------------------------- /ios/Classes/SwiftFlutterFileReaderPlugin.swift: -------------------------------------------------------------------------------- 1 | import Flutter 2 | 3 | import UIKit 4 | 5 | 6 | let supportFileType = ["docx","doc","xlsx","xls","pptx","ppt","pdf","txt","jpg","jpeg","png"] 7 | 8 | public func isSupportOpen(fileType:String) -> Bool { 9 | if supportFileType.contains(fileType.lowercased()) { 10 | return true 11 | } 12 | return false 13 | } 14 | 15 | public func fileType(filePath:String?) -> String { 16 | var str = "" 17 | if filePath == nil { 18 | return str 19 | } 20 | if filePath!.isEmpty { 21 | return str 22 | } 23 | 24 | if let i = filePath!.lastIndex(of: ".") { 25 | str = filePath!.substring(from: String.Index.init(encodedOffset: (i.encodedOffset + 1))) 26 | } 27 | return str 28 | 29 | } 30 | 31 | 32 | public class SwiftFlutterFileReaderPlugin: NSObject, FlutterPlugin { 33 | 34 | static let channelName = "wv.io/FileReader" 35 | 36 | 37 | public static func register(with registrar: FlutterPluginRegistrar) { 38 | let channel = FlutterMethodChannel(name: channelName, binaryMessenger: registrar.messenger()) 39 | let instance = SwiftFlutterFileReaderPlugin() 40 | registrar.addMethodCallDelegate(instance, channel: channel) 41 | 42 | registrar.register(FileReaderFactory.init(messenger: registrar.messenger()), withId: "FileReader") 43 | 44 | } 45 | 46 | public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) { 47 | 48 | 49 | if call.method == "isLoad" { 50 | result(5) 51 | return 52 | } 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /example/ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /example/ios/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - Flutter (1.0.0) 3 | - flutter_filereader (0.0.1): 4 | - Flutter 5 | - path_provider (0.0.1): 6 | - Flutter 7 | - path_provider_linux (0.0.1): 8 | - Flutter 9 | - path_provider_macos (0.0.1): 10 | - Flutter 11 | - "permission_handler (5.0.1+1)": 12 | - Flutter 13 | 14 | DEPENDENCIES: 15 | - Flutter (from `.symlinks/flutter/ios`) 16 | - flutter_filereader (from `.symlinks/plugins/flutter_filereader/ios`) 17 | - path_provider (from `.symlinks/plugins/path_provider/ios`) 18 | - path_provider_linux (from `.symlinks/plugins/path_provider_linux/ios`) 19 | - path_provider_macos (from `.symlinks/plugins/path_provider_macos/ios`) 20 | - permission_handler (from `.symlinks/plugins/permission_handler/ios`) 21 | 22 | EXTERNAL SOURCES: 23 | Flutter: 24 | :path: ".symlinks/flutter/ios" 25 | flutter_filereader: 26 | :path: ".symlinks/plugins/flutter_filereader/ios" 27 | path_provider: 28 | :path: ".symlinks/plugins/path_provider/ios" 29 | path_provider_linux: 30 | :path: ".symlinks/plugins/path_provider_linux/ios" 31 | path_provider_macos: 32 | :path: ".symlinks/plugins/path_provider_macos/ios" 33 | permission_handler: 34 | :path: ".symlinks/plugins/permission_handler/ios" 35 | 36 | SPEC CHECKSUMS: 37 | Flutter: 0e3d915762c693b495b44d77113d4970485de6ec 38 | flutter_filereader: 0caefb23b8c96deca7c3679d3e61bfd8111a7d11 39 | path_provider: abfe2b5c733d04e238b0d8691db0cfd63a27a93c 40 | path_provider_linux: 4d630dc393e1f20364f3e3b4a2ff41d9674a84e4 41 | path_provider_macos: f760a3c5b04357c380e2fddb6f9db6f3015897e0 42 | permission_handler: eac8e15b4a1a3fba55b761d19f3f4e6b005d15b6 43 | 44 | PODFILE CHECKSUM: ebd43b443038e611b86ede96e613bd6033c49497 45 | 46 | COCOAPODS: 1.9.3 47 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Flutter FileReader 2 | [![pub package](https://img.shields.io/pub/v/flutter_filereader.svg)](https://pub.dartlang.org/packages/flutter_filereader) 3 | 4 | ##### A local file view widget,Support a variety of file types, such as Doc Eexcl PPT TXT and so on,Android is implemented by Tencent X5(Not Support GooglePlay),iOS is implemented by WKWebView 5 | 6 | 7 | ## Depend on it 8 | Add this to your package's pubspec.yaml file: 9 | 10 | 1.9.1 11 | ``` 12 | dependencies: 13 | flutter_filereader: ^1.0.0 14 | ``` 15 | 1.12.x 16 | ``` 17 | dependencies: 18 | flutter_filereader: ^2.2.0 19 | ``` 20 | 21 | 2.0.0 22 | ``` 23 | dependencies: 24 | flutter_filereader: 3.0.0 25 | ``` 26 | 27 | 28 | ## Support File Type 29 | * IOS `docx,doc,xlsx,xls,pptx,ppt,pdf,txt,jpg,jpeg,png` 30 | * Android `docx,doc,xlsx,xls,pptx,ppt,pdf,txt` 31 | 32 | ## Usage 33 | 34 | ### iOS 35 | Make sure you add the following key to Info.plist for iOS 36 | ``` 37 | io.flutter.embedded_views_preview 38 | ``` 39 | 40 | ### Example 41 | ``` 42 | import 'package:flutter/material.dart'; 43 | import 'package:flutter_filereader/flutter_filereader.dart'; 44 | 45 | class FileReaderPage extends StatefulWidget { 46 | final String filePath; 47 | 48 | FileReaderPage({Key: Key, this.filePath}); 49 | 50 | @override 51 | _FileReaderPageState createState() => _FileReaderPageState(); 52 | } 53 | 54 | class _FileReaderPageState extends State { 55 | @override 56 | Widget build(BuildContext context) { 57 | return Scaffold( 58 | appBar: AppBar( 59 | title: Text("doc"), 60 | ), 61 | body: FileReaderView( 62 | filePath: widget.filePath, 63 | ), 64 | ); 65 | } 66 | } 67 | ``` 68 | 69 | 70 | ## 注意事项 71 | 1. Not Support GooglePlay 72 | 2. 不支持在Android模拟器上运行 73 | 3. txt文档如果显示乱码,请将txt文档编码改成gbk 74 | 75 | -------------------------------------------------------------------------------- /lib/filereader.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/services.dart'; 2 | 3 | class FileReader { 4 | static FileReader _instance = FileReader._(); 5 | 6 | factory FileReader() => _getInstance(); 7 | 8 | static FileReader get instance => _getInstance(); 9 | 10 | static FileReader _getInstance() { 11 | return _instance; 12 | } 13 | 14 | static const MethodChannel _channel = const MethodChannel('wv.io/FileReader'); 15 | 16 | FileReader._(); 17 | 18 | //X5 engin load state 19 | // -1 loading 5 success 10 fail 20 | void engineLoadStatus(Function(bool)? loadCallback) async { 21 | _channel.invokeMethod("isLoad").then((status) { 22 | if (status == 5) { 23 | loadCallback?.call(true); 24 | } else if (status == 10) { 25 | loadCallback?.call(false); 26 | } else if (status == -1) { 27 | _channel.setMethodCallHandler((call) async { 28 | if (call.method == "onLoad") { 29 | int status = call.arguments; 30 | if (status == 5) { 31 | loadCallback?.call(true); 32 | } else if (status == 10) { 33 | loadCallback?.call(false); 34 | } 35 | } 36 | return; 37 | }); 38 | } 39 | }); 40 | } 41 | 42 | /// open file when platformview create 43 | /// filepath only support local path 44 | void openFile(int platformViewId, String filePath, Function(bool)? onOpen) { 45 | MethodChannel('wv.io/FileReader' + "_$platformViewId").invokeMethod("openFile", filePath).then((openSuccess) { 46 | onOpen?.call(openSuccess); 47 | }); 48 | } 49 | } 50 | 51 | enum FileReaderState { 52 | LOADING_ENGINE, //loading engine 53 | ENGINE_LOAD_SUCCESS, //loading engine success 54 | ENGINE_LOAD_FAIL, //loading engine fail (only Android ,ios,Ignore) 55 | UNSUPPORT_FILE, // not support file type 56 | FILE_NOT_FOUND, //file not found 57 | } 58 | -------------------------------------------------------------------------------- /example/.flutter-plugins-dependencies: -------------------------------------------------------------------------------- 1 | {"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"flutter_filereader","path":"/Users/hujie/Develop/Flutter/flutter_filereader/","dependencies":[]},{"name":"path_provider","path":"/Users/hujie/Develop/FlutterSDK/flutter-2.x/.pub-cache/hosted/pub.flutter-io.cn/path_provider-2.0.2/","dependencies":[]},{"name":"permission_handler","path":"/Users/hujie/Develop/FlutterSDK/flutter-2.x/.pub-cache/hosted/pub.flutter-io.cn/permission_handler-8.1.4/","dependencies":[]}],"android":[{"name":"flutter_filereader","path":"/Users/hujie/Develop/Flutter/flutter_filereader/","dependencies":[]},{"name":"path_provider","path":"/Users/hujie/Develop/FlutterSDK/flutter-2.x/.pub-cache/hosted/pub.flutter-io.cn/path_provider-2.0.2/","dependencies":[]},{"name":"permission_handler","path":"/Users/hujie/Develop/FlutterSDK/flutter-2.x/.pub-cache/hosted/pub.flutter-io.cn/permission_handler-8.1.4/","dependencies":[]}],"macos":[{"name":"path_provider_macos","path":"/Users/hujie/Develop/FlutterSDK/flutter-2.x/.pub-cache/hosted/pub.flutter-io.cn/path_provider_macos-2.0.0/","dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"/Users/hujie/Develop/FlutterSDK/flutter-2.x/.pub-cache/hosted/pub.flutter-io.cn/path_provider_linux-2.0.0/","dependencies":[]}],"windows":[{"name":"path_provider_windows","path":"/Users/hujie/Develop/FlutterSDK/flutter-2.x/.pub-cache/hosted/pub.flutter-io.cn/path_provider_windows-2.0.1/","dependencies":[]}],"web":[]},"dependencyGraph":[{"name":"flutter_filereader","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_macos","path_provider_linux","path_provider_windows"]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_macos","dependencies":[]},{"name":"path_provider_windows","dependencies":[]},{"name":"permission_handler","dependencies":[]}],"date_created":"2021-07-23 14:24:48.335235","version":"2.0.5"} -------------------------------------------------------------------------------- /example/ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | flutter_filereader_example 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | $(MARKETING_VERSION) 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(CURRENT_PROJECT_VERSION) 23 | LSRequiresIPhoneOS 24 | 25 | NSAppTransportSecurity 26 | 27 | NSAllowsArbitraryLoads 28 | 29 | 30 | UIBackgroundModes 31 | 32 | fetch 33 | remote-notification 34 | 35 | UILaunchStoryboardName 36 | LaunchScreen 37 | UIMainStoryboardFile 38 | Main 39 | UISupportedInterfaceOrientations 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationLandscapeLeft 43 | UIInterfaceOrientationLandscapeRight 44 | 45 | UISupportedInterfaceOrientations~ipad 46 | 47 | UIInterfaceOrientationPortrait 48 | UIInterfaceOrientationPortraitUpsideDown 49 | UIInterfaceOrientationLandscapeLeft 50 | UIInterfaceOrientationLandscapeRight 51 | 52 | UIViewControllerBasedStatusBarAppearance 53 | 54 | io.flutter.embedded_views_preview 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /ios/Classes/FileReaderView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // FileReaderView.swift 3 | // flutter_filereader 4 | // 5 | // Created by 胡杰 on 2019/3/6. 6 | // 7 | 8 | import UIKit 9 | import WebKit 10 | 11 | class FileReaderView: NSObject,FlutterPlatformView { 12 | 13 | var _webView: FileReaderWKWebView? 14 | 15 | 16 | 17 | 18 | 19 | init(withFrame frame: CGRect, viewIdentifier viewId: Int64, arguments args: Any?,binaryMessenger messenger: FlutterBinaryMessenger) { 20 | 21 | super.init() 22 | 23 | let channel = FlutterMethodChannel.init(name: "wv.io/FileReader_\(viewId)", binaryMessenger: messenger) 24 | 25 | channel.setMethodCallHandler { (call, result) in 26 | if call.method == "openFile" { 27 | if isSupportOpen(fileType: fileType(filePath: call.arguments as? String)){ 28 | 29 | self.openFile(filePath: call.arguments as! String) 30 | 31 | result(true) 32 | }else{ 33 | result(false) 34 | } 35 | return 36 | } 37 | if call.method == "canOpen" { 38 | result(isSupportOpen(fileType: fileType(filePath: call.arguments as? String))) 39 | return 40 | } 41 | 42 | } 43 | 44 | self._webView = FileReaderWKWebView.init(frame: frame) 45 | 46 | } 47 | 48 | 49 | func openFile(filePath:String) { 50 | 51 | let url = URL.init(fileURLWithPath: filePath) 52 | 53 | if #available(iOS 9.0, *) { 54 | _webView?.loadFileURL(url, allowingReadAccessTo: url) 55 | } else { 56 | let request = URLRequest.init(url: url) 57 | _webView?.load(request) 58 | } 59 | 60 | } 61 | 62 | 63 | 64 | 65 | 66 | 67 | func view() -> UIView { 68 | return _webView! 69 | } 70 | 71 | 72 | 73 | 74 | 75 | } 76 | -------------------------------------------------------------------------------- /example/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withReader('UTF-8') { reader -> 5 | localProperties.load(reader) 6 | } 7 | } 8 | 9 | def flutterRoot = localProperties.getProperty('flutter.sdk') 10 | if (flutterRoot == null) { 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 12 | } 13 | 14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 15 | if (flutterVersionCode == null) { 16 | flutterVersionCode = '1' 17 | } 18 | 19 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 20 | if (flutterVersionName == null) { 21 | flutterVersionName = '1.0' 22 | } 23 | 24 | apply plugin: 'com.android.application' 25 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 26 | 27 | android { 28 | compileSdkVersion 30 29 | 30 | lintOptions { 31 | disable 'InvalidPackage' 32 | } 33 | 34 | defaultConfig { 35 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 36 | applicationId "com.webview.filereaderdemo" 37 | minSdkVersion 16 38 | targetSdkVersion 30 39 | versionCode flutterVersionCode.toInteger() 40 | versionName flutterVersionName 41 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 42 | 43 | } 44 | 45 | buildTypes { 46 | release { 47 | minifyEnabled true 48 | shrinkResources true 49 | useProguard true 50 | signingConfig signingConfigs.debug 51 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 52 | } 53 | } 54 | } 55 | 56 | flutter { 57 | source '../..' 58 | } 59 | 60 | dependencies { 61 | testImplementation 'junit:junit:4.12' 62 | androidTestImplementation 'com.android.support.test:runner:1.0.2' 63 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' 64 | } 65 | -------------------------------------------------------------------------------- /example/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: flutter_filereader_example 2 | description: Demonstrates how to use the flutter_filereader plugin. 3 | publish_to: 'none' 4 | version: 1.3.6+11 5 | 6 | environment: 7 | sdk: ">=2.12.0 <3.0.0" 8 | flutter: ">=2.0.0 <3.0.0" 9 | 10 | dependencies: 11 | flutter: 12 | sdk: flutter 13 | 14 | # flutter_downloader: ^1.1.6 15 | 16 | path_provider: ^2.0.0 17 | 18 | permission_handler: 8.1.4 19 | oktoast: 3.0.0 20 | 21 | 22 | # The following adds the Cupertino Icons font to your application. 23 | # Use with the CupertinoIcons class for iOS style icons. 24 | cupertino_icons: 1.0.3 25 | 26 | dev_dependencies: 27 | flutter_test: 28 | sdk: flutter 29 | 30 | 31 | flutter_filereader: 32 | path: ../ 33 | 34 | # For information on the generic Dart part of this file, see the 35 | # following page: https://www.dartlang.org/tools/pub/pubspec 36 | 37 | # The following section is specific to Flutter. 38 | flutter: 39 | 40 | # The following line ensures that the Material Icons font is 41 | # included with your application, so that you can use the icons in 42 | # the material Icons class. 43 | uses-material-design: true 44 | 45 | # To add assets to your application, add an assets section, like this: 46 | assets: 47 | - assets/files/ 48 | # - images/a_dot_burr.jpeg 49 | # - images/a_dot_ham.jpeg 50 | 51 | # An image asset can refer to one or more resolution-specific "variants", see 52 | # https://flutter.io/assets-and-images/#resolution-aware. 53 | 54 | # For details regarding adding assets from package dependencies, see 55 | # https://flutter.io/assets-and-images/#from-packages 56 | 57 | # To add custom fonts to your application, add a fonts section here, 58 | # in this "flutter" section. Each entry in this list should have a 59 | # "family" key with the font family name, and a "fonts" key with a 60 | # list giving the asset and other descriptors for the font. For 61 | # example: 62 | # fonts: 63 | # - family: Schyler 64 | # fonts: 65 | # - asset: fonts/Schyler-Regular.ttf 66 | # - asset: fonts/Schyler-Italic.ttf 67 | # style: italic 68 | # - family: Trajan Pro 69 | # fonts: 70 | # - asset: fonts/TrajanPro.ttf 71 | # - asset: fonts/TrajanPro_Bold.ttf 72 | # weight: 700 73 | # 74 | # For details regarding fonts from package dependencies, 75 | # see https://flutter.io/custom-fonts/#from-packages 76 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: flutter_filereader 2 | description: A local file view widget,Support a variety of file types, such as Doc Eexcl PPT TXT and so on,Android is implemented by Tencent X5,iOS is implemented by WKWebView 3 | version: 3.0.0 4 | author: shingohu 5 | homepage: https://github.com/shingohu/flutter_filereader 6 | 7 | environment: 8 | sdk: ">=2.12.0 <3.0.0" 9 | flutter: ">=2.0.0 <3.0.0" 10 | 11 | dependencies: 12 | flutter: 13 | sdk: flutter 14 | 15 | dev_dependencies: 16 | flutter_test: 17 | sdk: flutter 18 | 19 | # For information on the generic Dart part of this file, see the 20 | # following page: https://www.dartlang.org/tools/pub/pubspec 21 | 22 | # The following section is specific to Flutter. 23 | flutter: 24 | # This section identifies this Flutter project as a plugin project. 25 | # The androidPackage and pluginClass identifiers should not ordinarily 26 | # be modified. They are used by the tooling to maintain consistency when 27 | # adding or updating assets for this project. 28 | plugin: 29 | platforms: 30 | android: 31 | package: com.webview.filereader 32 | pluginClass: FlutterFileReaderPlugin 33 | ios: 34 | pluginClass: FlutterFileReaderPlugin 35 | 36 | # To add assets to your plugin package, add an assets section, like this: 37 | # assets: 38 | # - images/a_dot_burr.jpeg 39 | # - images/a_dot_ham.jpeg 40 | # 41 | # For details regarding assets in packages, see 42 | # https://flutter.io/assets-and-images/#from-packages 43 | # 44 | # An image asset can refer to one or more resolution-specific "variants", see 45 | # https://flutter.io/assets-and-images/#resolution-aware. 46 | 47 | # To add custom fonts to your plugin package, add a fonts section here, 48 | # in this "flutter" section. Each entry in this list should have a 49 | # "family" key with the font family name, and a "fonts" key with a 50 | # list giving the asset and other descriptors for the font. For 51 | # example: 52 | # fonts: 53 | # - family: Schyler 54 | # fonts: 55 | # - asset: fonts/Schyler-Regular.ttf 56 | # - asset: fonts/Schyler-Italic.ttf 57 | # style: italic 58 | # - family: Trajan Pro 59 | # fonts: 60 | # - asset: fonts/TrajanPro.ttf 61 | # - asset: fonts/TrajanPro_Bold.ttf 62 | # weight: 700 63 | # 64 | # For details regarding fonts in packages, see 65 | # https://flutter.io/custom-fonts/#from-packages 66 | -------------------------------------------------------------------------------- /example/ios/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment this line to define a global platform for your project 2 | # platform :ios, '9.0' 3 | 4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 6 | 7 | project 'Runner', { 8 | 'Debug' => :debug, 9 | 'Profile' => :release, 10 | 'Release' => :release, 11 | } 12 | 13 | def parse_KV_file(file, separator='=') 14 | file_abs_path = File.expand_path(file) 15 | if !File.exists? file_abs_path 16 | return []; 17 | end 18 | pods_ary = [] 19 | skip_line_start_symbols = ["#", "/"] 20 | File.foreach(file_abs_path) { |line| 21 | next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ } 22 | plugin = line.split(pattern=separator) 23 | if plugin.length == 2 24 | podname = plugin[0].strip() 25 | path = plugin[1].strip() 26 | podpath = File.expand_path("#{path}", file_abs_path) 27 | pods_ary.push({:name => podname, :path => podpath}); 28 | else 29 | puts "Invalid plugin specification: #{line}" 30 | end 31 | } 32 | return pods_ary 33 | end 34 | 35 | target 'Runner' do 36 | use_frameworks! 37 | 38 | # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock 39 | # referring to absolute paths on developers' machines. 40 | system('rm -rf .symlinks') 41 | system('mkdir -p .symlinks/plugins') 42 | 43 | # Flutter Pods 44 | generated_xcode_build_settings = parse_KV_file('./Flutter/Generated.xcconfig') 45 | if generated_xcode_build_settings.empty? 46 | puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter packages get is executed first." 47 | end 48 | generated_xcode_build_settings.map { |p| 49 | if p[:name] == 'FLUTTER_FRAMEWORK_DIR' 50 | symlink = File.join('.symlinks', 'flutter') 51 | File.symlink(File.dirname(p[:path]), symlink) 52 | pod 'Flutter', :path => File.join(symlink, File.basename(p[:path])) 53 | end 54 | } 55 | 56 | # Plugin Pods 57 | plugin_pods = parse_KV_file('../.flutter-plugins') 58 | plugin_pods.map { |p| 59 | symlink = File.join('.symlinks', 'plugins', p[:name]) 60 | File.symlink(p[:path], symlink) 61 | pod p[:name], :path => File.join(symlink, 'ios') 62 | } 63 | end 64 | 65 | post_install do |installer| 66 | installer.pods_project.targets.each do |target| 67 | target.build_configurations.each do |config| 68 | config.build_settings['ENABLE_BITCODE'] = 'NO' 69 | end 70 | end 71 | end 72 | -------------------------------------------------------------------------------- /example/ios/Runner/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 9 | 14 | 21 | 25 | 28 | 29 | 30 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 45 | 46 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /android/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-App-20x20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-App-20x20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-App-29x29@1x.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-App-29x29@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "29x29", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-App-29x29@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-App-40x40@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "40x40", 41 | "idiom" : "iphone", 42 | "filename" : "Icon-App-40x40@3x.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "Icon-App-60x60@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "60x60", 53 | "idiom" : "iphone", 54 | "filename" : "Icon-App-60x60@3x.png", 55 | "scale" : "3x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "Icon-App-20x20@1x.png", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "size" : "20x20", 65 | "idiom" : "ipad", 66 | "filename" : "Icon-App-20x20@2x.png", 67 | "scale" : "2x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "Icon-App-29x29@1x.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "29x29", 77 | "idiom" : "ipad", 78 | "filename" : "Icon-App-29x29@2x.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "Icon-App-40x40@1x.png", 85 | "scale" : "1x" 86 | }, 87 | { 88 | "size" : "40x40", 89 | "idiom" : "ipad", 90 | "filename" : "Icon-App-40x40@2x.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "Icon-App-76x76@1x.png", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "size" : "76x76", 101 | "idiom" : "ipad", 102 | "filename" : "Icon-App-76x76@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "83.5x83.5", 107 | "idiom" : "ipad", 108 | "filename" : "Icon-App-83.5x83.5@2x.png", 109 | "scale" : "2x" 110 | }, 111 | { 112 | "size" : "1024x1024", 113 | "idiom" : "ios-marketing", 114 | "filename" : "Icon-App-1024x1024@1x.png", 115 | "scale" : "1x" 116 | } 117 | ], 118 | "info" : { 119 | "version" : 1, 120 | "author" : "xcode" 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /flutter_filereader.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 31 | 32 | 33 | 34 | 40 | 41 | 42 | 43 | 44 | 45 | 56 | 58 | 64 | 65 | 66 | 67 | 68 | 69 | 75 | 77 | 83 | 84 | 85 | 86 | 88 | 89 | 92 | 93 | 94 | -------------------------------------------------------------------------------- /.idea/codeStyles/Project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | xmlns:android 14 | 15 | ^$ 16 | 17 | 18 | 19 |
20 |
21 | 22 | 23 | 24 | xmlns:.* 25 | 26 | ^$ 27 | 28 | 29 | BY_NAME 30 | 31 |
32 |
33 | 34 | 35 | 36 | .*:id 37 | 38 | http://schemas.android.com/apk/res/android 39 | 40 | 41 | 42 |
43 |
44 | 45 | 46 | 47 | .*:name 48 | 49 | http://schemas.android.com/apk/res/android 50 | 51 | 52 | 53 |
54 |
55 | 56 | 57 | 58 | name 59 | 60 | ^$ 61 | 62 | 63 | 64 |
65 |
66 | 67 | 68 | 69 | style 70 | 71 | ^$ 72 | 73 | 74 | 75 |
76 |
77 | 78 | 79 | 80 | .* 81 | 82 | ^$ 83 | 84 | 85 | BY_NAME 86 | 87 |
88 |
89 | 90 | 91 | 92 | .* 93 | 94 | http://schemas.android.com/apk/res/android 95 | 96 | 97 | ANDROID_ATTRIBUTE_ORDER 98 | 99 |
100 |
101 | 102 | 103 | 104 | .* 105 | 106 | .* 107 | 108 | 109 | BY_NAME 110 | 111 |
112 |
113 |
114 |
115 |
116 |
-------------------------------------------------------------------------------- /lib/flutter_filereader.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | 3 | import 'package:flutter/cupertino.dart'; 4 | import 'package:flutter/foundation.dart'; 5 | import 'package:flutter/material.dart'; 6 | import 'package:flutter/services.dart'; 7 | import 'package:flutter_filereader/filereader.dart'; 8 | 9 | class FileReaderView extends StatefulWidget { 10 | final String? filePath; //local path 11 | final Function(bool)? openSuccess; 12 | final Widget? loadingWidget; 13 | final Widget? unSupportFileWidget; 14 | 15 | FileReaderView({Key? key, required this.filePath, this.openSuccess, this.loadingWidget, this.unSupportFileWidget}) : super(key: key); 16 | 17 | @override 18 | _FileReaderViewState createState() => _FileReaderViewState(); 19 | } 20 | 21 | class _FileReaderViewState extends State { 22 | FileReaderState _status = FileReaderState.LOADING_ENGINE; 23 | String? filePath; 24 | 25 | @override 26 | void initState() { 27 | super.initState(); 28 | filePath = widget.filePath; 29 | File(filePath!).exists().then((exists) { 30 | if (exists) { 31 | _checkOnLoad(); 32 | } else { 33 | _setStatus(FileReaderState.FILE_NOT_FOUND); 34 | } 35 | }); 36 | } 37 | 38 | _checkOnLoad() { 39 | FileReader.instance.engineLoadStatus((success) { 40 | if (success) { 41 | _setStatus(FileReaderState.ENGINE_LOAD_SUCCESS); 42 | } else { 43 | _setStatus(FileReaderState.ENGINE_LOAD_FAIL); 44 | } 45 | }); 46 | } 47 | 48 | _setStatus(FileReaderState status) { 49 | _status = status; 50 | if (mounted) { 51 | setState(() {}); 52 | } 53 | } 54 | 55 | @override 56 | Widget build(BuildContext context) { 57 | if (Platform.isAndroid || Platform.isIOS) { 58 | if (_status == FileReaderState.LOADING_ENGINE) { 59 | return _loadingWidget(); 60 | } else if (_status == FileReaderState.UNSUPPORT_FILE) { 61 | return _unSupportFile(); 62 | } else if (_status == FileReaderState.ENGINE_LOAD_SUCCESS) { 63 | if (Platform.isAndroid) { 64 | return _createAndroidView(); 65 | } else { 66 | return _createIosView(); 67 | } 68 | } else if (_status == FileReaderState.ENGINE_LOAD_FAIL) { 69 | return _enginLoadFail(); 70 | } else if (_status == FileReaderState.FILE_NOT_FOUND) { 71 | return _fileNotFoundFile(); 72 | } else { 73 | return _loadingWidget(); 74 | } 75 | } else { 76 | return Center(child: Text("不支持的平台")); 77 | } 78 | } 79 | 80 | Widget _unSupportFile() { 81 | return widget.unSupportFileWidget ?? 82 | Center( 83 | child: Text("不支持打开${_fileType(filePath!)}类型的文件"), 84 | ); 85 | } 86 | 87 | Widget _fileNotFoundFile() { 88 | return Center( 89 | child: Text("文件不存在"), 90 | ); 91 | } 92 | 93 | Widget _enginLoadFail() { 94 | //最有可能是abi的问题 95 | //还有可能第一次下载成功,但是加载不成功 96 | return Center( 97 | child: Text("引擎加载失败,请退出重试"), 98 | ); 99 | } 100 | 101 | Widget _loadingWidget() { 102 | return widget.loadingWidget ?? 103 | Center( 104 | child: CupertinoActivityIndicator(), 105 | ); 106 | } 107 | 108 | Widget _createAndroidView() { 109 | return AndroidView(viewType: "FileReader", onPlatformViewCreated: _onPlatformViewCreated, creationParamsCodec: StandardMessageCodec()); 110 | } 111 | 112 | _onPlatformViewCreated(int id) { 113 | FileReader.instance.openFile(id, filePath!, (success) { 114 | if (!success) { 115 | _setStatus(FileReaderState.UNSUPPORT_FILE); 116 | } 117 | widget.openSuccess?.call(success); 118 | }); 119 | } 120 | 121 | Widget _createIosView() { 122 | return UiKitView( 123 | viewType: "FileReader", 124 | onPlatformViewCreated: _onPlatformViewCreated, 125 | creationParamsCodec: StandardMessageCodec(), 126 | ); 127 | } 128 | 129 | String _fileType(String filePath) { 130 | if (filePath == null || filePath.isEmpty) { 131 | return ""; 132 | } 133 | int i = filePath.lastIndexOf('.'); 134 | if (i <= -1) { 135 | return ""; 136 | } 137 | return filePath.substring(i + 1); 138 | } 139 | } 140 | -------------------------------------------------------------------------------- /android/src/main/java/com/webview/filereader/X5FileReaderView.java: -------------------------------------------------------------------------------- 1 | package com.webview.filereader; 2 | 3 | import android.content.Context; 4 | import android.os.Bundle; 5 | import android.text.TextUtils; 6 | import android.util.Log; 7 | import android.view.View; 8 | import android.view.ViewGroup; 9 | 10 | import com.tencent.smtt.sdk.TbsReaderView; 11 | 12 | import java.io.File; 13 | import java.util.Map; 14 | 15 | import io.flutter.plugin.common.BinaryMessenger; 16 | import io.flutter.plugin.common.MethodCall; 17 | import io.flutter.plugin.common.MethodChannel; 18 | import io.flutter.plugin.platform.PlatformView; 19 | 20 | public class X5FileReaderView implements PlatformView, MethodChannel.MethodCallHandler, TbsReaderView.ReaderCallback { 21 | private MethodChannel methodChannel; 22 | private TbsReaderView readerView; 23 | 24 | private String tempPath; 25 | 26 | 27 | FlutterFileReaderPlugin plugin; 28 | 29 | 30 | X5FileReaderView(Context context, BinaryMessenger messenger, int id, Map params, FlutterFileReaderPlugin plugin) { 31 | this.plugin = plugin; 32 | tempPath = context.getCacheDir() + "/" + "TbsReaderTemp"; 33 | methodChannel = new MethodChannel(messenger, FlutterFileReaderPlugin.channelName + "_" + id); 34 | methodChannel.setMethodCallHandler(this); 35 | //这里的Context需要Activity 36 | readerView = new TbsReaderView(context, this); 37 | readerView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); 38 | 39 | } 40 | 41 | @Override 42 | public void onMethodCall(MethodCall methodCall, MethodChannel.Result result) { 43 | 44 | switch (methodCall.method) { 45 | case "openFile": 46 | if (isSupportFile((String) methodCall.arguments)) { 47 | openFile((String) methodCall.arguments); 48 | result.success(true); 49 | } else { 50 | // plugin.openFileByMiniQb((String) methodCall.arguments); 51 | result.success(false); 52 | } 53 | break; 54 | case "canOpen": 55 | result.success(isSupportFile((String) methodCall.arguments)); 56 | break; 57 | 58 | 59 | } 60 | } 61 | 62 | 63 | void openFile(String filePath) { 64 | if (isSupportFile(filePath)) { 65 | //增加下面一句解决没有TbsReaderTemp文件夹存在导致加载文件失败 66 | File bsReaderTempFile = new File(tempPath); 67 | if (!bsReaderTempFile.exists()) { 68 | bsReaderTempFile.mkdir(); 69 | } 70 | //加载文件 71 | Bundle localBundle = new Bundle(); 72 | localBundle.putString("filePath", filePath); 73 | localBundle.putBoolean("is_bar_show", false); 74 | localBundle.putBoolean("menu_show", false); 75 | localBundle.putBoolean("is_bar_animating", false); 76 | localBundle.putString("tempPath", tempPath); 77 | readerView.openFile(localBundle); 78 | } 79 | 80 | } 81 | 82 | 83 | boolean isSupportFile(String filePath) { 84 | return readerView.preOpen(getFileType(filePath), false); 85 | } 86 | 87 | /*** 88 | * 获取文件类型 89 | * 90 | * @param paramString 91 | * @return 92 | */ 93 | private String getFileType(String paramString) { 94 | String str = ""; 95 | 96 | if (TextUtils.isEmpty(paramString)) { 97 | 98 | return str; 99 | } 100 | 101 | int i = paramString.lastIndexOf('.'); 102 | if (i <= -1) { 103 | 104 | return str; 105 | } 106 | str = paramString.substring(i + 1); 107 | return str; 108 | } 109 | 110 | @Override 111 | public View getView() { 112 | return readerView; 113 | } 114 | 115 | @Override 116 | public void dispose() { 117 | Log.d("FileReader", "FileReader Close"); 118 | readerView.onStop(); 119 | methodChannel.setMethodCallHandler(null); 120 | methodChannel = null; 121 | readerView = null; 122 | } 123 | 124 | @Override 125 | public void onCallBackAction(Integer integer, Object o, Object o1) { 126 | 127 | } 128 | } 129 | -------------------------------------------------------------------------------- /example/lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | import 'dart:io'; 3 | 4 | import 'package:flutter/foundation.dart'; 5 | import 'package:flutter/material.dart'; 6 | import 'package:flutter/services.dart'; 7 | import 'package:flutter_filereader_example/file.dart'; 8 | import 'package:oktoast/oktoast.dart'; 9 | import 'package:path_provider/path_provider.dart'; 10 | import 'package:permission_handler/permission_handler.dart'; 11 | 12 | void main() => runApp(MyApp()); 13 | 14 | class MyApp extends StatefulWidget { 15 | @override 16 | _MyAppState createState() => _MyAppState(); 17 | } 18 | 19 | class _MyAppState extends State { 20 | @override 21 | void initState() { 22 | super.initState(); 23 | } 24 | 25 | @override 26 | Widget build(BuildContext context) { 27 | return OKToast( 28 | child: MaterialApp( 29 | home: HomePage(), 30 | ), 31 | ); 32 | } 33 | } 34 | 35 | class HomePage extends StatefulWidget { 36 | @override 37 | _HomePageState createState() => _HomePageState(); 38 | } 39 | 40 | class _HomePageState extends State { 41 | Map iosfiles = { 42 | "docx": "assets/files/docx.docx", // IOS test 43 | "doc": "assets/files/doc.doc", // IOS test 44 | "xlsx": "assets/files/xlsx.xlsx", // IOS test 45 | "xls": "assets/files/xls.xls", // IOS test 46 | "pptx": "assets/files/pptx.pptx", // IOS test 47 | "ppt": "assets/files/ppt.ppt", // IOS test 48 | "pdf": "assets/files/pdf.pdf", // IOS test 49 | "txt": "assets/files/txt.txt", // IOS test 50 | "jpg": "assets/files/jpg.jpg", // 51 | "jpeg": "assets/files/jpeg1.jpeg", // 52 | "png": "assets/files/png.png", // 53 | }; 54 | 55 | Map androidfiles = { 56 | "docx": "assets/files/docx.docx", // android test 57 | "doc": "assets/files/doc.doc", // android test 58 | "xlsx": "assets/files/xlsx.xlsx", // android test 59 | "xls": "assets/files/xls.xls", // android test 60 | "pptx": "assets/files/pptx.pptx", // android test 61 | "ppt": "assets/files/ppt.ppt", // android test 62 | "pdf": "assets/files/pdf.pdf", // android test 63 | "txt": "assets/files/txt.txt" // android test 64 | }; 65 | 66 | Map files = {}; 67 | 68 | @override 69 | void initState() { 70 | if (Platform.isAndroid) { 71 | files = androidfiles; 72 | } else if (Platform.isIOS) { 73 | files = iosfiles; 74 | } 75 | super.initState(); 76 | } 77 | 78 | @override 79 | Widget build(BuildContext context) { 80 | return Scaffold( 81 | appBar: AppBar( 82 | title: const Text('File Reader'), 83 | ), 84 | body: ListView.builder( 85 | itemBuilder: (ctx, index) { 86 | return item(files.keys.elementAt(index), files.values.elementAt(index)); 87 | }, 88 | itemCount: files.length, 89 | ), 90 | ); 91 | } 92 | 93 | item(String type, String path) { 94 | return GestureDetector( 95 | onTap: () { 96 | onTap(type, path); 97 | }, 98 | child: Container( 99 | alignment: Alignment.center, 100 | height: 50, 101 | margin: EdgeInsetsDirectional.only(bottom: 5), 102 | color: Colors.blue, 103 | child: Center( 104 | child: Text( 105 | type, 106 | style: TextStyle(color: Colors.white, fontSize: 20), 107 | ), 108 | ), 109 | ), 110 | ); 111 | } 112 | 113 | onTap(String type, String assetPath) async { 114 | bool isGranted = await Permission.storage.isGranted; 115 | if (!isGranted) { 116 | isGranted = (await Permission.storage.request()).isGranted; 117 | if (!isGranted) { 118 | showToast("NO Storage Permission"); 119 | return; 120 | } 121 | } 122 | String localPath = await fileLocalName(type, assetPath); 123 | if (!await File(localPath).exists()) { 124 | if (!await asset2Local(type, assetPath)) { 125 | return; 126 | } 127 | } 128 | Navigator.of(context).push(MaterialPageRoute(builder: (ctx) { 129 | return FileReaderPage( 130 | filePath: localPath, 131 | ); 132 | })); 133 | } 134 | 135 | fileLocalName(String type, String assetPath) async { 136 | String dic = await _localSavedDir() + "/filereader/files/"; 137 | return dic + base64.encode(utf8.encode(assetPath)) + "." + type; 138 | } 139 | 140 | fileExists(String type, String assetPath) async { 141 | String fileName = await fileLocalName(type, assetPath); 142 | if (await File(fileName).exists()) { 143 | return true; 144 | } 145 | return false; 146 | } 147 | 148 | asset2Local(String type, String assetPath) async { 149 | if (Platform.isAndroid) { 150 | if (!await Permission.storage.isGranted) { 151 | debugPrint("没有存储权限"); 152 | return false; 153 | } 154 | } 155 | 156 | File file = File(await fileLocalName(type, assetPath)); 157 | if (await fileExists(type, assetPath)) { 158 | await file.delete(); 159 | } 160 | await file.create(recursive: true); 161 | //await file.create(); 162 | debugPrint("文件路径->" + file.path); 163 | ByteData bd = await rootBundle.load(assetPath); 164 | await file.writeAsBytes(bd.buffer.asUint8List(), flush: true); 165 | return true; 166 | } 167 | 168 | _localSavedDir() async { 169 | Directory? dic; 170 | if (defaultTargetPlatform == TargetPlatform.android) { 171 | dic = await getExternalStorageDirectory(); 172 | } else if (defaultTargetPlatform == TargetPlatform.iOS) { 173 | dic = await getApplicationDocumentsDirectory(); 174 | } 175 | return dic?.path; 176 | } 177 | } 178 | -------------------------------------------------------------------------------- /android/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # Attempt to set APP_HOME 46 | # Resolve links: $0 may be a link 47 | PRG="$0" 48 | # Need this for relative symlinks. 49 | while [ -h "$PRG" ] ; do 50 | ls=`ls -ld "$PRG"` 51 | link=`expr "$ls" : '.*-> \(.*\)$'` 52 | if expr "$link" : '/.*' > /dev/null; then 53 | PRG="$link" 54 | else 55 | PRG=`dirname "$PRG"`"/$link" 56 | fi 57 | done 58 | SAVED="`pwd`" 59 | cd "`dirname \"$PRG\"`/" >/dev/null 60 | APP_HOME="`pwd -P`" 61 | cd "$SAVED" >/dev/null 62 | 63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 64 | 65 | # Determine the Java command to use to start the JVM. 66 | if [ -n "$JAVA_HOME" ] ; then 67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 68 | # IBM's JDK on AIX uses strange locations for the executables 69 | JAVACMD="$JAVA_HOME/jre/sh/java" 70 | else 71 | JAVACMD="$JAVA_HOME/bin/java" 72 | fi 73 | if [ ! -x "$JAVACMD" ] ; then 74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 75 | 76 | Please set the JAVA_HOME variable in your environment to match the 77 | location of your Java installation." 78 | fi 79 | else 80 | JAVACMD="java" 81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 82 | 83 | Please set the JAVA_HOME variable in your environment to match the 84 | location of your Java installation." 85 | fi 86 | 87 | # Increase the maximum file descriptors if we can. 88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 89 | MAX_FD_LIMIT=`ulimit -H -n` 90 | if [ $? -eq 0 ] ; then 91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 92 | MAX_FD="$MAX_FD_LIMIT" 93 | fi 94 | ulimit -n $MAX_FD 95 | if [ $? -ne 0 ] ; then 96 | warn "Could not set maximum file descriptor limit: $MAX_FD" 97 | fi 98 | else 99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 100 | fi 101 | fi 102 | 103 | # For Darwin, add options to specify how the application appears in the dock 104 | if $darwin; then 105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 106 | fi 107 | 108 | # For Cygwin, switch paths to Windows format before running java 109 | if $cygwin ; then 110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 112 | JAVACMD=`cygpath --unix "$JAVACMD"` 113 | 114 | # We build the pattern for arguments to be converted via cygpath 115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 116 | SEP="" 117 | for dir in $ROOTDIRSRAW ; do 118 | ROOTDIRS="$ROOTDIRS$SEP$dir" 119 | SEP="|" 120 | done 121 | OURCYGPATTERN="(^($ROOTDIRS))" 122 | # Add a user-defined pattern to the cygpath arguments 123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 125 | fi 126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 127 | i=0 128 | for arg in "$@" ; do 129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 131 | 132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 134 | else 135 | eval `echo args$i`="\"$arg\"" 136 | fi 137 | i=$((i+1)) 138 | done 139 | case $i in 140 | (0) set -- ;; 141 | (1) set -- "$args0" ;; 142 | (2) set -- "$args0" "$args1" ;; 143 | (3) set -- "$args0" "$args1" "$args2" ;; 144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 150 | esac 151 | fi 152 | 153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 154 | function splitJvmOpts() { 155 | JVM_OPTS=("$@") 156 | } 157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 159 | 160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 161 | -------------------------------------------------------------------------------- /android/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | 2 | 3 | -keep class com.webview.filereader.**{*;} 4 | 5 | -dontoptimize 6 | -dontusemixedcaseclassnames 7 | -verbose 8 | -dontskipnonpubliclibraryclasses 9 | -dontskipnonpubliclibraryclassmembers 10 | -dontwarn dalvik.** 11 | -dontwarn com.tencent.smtt.** 12 | #-overloadaggressively 13 | 14 | # ------------------ Keep LineNumbers and properties ---------------- # 15 | -keepattributes Exceptions,InnerClasses,Signature,Deprecated,SourceFile,LineNumberTable,*Annotation*,EnclosingMethod 16 | # -------------------------------------------------------------------------- 17 | 18 | # Addidional for x5.sdk classes for apps 19 | 20 | -keep class com.tencent.smtt.export.external.**{ 21 | *; 22 | } 23 | 24 | -keep class com.tencent.tbs.video.interfaces.IUserStateChangedListener { 25 | *; 26 | } 27 | 28 | -keep class com.tencent.smtt.sdk.CacheManager { 29 | public *; 30 | } 31 | 32 | -keep class com.tencent.smtt.sdk.CookieManager { 33 | public *; 34 | } 35 | 36 | -keep class com.tencent.smtt.sdk.WebHistoryItem { 37 | public *; 38 | } 39 | 40 | -keep class com.tencent.smtt.sdk.WebViewDatabase { 41 | public *; 42 | } 43 | 44 | -keep class com.tencent.smtt.sdk.WebBackForwardList { 45 | public *; 46 | } 47 | 48 | -keep public class com.tencent.smtt.sdk.WebView { 49 | public ; 50 | public ; 51 | } 52 | 53 | -keep public class com.tencent.smtt.sdk.WebView$HitTestResult { 54 | public static final ; 55 | public java.lang.String getExtra(); 56 | public int getType(); 57 | } 58 | 59 | -keep public class com.tencent.smtt.sdk.WebView$WebViewTransport { 60 | public ; 61 | } 62 | 63 | -keep public class com.tencent.smtt.sdk.WebView$PictureListener { 64 | public ; 65 | public ; 66 | } 67 | 68 | 69 | -keepattributes InnerClasses 70 | 71 | -keep public enum com.tencent.smtt.sdk.WebSettings$** { 72 | *; 73 | } 74 | 75 | -keep public enum com.tencent.smtt.sdk.QbSdk$** { 76 | *; 77 | } 78 | 79 | -keep public class com.tencent.smtt.sdk.WebSettings { 80 | public *; 81 | } 82 | 83 | 84 | -keepattributes Signature 85 | -keep public class com.tencent.smtt.sdk.ValueCallback { 86 | public ; 87 | public ; 88 | } 89 | 90 | -keep public class com.tencent.smtt.sdk.WebViewClient { 91 | public ; 92 | public ; 93 | } 94 | 95 | -keep public class com.tencent.smtt.sdk.DownloadListener { 96 | public ; 97 | public ; 98 | } 99 | 100 | -keep public class com.tencent.smtt.sdk.WebChromeClient { 101 | public ; 102 | public ; 103 | } 104 | 105 | -keep public class com.tencent.smtt.sdk.WebChromeClient$FileChooserParams { 106 | public ; 107 | public ; 108 | } 109 | 110 | -keep class com.tencent.smtt.sdk.SystemWebChromeClient{ 111 | public *; 112 | } 113 | # 1. extension interfaces should be apparent 114 | -keep public class com.tencent.smtt.export.external.extension.interfaces.* { 115 | public protected *; 116 | } 117 | 118 | # 2. interfaces should be apparent 119 | -keep public class com.tencent.smtt.export.external.interfaces.* { 120 | public protected *; 121 | } 122 | 123 | -keep public class com.tencent.smtt.sdk.WebViewCallbackClient { 124 | public protected *; 125 | } 126 | 127 | -keep public class com.tencent.smtt.sdk.WebStorage$QuotaUpdater { 128 | public ; 129 | public ; 130 | } 131 | 132 | -keep public class com.tencent.smtt.sdk.WebIconDatabase { 133 | public ; 134 | public ; 135 | } 136 | 137 | -keep public class com.tencent.smtt.sdk.WebStorage { 138 | public ; 139 | public ; 140 | } 141 | 142 | -keep public class com.tencent.smtt.sdk.DownloadListener { 143 | public ; 144 | public ; 145 | } 146 | 147 | -keep public class com.tencent.smtt.sdk.QbSdk { 148 | public ; 149 | public ; 150 | } 151 | 152 | -keep public class com.tencent.smtt.sdk.QbSdk$PreInitCallback { 153 | public ; 154 | public ; 155 | } 156 | -keep public class com.tencent.smtt.sdk.CookieSyncManager { 157 | public ; 158 | public ; 159 | } 160 | 161 | -keep public class com.tencent.smtt.sdk.Tbs* { 162 | public ; 163 | public ; 164 | } 165 | 166 | -keep public class com.tencent.smtt.utils.LogFileUtils { 167 | public ; 168 | public ; 169 | } 170 | 171 | -keep public class com.tencent.smtt.utils.TbsLog { 172 | public ; 173 | public ; 174 | } 175 | 176 | -keep public class com.tencent.smtt.utils.TbsLogClient { 177 | public ; 178 | public ; 179 | } 180 | 181 | -keep public class com.tencent.smtt.sdk.CookieSyncManager { 182 | public ; 183 | public ; 184 | } 185 | 186 | # Added for game demos 187 | -keep public class com.tencent.smtt.sdk.TBSGamePlayer { 188 | public ; 189 | public ; 190 | } 191 | 192 | -keep public class com.tencent.smtt.sdk.TBSGamePlayerClient* { 193 | public ; 194 | public ; 195 | } 196 | 197 | -keep public class com.tencent.smtt.sdk.TBSGamePlayerClientExtension { 198 | public ; 199 | public ; 200 | } 201 | 202 | -keep public class com.tencent.smtt.sdk.TBSGamePlayerService* { 203 | public ; 204 | public ; 205 | } 206 | 207 | -keep public class com.tencent.smtt.utils.Apn { 208 | public ; 209 | public ; 210 | } 211 | -keep class com.tencent.smtt.** { 212 | *; 213 | } 214 | # end 215 | 216 | 217 | -keep public class com.tencent.smtt.export.external.extension.proxy.ProxyWebViewClientExtension { 218 | public ; 219 | public ; 220 | } 221 | 222 | -keep class MTT.ThirdAppInfoNew { 223 | *; 224 | } 225 | 226 | -keep class com.tencent.mtt.MttTraceEvent { 227 | *; 228 | } 229 | 230 | # Game related 231 | -keep public class com.tencent.smtt.gamesdk.* { 232 | public protected *; 233 | } 234 | 235 | -keep public class com.tencent.smtt.sdk.TBSGameBooter { 236 | public ; 237 | public ; 238 | } 239 | 240 | -keep public class com.tencent.smtt.sdk.TBSGameBaseActivity { 241 | public protected *; 242 | } 243 | 244 | -keep public class com.tencent.smtt.sdk.TBSGameBaseActivityProxy { 245 | public protected *; 246 | } 247 | 248 | -keep public class com.tencent.smtt.gamesdk.internal.TBSGameServiceClient { 249 | public *; 250 | } 251 | #--------------------------------------------------------------------------- 252 | 253 | 254 | #------------------ 下方是android平台自带的排除项,这里不要动 ---------------- 255 | 256 | -keep public class * extends android.app.Activity{ 257 | public ; 258 | public ; 259 | } 260 | -keep public class * extends android.app.Application 261 | { 262 | public ; 263 | public ; 264 | } 265 | -keep public class * extends android.app.Service 266 | -keep public class * extends android.content.BroadcastReceiver 267 | -keep public class * extends android.content.ContentProvider 268 | -keep public class * extends android.app.backup.BackupAgentHelper 269 | -keep public class * extends android.preference.Preference 270 | 271 | -keepclassmembers enum * { 272 | public static **[] values(); 273 | public static ** valueOf(java.lang.String); 274 | } 275 | 276 | -keepclasseswithmembers class * { 277 | public (android.content.Context, android.util.AttributeSet); 278 | } 279 | 280 | -keepclasseswithmembers class * { 281 | public (android.content.Context, android.util.AttributeSet, int); 282 | } 283 | 284 | -keepattributes *Annotation* 285 | 286 | -keepclasseswithmembernames class *{ 287 | native ; 288 | } 289 | 290 | -keep class * implements android.os.Parcelable { 291 | public static final android.os.Parcelable$Creator *; 292 | } 293 | 294 | #------------------ 下方是共性的排除项目 ---------------- 295 | # 方法名中含有“JNI”字符的,认定是Java Native Interface方法,自动排除 296 | # 方法名中含有“JRI”字符的,认定是Java Reflection Interface方法,自动排除 297 | 298 | -keepclasseswithmembers class * { 299 | ... *JNI*(...); 300 | } 301 | 302 | -keepclasseswithmembernames class * { 303 | ... *JRI*(...); 304 | } 305 | 306 | -keep class **JNI* {*;} 307 | -------------------------------------------------------------------------------- /android/src/main/java/com/webview/filereader/FlutterFileReaderPlugin.java: -------------------------------------------------------------------------------- 1 | package com.webview.filereader; 2 | 3 | import android.content.Context; 4 | import android.content.IntentFilter; 5 | import android.os.Handler; 6 | import android.os.Looper; 7 | import android.os.Message; 8 | import android.util.Log; 9 | 10 | import com.tencent.smtt.export.external.TbsCoreSettings; 11 | import com.tencent.smtt.sdk.QbSdk; 12 | import com.tencent.smtt.sdk.ReaderWizard; 13 | import com.tencent.smtt.sdk.TbsListener; 14 | import com.tencent.smtt.sdk.TbsReaderView; 15 | import com.tencent.smtt.sdk.ValueCallback; 16 | 17 | import java.lang.reflect.Field; 18 | import java.util.HashMap; 19 | 20 | import io.flutter.embedding.engine.plugins.FlutterPlugin; 21 | import io.flutter.embedding.engine.plugins.activity.ActivityAware; 22 | import io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding; 23 | import io.flutter.plugin.common.BinaryMessenger; 24 | import io.flutter.plugin.common.MethodCall; 25 | import io.flutter.plugin.common.MethodChannel; 26 | import io.flutter.plugin.common.PluginRegistry.Registrar; 27 | 28 | /** 29 | * FlutterX5Plugin 30 | */ 31 | public class FlutterFileReaderPlugin implements MethodChannel.MethodCallHandler, FlutterPlugin, ActivityAware { 32 | 33 | private int x5LoadStatus = -1; // -1 未加载状态 5 成功 10 失败 34 | 35 | public static final String channelName = "wv.io/FileReader"; 36 | private Context ctx; 37 | private MethodChannel methodChannel; 38 | private NetBroadcastReceiver netBroadcastReceiver; 39 | private FlutterPluginBinding pluginBinding; 40 | private QbSdkPreInitCallback preInitCallback; 41 | 42 | private Handler mainHandler = new Handler(Looper.getMainLooper(), new Handler.Callback() { 43 | @Override 44 | public boolean handleMessage(Message msg) { 45 | if (msg.what == 100) { 46 | if (methodChannel != null) { 47 | methodChannel.invokeMethod("onLoad", isLoadX5()); 48 | } 49 | } 50 | return false; 51 | } 52 | }); 53 | 54 | 55 | private void init(Context context, BinaryMessenger messenger) { 56 | ctx = context; 57 | methodChannel = new MethodChannel(messenger, channelName); 58 | methodChannel.setMethodCallHandler(this); 59 | // initX5(context); 60 | netBroadcastRegister(context); 61 | } 62 | 63 | public FlutterFileReaderPlugin() { 64 | 65 | } 66 | 67 | private void onDestory() { 68 | Log.e("FileReader", "销毁"); 69 | if (netBroadcastReceiver != null && ctx != null) { 70 | ctx.unregisterReceiver(netBroadcastReceiver); 71 | } 72 | preInitCallback = null; 73 | ctx = null; 74 | mainHandler.removeCallbacksAndMessages(null); 75 | mainHandler = null; 76 | methodChannel = null; 77 | pluginBinding = null; 78 | } 79 | 80 | 81 | /** 82 | * Plugin registration. 83 | */ 84 | public static void registerWith(Registrar registrar) { 85 | FlutterFileReaderPlugin plugin = new FlutterFileReaderPlugin(); 86 | plugin.init(registrar.context(), registrar.messenger()); 87 | registrar.platformViewRegistry().registerViewFactory("FileReader", new X5FileReaderFactory(registrar.messenger(), registrar.activity(), plugin)); 88 | } 89 | 90 | 91 | public void netBroadcastRegister(final Context context) { 92 | //实例化IntentFilter对象 93 | IntentFilter filter = new IntentFilter(); 94 | filter.addAction("android.net.conn.CONNECTIVITY_CHANGE"); 95 | netBroadcastReceiver = new NetBroadcastReceiver(new NetBroadcastReceiver.NetChangeListener() { 96 | @Override 97 | public void onChangeListener(int status) { 98 | // -1 没有网络 99 | if (x5LoadStatus != 5 && status != -1) { 100 | initX5(context); 101 | } 102 | } 103 | }); 104 | //注册广播接收 105 | context.registerReceiver(netBroadcastReceiver, filter); 106 | 107 | 108 | } 109 | 110 | 111 | public void initX5(final Context context) { 112 | Log.e("FileReader", "初始化X5"); 113 | ///不获取AndroidID 114 | QbSdk.canGetAndroidId(false); 115 | ///不获取设备IMEI 116 | QbSdk.canGetDeviceId(false); 117 | ///不获取IMSI 118 | QbSdk.canGetSubscriberId(false); 119 | 120 | if (!QbSdk.canLoadX5(context)) { 121 | //重要 122 | QbSdk.reset(context); 123 | } 124 | 125 | preInitCallback = new QbSdkPreInitCallback(); 126 | // 在调用TBS初始化、创建WebView之前进行如下配置,以开启优化方案 127 | HashMap map = new HashMap(); 128 | map.put(TbsCoreSettings.TBS_SETTINGS_USE_SPEEDY_CLASSLOADER, true); 129 | map.put(TbsCoreSettings.TBS_SETTINGS_USE_DEXLOADER_SERVICE, true); 130 | QbSdk.initTbsSettings(map); 131 | QbSdk.setNeedInitX5FirstTime(true); 132 | QbSdk.setDownloadWithoutWifi(true); 133 | QbSdk.setTbsListener(new TbsListener() { 134 | @Override 135 | public void onDownloadFinish(int i) { 136 | Log.e("FileReader", "TBS下载完成" + i); 137 | } 138 | 139 | @Override 140 | public void onInstallFinish(int i) { 141 | Log.e("FileReader", "TBS安装完成 " + i); 142 | } 143 | 144 | @Override 145 | public void onDownloadProgress(int i) { 146 | Log.e("FileReader", "TBS下载进度:" + i); 147 | } 148 | }); 149 | QbSdk.initX5Environment(context, preInitCallback); 150 | } 151 | 152 | @Override 153 | public void onMethodCall(MethodCall methodCall, final MethodChannel.Result result) { 154 | if ("isLoad".equals(methodCall.method)) { 155 | result.success(isLoadX5()); 156 | } else if ("openFileByMiniQb".equals(methodCall.method)) { 157 | String filePath = (String) methodCall.arguments; 158 | result.success(openFileByMiniQb(filePath)); 159 | } 160 | } 161 | 162 | public boolean openFileByMiniQb(String filePath) { 163 | if (ctx != null) { 164 | HashMap params = new HashMap(); 165 | params.put("style", "1"); 166 | params.put("local", "false"); 167 | 168 | QbSdk.openFileReader(ctx, filePath, params, new ValueCallback() { 169 | @Override 170 | public void onReceiveValue(String s) { 171 | Log.d("FileReader", "openFileReader->" + s); 172 | } 173 | }); 174 | 175 | 176 | } 177 | return true; 178 | } 179 | 180 | 181 | private void onX5LoadComplete() { 182 | mainHandler.sendEmptyMessage(100); 183 | } 184 | 185 | 186 | int isLoadX5() { 187 | 188 | if (ctx != null && QbSdk.canLoadX5(ctx)) { 189 | x5LoadStatus = 5; 190 | } 191 | return x5LoadStatus; 192 | } 193 | 194 | @Override 195 | public void onAttachedToEngine(FlutterPluginBinding binding) { 196 | Log.e("FileReader", "onAttachedToEngine"); 197 | 198 | pluginBinding = binding; 199 | } 200 | 201 | @Override 202 | public void onDetachedFromEngine(FlutterPluginBinding binding) { 203 | Log.e("FileReader", "onDetachedFromEngine"); 204 | onDestory(); 205 | } 206 | 207 | @Override 208 | public void onAttachedToActivity(ActivityPluginBinding binding) { 209 | Log.e("FileReader", "onAttachedToActivity"); 210 | init(pluginBinding.getApplicationContext(), pluginBinding.getBinaryMessenger()); 211 | pluginBinding.getPlatformViewRegistry().registerViewFactory("FileReader", new X5FileReaderFactory(pluginBinding.getBinaryMessenger(), binding.getActivity(), this)); 212 | } 213 | 214 | @Override 215 | public void onDetachedFromActivityForConfigChanges() { 216 | Log.e("FileReader", "onDetachedFromActivityForConfigChanges"); 217 | } 218 | 219 | @Override 220 | public void onReattachedToActivityForConfigChanges(ActivityPluginBinding binding) { 221 | Log.e("FileReader", "onReattachedToActivityForConfigChanges"); 222 | } 223 | 224 | @Override 225 | public void onDetachedFromActivity() { 226 | Log.e("FileReader", "onDetachedFromActivity"); 227 | } 228 | 229 | 230 | class QbSdkPreInitCallback implements QbSdk.PreInitCallback { 231 | 232 | @Override 233 | public void onCoreInitFinished() { 234 | Log.e("FileReader", "TBS内核初始化结束"); 235 | } 236 | 237 | @Override 238 | public void onViewInitFinished(boolean b) { 239 | if (ctx == null) { 240 | return; 241 | } 242 | if (b) { 243 | x5LoadStatus = 5; 244 | Log.e("FileReader", "TBS内核初始化成功" + "--" + QbSdk.canLoadX5(ctx)); 245 | } else { 246 | x5LoadStatus = 10; 247 | resetQbSdkInit(); 248 | Log.e("FileReader", "TBS内核初始化失败" + "--" + QbSdk.canLoadX5(ctx)); 249 | } 250 | onX5LoadComplete(); 251 | } 252 | } 253 | 254 | 255 | ///反射 重置初始化状态(没网情况下加载失败) 256 | private void resetQbSdkInit() { 257 | try { 258 | Field field = QbSdk.class.getDeclaredField("s"); 259 | field.setAccessible(true); 260 | field.setBoolean(null, false); 261 | } catch (NoSuchFieldException e) { 262 | e.printStackTrace(); 263 | } catch (IllegalAccessException e) { 264 | e.printStackTrace(); 265 | } 266 | 267 | } 268 | 269 | } 270 | 271 | -------------------------------------------------------------------------------- /.idea/workspace.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | <<<<<<< HEAD 9 | 10 | ======= 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | >>>>>>> 6267a6a2987e4d4cee6b87eefbf9e3ef6d9d1070 35 | 36 | 37 | 38 | 39 | 40 | 41 | 47 | 48 | 50 | 51 | 52 | 53 | 54 | 59 | 60 | 61 | 62 | FileReader 63 | build 64 | onX5LoadComplete 65 | filePath 66 | future 67 | taskId 68 | toString 69 | dragStartBehavior 70 | onLongPress 71 | closeFileReaderView 72 | tempPath 73 | 74 | 75 | $PROJECT_DIR$/example/android 76 | 77 | 78 | 79 | 81 | 82 | 105 | 106 | 107 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 1551840522286 163 | 167 | 168 | 1553050311224 169 | 174 | 175 | 1553753000865 176 | 181 | 182 | 1558578562168 183 | 188 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | <<<<<<< HEAD 202 | 203 | ======= 204 | 205 | >>>>>>> 6267a6a2987e4d4cee6b87eefbf9e3ef6d9d1070 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 11 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 12 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 13 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; }; 14 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 15 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 16 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 17 | D557B7BBB191DBF6E07F156D /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A52625D1764A4D13F58D32A3 /* Pods_Runner.framework */; }; 18 | E532019E222FAF9000C5D658 /* libsqlite3.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = E532019D222FAF9000C5D658 /* libsqlite3.tbd */; }; 19 | /* End PBXBuildFile section */ 20 | 21 | /* Begin PBXCopyFilesBuildPhase section */ 22 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = { 23 | isa = PBXCopyFilesBuildPhase; 24 | buildActionMask = 2147483647; 25 | dstPath = ""; 26 | dstSubfolderSpec = 10; 27 | files = ( 28 | ); 29 | name = "Embed Frameworks"; 30 | runOnlyForDeploymentPostprocessing = 0; 31 | }; 32 | /* End PBXCopyFilesBuildPhase section */ 33 | 34 | /* Begin PBXFileReference section */ 35 | 0CBC502ABF597491168142E4 /* 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 = ""; }; 36 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 37 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 38 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 39 | 46024E090EA0CF54D9791B05 /* 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 = ""; }; 40 | 4842295BF489A638F9024832 /* 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 = ""; }; 41 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 42 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 43 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 44 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 45 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 46 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 47 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 48 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 49 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 50 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 51 | A52625D1764A4D13F58D32A3 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 52 | E532019D222FAF9000C5D658 /* libsqlite3.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libsqlite3.tbd; path = usr/lib/libsqlite3.tbd; sourceTree = SDKROOT; }; 53 | /* End PBXFileReference section */ 54 | 55 | /* Begin PBXFrameworksBuildPhase section */ 56 | 97C146EB1CF9000F007C117D /* Frameworks */ = { 57 | isa = PBXFrameworksBuildPhase; 58 | buildActionMask = 2147483647; 59 | files = ( 60 | E532019E222FAF9000C5D658 /* libsqlite3.tbd in Frameworks */, 61 | D557B7BBB191DBF6E07F156D /* Pods_Runner.framework in Frameworks */, 62 | ); 63 | runOnlyForDeploymentPostprocessing = 0; 64 | }; 65 | /* End PBXFrameworksBuildPhase section */ 66 | 67 | /* Begin PBXGroup section */ 68 | 76932D0DDDB0B759C5FB98EB /* Pods */ = { 69 | isa = PBXGroup; 70 | children = ( 71 | 0CBC502ABF597491168142E4 /* Pods-Runner.debug.xcconfig */, 72 | 4842295BF489A638F9024832 /* Pods-Runner.release.xcconfig */, 73 | 46024E090EA0CF54D9791B05 /* Pods-Runner.profile.xcconfig */, 74 | ); 75 | name = Pods; 76 | sourceTree = ""; 77 | }; 78 | 83EAD130C610DF0FA0B29B07 /* Frameworks */ = { 79 | isa = PBXGroup; 80 | children = ( 81 | E532019D222FAF9000C5D658 /* libsqlite3.tbd */, 82 | A52625D1764A4D13F58D32A3 /* Pods_Runner.framework */, 83 | ); 84 | name = Frameworks; 85 | sourceTree = ""; 86 | }; 87 | 9740EEB11CF90186004384FC /* Flutter */ = { 88 | isa = PBXGroup; 89 | children = ( 90 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 91 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, 92 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 93 | 9740EEB31CF90195004384FC /* Generated.xcconfig */, 94 | ); 95 | name = Flutter; 96 | sourceTree = ""; 97 | }; 98 | 97C146E51CF9000F007C117D = { 99 | isa = PBXGroup; 100 | children = ( 101 | 9740EEB11CF90186004384FC /* Flutter */, 102 | 97C146F01CF9000F007C117D /* Runner */, 103 | 97C146EF1CF9000F007C117D /* Products */, 104 | 76932D0DDDB0B759C5FB98EB /* Pods */, 105 | 83EAD130C610DF0FA0B29B07 /* Frameworks */, 106 | ); 107 | sourceTree = ""; 108 | }; 109 | 97C146EF1CF9000F007C117D /* Products */ = { 110 | isa = PBXGroup; 111 | children = ( 112 | 97C146EE1CF9000F007C117D /* Runner.app */, 113 | ); 114 | name = Products; 115 | sourceTree = ""; 116 | }; 117 | 97C146F01CF9000F007C117D /* Runner */ = { 118 | isa = PBXGroup; 119 | children = ( 120 | 97C146FA1CF9000F007C117D /* Main.storyboard */, 121 | 97C146FD1CF9000F007C117D /* Assets.xcassets */, 122 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 123 | 97C147021CF9000F007C117D /* Info.plist */, 124 | 97C146F11CF9000F007C117D /* Supporting Files */, 125 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 126 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 127 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, 128 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, 129 | ); 130 | path = Runner; 131 | sourceTree = ""; 132 | }; 133 | 97C146F11CF9000F007C117D /* Supporting Files */ = { 134 | isa = PBXGroup; 135 | children = ( 136 | ); 137 | name = "Supporting Files"; 138 | sourceTree = ""; 139 | }; 140 | /* End PBXGroup section */ 141 | 142 | /* Begin PBXNativeTarget section */ 143 | 97C146ED1CF9000F007C117D /* Runner */ = { 144 | isa = PBXNativeTarget; 145 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; 146 | buildPhases = ( 147 | DD62050C9D6D30D4C770938F /* [CP] Check Pods Manifest.lock */, 148 | 9740EEB61CF901F6004384FC /* Run Script */, 149 | 97C146EA1CF9000F007C117D /* Sources */, 150 | 97C146EB1CF9000F007C117D /* Frameworks */, 151 | 97C146EC1CF9000F007C117D /* Resources */, 152 | 9705A1C41CF9048500538489 /* Embed Frameworks */, 153 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 154 | 87A33548576502547DE29D45 /* [CP] Embed Pods Frameworks */, 155 | ); 156 | buildRules = ( 157 | ); 158 | dependencies = ( 159 | ); 160 | name = Runner; 161 | productName = Runner; 162 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */; 163 | productType = "com.apple.product-type.application"; 164 | }; 165 | /* End PBXNativeTarget section */ 166 | 167 | /* Begin PBXProject section */ 168 | 97C146E61CF9000F007C117D /* Project object */ = { 169 | isa = PBXProject; 170 | attributes = { 171 | LastUpgradeCheck = 0910; 172 | ORGANIZATIONNAME = "The Chromium Authors"; 173 | TargetAttributes = { 174 | 97C146ED1CF9000F007C117D = { 175 | CreatedOnToolsVersion = 7.3.1; 176 | DevelopmentTeam = RTX4M7V5MV; 177 | LastSwiftMigration = 0910; 178 | SystemCapabilities = { 179 | com.apple.BackgroundModes = { 180 | enabled = 1; 181 | }; 182 | }; 183 | }; 184 | }; 185 | }; 186 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; 187 | compatibilityVersion = "Xcode 3.2"; 188 | developmentRegion = English; 189 | hasScannedForEncodings = 0; 190 | knownRegions = ( 191 | English, 192 | en, 193 | Base, 194 | ); 195 | mainGroup = 97C146E51CF9000F007C117D; 196 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */; 197 | projectDirPath = ""; 198 | projectRoot = ""; 199 | targets = ( 200 | 97C146ED1CF9000F007C117D /* Runner */, 201 | ); 202 | }; 203 | /* End PBXProject section */ 204 | 205 | /* Begin PBXResourcesBuildPhase section */ 206 | 97C146EC1CF9000F007C117D /* Resources */ = { 207 | isa = PBXResourcesBuildPhase; 208 | buildActionMask = 2147483647; 209 | files = ( 210 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 211 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 212 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */, 213 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 214 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 215 | ); 216 | runOnlyForDeploymentPostprocessing = 0; 217 | }; 218 | /* End PBXResourcesBuildPhase section */ 219 | 220 | /* Begin PBXShellScriptBuildPhase section */ 221 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 222 | isa = PBXShellScriptBuildPhase; 223 | buildActionMask = 2147483647; 224 | files = ( 225 | ); 226 | inputPaths = ( 227 | ); 228 | name = "Thin Binary"; 229 | outputPaths = ( 230 | ); 231 | runOnlyForDeploymentPostprocessing = 0; 232 | shellPath = /bin/sh; 233 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; 234 | }; 235 | 87A33548576502547DE29D45 /* [CP] Embed Pods Frameworks */ = { 236 | isa = PBXShellScriptBuildPhase; 237 | buildActionMask = 2147483647; 238 | files = ( 239 | ); 240 | inputPaths = ( 241 | "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh", 242 | "${PODS_ROOT}/../.symlinks/flutter/ios/Flutter.framework", 243 | "${BUILT_PRODUCTS_DIR}/flutter_filereader/flutter_filereader.framework", 244 | "${BUILT_PRODUCTS_DIR}/path_provider/path_provider.framework", 245 | ); 246 | name = "[CP] Embed Pods Frameworks"; 247 | outputPaths = ( 248 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Flutter.framework", 249 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_filereader.framework", 250 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/path_provider.framework", 251 | ); 252 | runOnlyForDeploymentPostprocessing = 0; 253 | shellPath = /bin/sh; 254 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; 255 | showEnvVarsInLog = 0; 256 | }; 257 | 9740EEB61CF901F6004384FC /* Run Script */ = { 258 | isa = PBXShellScriptBuildPhase; 259 | buildActionMask = 2147483647; 260 | files = ( 261 | ); 262 | inputPaths = ( 263 | ); 264 | name = "Run Script"; 265 | outputPaths = ( 266 | ); 267 | runOnlyForDeploymentPostprocessing = 0; 268 | shellPath = /bin/sh; 269 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; 270 | }; 271 | DD62050C9D6D30D4C770938F /* [CP] Check Pods Manifest.lock */ = { 272 | isa = PBXShellScriptBuildPhase; 273 | buildActionMask = 2147483647; 274 | files = ( 275 | ); 276 | inputPaths = ( 277 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 278 | "${PODS_ROOT}/Manifest.lock", 279 | ); 280 | name = "[CP] Check Pods Manifest.lock"; 281 | outputPaths = ( 282 | "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", 283 | ); 284 | runOnlyForDeploymentPostprocessing = 0; 285 | shellPath = /bin/sh; 286 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 287 | showEnvVarsInLog = 0; 288 | }; 289 | /* End PBXShellScriptBuildPhase section */ 290 | 291 | /* Begin PBXSourcesBuildPhase section */ 292 | 97C146EA1CF9000F007C117D /* Sources */ = { 293 | isa = PBXSourcesBuildPhase; 294 | buildActionMask = 2147483647; 295 | files = ( 296 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, 297 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, 298 | ); 299 | runOnlyForDeploymentPostprocessing = 0; 300 | }; 301 | /* End PBXSourcesBuildPhase section */ 302 | 303 | /* Begin PBXVariantGroup section */ 304 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = { 305 | isa = PBXVariantGroup; 306 | children = ( 307 | 97C146FB1CF9000F007C117D /* Base */, 308 | ); 309 | name = Main.storyboard; 310 | sourceTree = ""; 311 | }; 312 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { 313 | isa = PBXVariantGroup; 314 | children = ( 315 | 97C147001CF9000F007C117D /* Base */, 316 | ); 317 | name = LaunchScreen.storyboard; 318 | sourceTree = ""; 319 | }; 320 | /* End PBXVariantGroup section */ 321 | 322 | /* Begin XCBuildConfiguration section */ 323 | 249021D3217E4FDB00AE95B9 /* Profile */ = { 324 | isa = XCBuildConfiguration; 325 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 326 | buildSettings = { 327 | ALWAYS_SEARCH_USER_PATHS = NO; 328 | CLANG_ANALYZER_NONNULL = YES; 329 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 330 | CLANG_CXX_LIBRARY = "libc++"; 331 | CLANG_ENABLE_MODULES = YES; 332 | CLANG_ENABLE_OBJC_ARC = YES; 333 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 334 | CLANG_WARN_BOOL_CONVERSION = YES; 335 | CLANG_WARN_COMMA = YES; 336 | CLANG_WARN_CONSTANT_CONVERSION = YES; 337 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 338 | CLANG_WARN_EMPTY_BODY = YES; 339 | CLANG_WARN_ENUM_CONVERSION = YES; 340 | CLANG_WARN_INFINITE_RECURSION = YES; 341 | CLANG_WARN_INT_CONVERSION = YES; 342 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 343 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 344 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 345 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 346 | CLANG_WARN_STRICT_PROTOTYPES = YES; 347 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 348 | CLANG_WARN_UNREACHABLE_CODE = YES; 349 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 350 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 351 | COPY_PHASE_STRIP = NO; 352 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 353 | ENABLE_NS_ASSERTIONS = NO; 354 | ENABLE_STRICT_OBJC_MSGSEND = YES; 355 | GCC_C_LANGUAGE_STANDARD = gnu99; 356 | GCC_NO_COMMON_BLOCKS = YES; 357 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 358 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 359 | GCC_WARN_UNDECLARED_SELECTOR = YES; 360 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 361 | GCC_WARN_UNUSED_FUNCTION = YES; 362 | GCC_WARN_UNUSED_VARIABLE = YES; 363 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 364 | MTL_ENABLE_DEBUG_INFO = NO; 365 | SDKROOT = iphoneos; 366 | TARGETED_DEVICE_FAMILY = "1,2"; 367 | VALIDATE_PRODUCT = YES; 368 | }; 369 | name = Profile; 370 | }; 371 | 249021D4217E4FDB00AE95B9 /* Profile */ = { 372 | isa = XCBuildConfiguration; 373 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 374 | buildSettings = { 375 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 376 | CURRENT_PROJECT_VERSION = 1; 377 | DEVELOPMENT_TEAM = RTX4M7V5MV; 378 | ENABLE_BITCODE = NO; 379 | FRAMEWORK_SEARCH_PATHS = ( 380 | "$(inherited)", 381 | "$(PROJECT_DIR)/Flutter", 382 | ); 383 | INFOPLIST_FILE = Runner/Info.plist; 384 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 385 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 386 | LIBRARY_SEARCH_PATHS = ( 387 | "$(inherited)", 388 | "$(PROJECT_DIR)/Flutter", 389 | ); 390 | MARKETING_VERSION = 1.0.0; 391 | PRODUCT_BUNDLE_IDENTIFIER = com.webview.flutterFilereaderExample; 392 | PRODUCT_NAME = "$(TARGET_NAME)"; 393 | SWIFT_VERSION = 4.0; 394 | TARGETED_DEVICE_FAMILY = 1; 395 | VERSIONING_SYSTEM = "apple-generic"; 396 | }; 397 | name = Profile; 398 | }; 399 | 97C147031CF9000F007C117D /* Debug */ = { 400 | isa = XCBuildConfiguration; 401 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 402 | buildSettings = { 403 | ALWAYS_SEARCH_USER_PATHS = NO; 404 | CLANG_ANALYZER_NONNULL = YES; 405 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 406 | CLANG_CXX_LIBRARY = "libc++"; 407 | CLANG_ENABLE_MODULES = YES; 408 | CLANG_ENABLE_OBJC_ARC = YES; 409 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 410 | CLANG_WARN_BOOL_CONVERSION = YES; 411 | CLANG_WARN_COMMA = YES; 412 | CLANG_WARN_CONSTANT_CONVERSION = YES; 413 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 414 | CLANG_WARN_EMPTY_BODY = YES; 415 | CLANG_WARN_ENUM_CONVERSION = YES; 416 | CLANG_WARN_INFINITE_RECURSION = YES; 417 | CLANG_WARN_INT_CONVERSION = YES; 418 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 419 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 420 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 421 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 422 | CLANG_WARN_STRICT_PROTOTYPES = YES; 423 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 424 | CLANG_WARN_UNREACHABLE_CODE = YES; 425 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 426 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 427 | COPY_PHASE_STRIP = NO; 428 | DEBUG_INFORMATION_FORMAT = dwarf; 429 | ENABLE_STRICT_OBJC_MSGSEND = YES; 430 | ENABLE_TESTABILITY = YES; 431 | GCC_C_LANGUAGE_STANDARD = gnu99; 432 | GCC_DYNAMIC_NO_PIC = NO; 433 | GCC_NO_COMMON_BLOCKS = YES; 434 | GCC_OPTIMIZATION_LEVEL = 0; 435 | GCC_PREPROCESSOR_DEFINITIONS = ( 436 | "DEBUG=1", 437 | "$(inherited)", 438 | ); 439 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 440 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 441 | GCC_WARN_UNDECLARED_SELECTOR = YES; 442 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 443 | GCC_WARN_UNUSED_FUNCTION = YES; 444 | GCC_WARN_UNUSED_VARIABLE = YES; 445 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 446 | MTL_ENABLE_DEBUG_INFO = YES; 447 | ONLY_ACTIVE_ARCH = YES; 448 | SDKROOT = iphoneos; 449 | TARGETED_DEVICE_FAMILY = "1,2"; 450 | }; 451 | name = Debug; 452 | }; 453 | 97C147041CF9000F007C117D /* Release */ = { 454 | isa = XCBuildConfiguration; 455 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 456 | buildSettings = { 457 | ALWAYS_SEARCH_USER_PATHS = NO; 458 | CLANG_ANALYZER_NONNULL = YES; 459 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 460 | CLANG_CXX_LIBRARY = "libc++"; 461 | CLANG_ENABLE_MODULES = YES; 462 | CLANG_ENABLE_OBJC_ARC = YES; 463 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 464 | CLANG_WARN_BOOL_CONVERSION = YES; 465 | CLANG_WARN_COMMA = YES; 466 | CLANG_WARN_CONSTANT_CONVERSION = YES; 467 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 468 | CLANG_WARN_EMPTY_BODY = YES; 469 | CLANG_WARN_ENUM_CONVERSION = YES; 470 | CLANG_WARN_INFINITE_RECURSION = YES; 471 | CLANG_WARN_INT_CONVERSION = YES; 472 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 473 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 474 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 475 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 476 | CLANG_WARN_STRICT_PROTOTYPES = YES; 477 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 478 | CLANG_WARN_UNREACHABLE_CODE = YES; 479 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 480 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 481 | COPY_PHASE_STRIP = NO; 482 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 483 | ENABLE_NS_ASSERTIONS = NO; 484 | ENABLE_STRICT_OBJC_MSGSEND = YES; 485 | GCC_C_LANGUAGE_STANDARD = gnu99; 486 | GCC_NO_COMMON_BLOCKS = YES; 487 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 488 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 489 | GCC_WARN_UNDECLARED_SELECTOR = YES; 490 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 491 | GCC_WARN_UNUSED_FUNCTION = YES; 492 | GCC_WARN_UNUSED_VARIABLE = YES; 493 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 494 | MTL_ENABLE_DEBUG_INFO = NO; 495 | SDKROOT = iphoneos; 496 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 497 | TARGETED_DEVICE_FAMILY = "1,2"; 498 | VALIDATE_PRODUCT = YES; 499 | }; 500 | name = Release; 501 | }; 502 | 97C147061CF9000F007C117D /* Debug */ = { 503 | isa = XCBuildConfiguration; 504 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 505 | buildSettings = { 506 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 507 | CLANG_ENABLE_MODULES = YES; 508 | CURRENT_PROJECT_VERSION = 1; 509 | DEVELOPMENT_TEAM = RTX4M7V5MV; 510 | ENABLE_BITCODE = NO; 511 | FRAMEWORK_SEARCH_PATHS = ( 512 | "$(inherited)", 513 | "$(PROJECT_DIR)/Flutter", 514 | ); 515 | INFOPLIST_FILE = Runner/Info.plist; 516 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 517 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 518 | LIBRARY_SEARCH_PATHS = ( 519 | "$(inherited)", 520 | "$(PROJECT_DIR)/Flutter", 521 | ); 522 | MARKETING_VERSION = 1.0.0; 523 | PRODUCT_BUNDLE_IDENTIFIER = com.webview.flutterFilereaderExample; 524 | PRODUCT_NAME = "$(TARGET_NAME)"; 525 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 526 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 527 | SWIFT_SWIFT3_OBJC_INFERENCE = On; 528 | SWIFT_VERSION = 4.0; 529 | TARGETED_DEVICE_FAMILY = 1; 530 | VERSIONING_SYSTEM = "apple-generic"; 531 | }; 532 | name = Debug; 533 | }; 534 | 97C147071CF9000F007C117D /* Release */ = { 535 | isa = XCBuildConfiguration; 536 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 537 | buildSettings = { 538 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 539 | CLANG_ENABLE_MODULES = YES; 540 | CURRENT_PROJECT_VERSION = 1; 541 | DEVELOPMENT_TEAM = RTX4M7V5MV; 542 | ENABLE_BITCODE = NO; 543 | FRAMEWORK_SEARCH_PATHS = ( 544 | "$(inherited)", 545 | "$(PROJECT_DIR)/Flutter", 546 | ); 547 | INFOPLIST_FILE = Runner/Info.plist; 548 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 549 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 550 | LIBRARY_SEARCH_PATHS = ( 551 | "$(inherited)", 552 | "$(PROJECT_DIR)/Flutter", 553 | ); 554 | MARKETING_VERSION = 1.0.0; 555 | PRODUCT_BUNDLE_IDENTIFIER = com.webview.flutterFilereaderExample; 556 | PRODUCT_NAME = "$(TARGET_NAME)"; 557 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 558 | SWIFT_SWIFT3_OBJC_INFERENCE = On; 559 | SWIFT_VERSION = 4.0; 560 | TARGETED_DEVICE_FAMILY = 1; 561 | VERSIONING_SYSTEM = "apple-generic"; 562 | }; 563 | name = Release; 564 | }; 565 | /* End XCBuildConfiguration section */ 566 | 567 | /* Begin XCConfigurationList section */ 568 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { 569 | isa = XCConfigurationList; 570 | buildConfigurations = ( 571 | 97C147031CF9000F007C117D /* Debug */, 572 | 97C147041CF9000F007C117D /* Release */, 573 | 249021D3217E4FDB00AE95B9 /* Profile */, 574 | ); 575 | defaultConfigurationIsVisible = 0; 576 | defaultConfigurationName = Release; 577 | }; 578 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { 579 | isa = XCConfigurationList; 580 | buildConfigurations = ( 581 | 97C147061CF9000F007C117D /* Debug */, 582 | 97C147071CF9000F007C117D /* Release */, 583 | 249021D4217E4FDB00AE95B9 /* Profile */, 584 | ); 585 | defaultConfigurationIsVisible = 0; 586 | defaultConfigurationName = Release; 587 | }; 588 | /* End XCConfigurationList section */ 589 | }; 590 | rootObject = 97C146E61CF9000F007C117D /* Project object */; 591 | } 592 | --------------------------------------------------------------------------------