diff --git a/flutter/clipboard/android/app/src/main/AndroidManifest.xml b/flutter/clipboard/android/app/src/main/AndroidManifest.xml
index c076e3853..5cde5cafe 100644
--- a/flutter/clipboard/android/app/src/main/AndroidManifest.xml
+++ b/flutter/clipboard/android/app/src/main/AndroidManifest.xml
@@ -4,6 +4,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
.filled(1024 * 100 - sentSize, 0);
conn.add(uselessData);
+ try {
+ await conn.flush();
+ } catch (e) {
+ // print('flush error: $e');
+ }
}
// 下面的代码哪里有问题???
diff --git a/flutter/clipboard/lib/main.dart b/flutter/clipboard/lib/main.dart
index dafcf3fb8..7b2ca9375 100644
--- a/flutter/clipboard/lib/main.dart
+++ b/flutter/clipboard/lib/main.dart
@@ -15,6 +15,8 @@ import 'package:convert/convert.dart';
import 'package:intl/intl.dart';
import 'package:receive_sharing_intent/receive_sharing_intent.dart';
import 'package:flutter_toastr/flutter_toastr.dart';
+import 'package:permission_handler/permission_handler.dart';
+import 'package:device_info_plus/device_info_plus.dart';
import 'web.dart';
import 'file.dart';
@@ -1061,6 +1063,18 @@ class _HomePageState extends State {
{List? filePath}) async {
final List selectedFilesPath;
if (filePath == null || filePath.isEmpty) {
+ final androidInfo = await DeviceInfoPlugin().androidInfo;
+ // check permission
+ if (!await Permission.manageExternalStorage.request().isGranted) {
+ throw Exception('需要manageExternalStorage权限');
+ }
+ if (androidInfo.version.sdkInt > 32) {
+ if (!await Permission.photos.request().isGranted ||
+ !await Permission.videos.request().isGranted ||
+ !await Permission.audio.request().isGranted) {
+ throw Exception('需要photos, videos, audio权限');
+ }
+ }
final result = await FilePicker.platform.pickFiles(allowMultiple: true);
if (result == null || !result.files.isNotEmpty) {
throw Exception('No file selected');
diff --git a/flutter/clipboard/macos/Flutter/GeneratedPluginRegistrant.swift b/flutter/clipboard/macos/Flutter/GeneratedPluginRegistrant.swift
index b878e0379..ff31c6254 100644
--- a/flutter/clipboard/macos/Flutter/GeneratedPluginRegistrant.swift
+++ b/flutter/clipboard/macos/Flutter/GeneratedPluginRegistrant.swift
@@ -5,10 +5,12 @@
import FlutterMacOS
import Foundation
+import device_info_plus
import file_selector_macos
import path_provider_foundation
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
+ DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin"))
FileSelectorPlugin.register(with: registry.registrar(forPlugin: "FileSelectorPlugin"))
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
}
diff --git a/flutter/clipboard/pubspec.yaml b/flutter/clipboard/pubspec.yaml
index 045626c09..1bfb38829 100644
--- a/flutter/clipboard/pubspec.yaml
+++ b/flutter/clipboard/pubspec.yaml
@@ -16,7 +16,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
-version: 0.5.1
+version: 0.5.0
environment:
sdk: ">=3.0.3 <4.0.0"
@@ -54,6 +54,8 @@ dependencies:
url: https://github.com/abhi16180/flutter_file_picker.git
ref: master
flutter_toastr: ^1.0.3
+ permission_handler: ^10.4.3
+ device_info_plus: ^8.2.2
dev_dependencies:
flutter_test:
diff --git a/flutter/clipboard/windows/flutter/generated_plugin_registrant.cc b/flutter/clipboard/windows/flutter/generated_plugin_registrant.cc
index 77ab7a09a..2c256bd46 100644
--- a/flutter/clipboard/windows/flutter/generated_plugin_registrant.cc
+++ b/flutter/clipboard/windows/flutter/generated_plugin_registrant.cc
@@ -7,8 +7,11 @@
#include "generated_plugin_registrant.h"
#include
+#include
void RegisterPlugins(flutter::PluginRegistry* registry) {
FileSelectorWindowsRegisterWithRegistrar(
registry->GetRegistrarForPlugin("FileSelectorWindows"));
+ PermissionHandlerWindowsPluginRegisterWithRegistrar(
+ registry->GetRegistrarForPlugin("PermissionHandlerWindowsPlugin"));
}
diff --git a/flutter/clipboard/windows/flutter/generated_plugins.cmake b/flutter/clipboard/windows/flutter/generated_plugins.cmake
index a423a0247..230eabf6e 100644
--- a/flutter/clipboard/windows/flutter/generated_plugins.cmake
+++ b/flutter/clipboard/windows/flutter/generated_plugins.cmake
@@ -4,6 +4,7 @@
list(APPEND FLUTTER_PLUGIN_LIST
file_selector_windows
+ permission_handler_windows
)
list(APPEND FLUTTER_FFI_PLUGIN_LIST