flutter_kit_file_open 0.0.1
flutter_kit_file_open: ^0.0.1 copied to clipboard
Private plugins / packages
flutter_kit_file_open #
Private plugins / packages
Getting Started #
flutter add pub flutter_kit_file_open
Android需要手动震动权限 #
在android/app/src/main/AndroidManifext.xml中添加
<!-- 启动器intent-filter -->
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<!-- 文件处理intent-filter -->
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<!-- 支持所有文件类型 -->
<data android:scheme="file" />
<data android:mimeType="*/*" />
<!-- 或者指定特定文件类型 -->
<!-- <data android:mimeType="text/plain" />
<data android:pathPattern=".*\\.txt" />
<data android:pathPattern=".*\\.pdf" />
<data android:pathPattern=".*\\.jpg" /> -->
<!-- 支持content://协议 -->
<data android:scheme="content" />
</intent-filter>
iOS需要手动震动权限 #
在ios/Runner/Info.plist中添加
<!-- 在 Info.plist 中添加以下配置 -->
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeName</key>
<string>All Files</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<!-- 支持所有文件类型 -->
<string>public.item</string>
<string>public.content</string>
<!-- 或者指定具体类型 -->
<!--
<string>public.plain-text</string> <!-- 文本文件 -->
<string>public.pdf</string> <!-- PDF -->
<string>public.image</string> <!-- 图片 -->
<string>public.movie</string> <!-- 视频 -->
<string>public.audio</string> <!-- 音频 -->
<string>com.adobe.pdf</string> <!-- PDF -->
<string>public.png</string> <!-- PNG -->
<string>public.jpeg</string> <!-- JPEG -->
<string>com.microsoft.word.doc</string> <!-- Word -->
<string>org.openxmlformats.wordprocessingml.document</string> <!-- .docx -->
-->
</array>
</dict>
</array>
<!-- 如果要支持自定义URL Scheme -->
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>file</string>
<string>content</string>
</array>
</dict>
</array>
<!-- iOS 14+ 需要声明支持的文档类型 -->
<key>UTExportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeIdentifier</key>
<string>public.data</string>
<key>UTTypeDescription</key>
<string>All Files</string>
<key>UTTypeConformsTo</key>
<array>
<string>public.item</string>
</array>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<array>
<string>*</string>
</array>
</dict>
</dict>
</array>