try to solve file_picker on ios

This commit is contained in:
lollipopkit
2023-02-17 18:57:16 +08:00
parent 558721fa79
commit 9c00dc8a54
7 changed files with 37 additions and 71 deletions

View File

@@ -27,6 +27,11 @@ require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelpe
flutter_ios_podfile_setup
# Used for flutter lib "file_picker"
Pod::PICKER_MEDIA = false
Pod::PICKER_AUDIO = false
Pod::PICKER_DOCUMENT = false
target 'Runner' do
use_frameworks!
use_modular_headers!

View File

@@ -1,39 +1,7 @@
PODS:
- countly_flutter (22.09.0):
- Flutter
- DKImagePickerController/Core (4.3.4):
- DKImagePickerController/ImageDataManager
- DKImagePickerController/Resource
- DKImagePickerController/ImageDataManager (4.3.4)
- DKImagePickerController/PhotoGallery (4.3.4):
- DKImagePickerController/Core
- DKPhotoGallery
- DKImagePickerController/Resource (4.3.4)
- DKPhotoGallery (0.0.17):
- DKPhotoGallery/Core (= 0.0.17)
- DKPhotoGallery/Model (= 0.0.17)
- DKPhotoGallery/Preview (= 0.0.17)
- DKPhotoGallery/Resource (= 0.0.17)
- SDWebImage
- SwiftyGif
- DKPhotoGallery/Core (0.0.17):
- DKPhotoGallery/Model
- DKPhotoGallery/Preview
- SDWebImage
- SwiftyGif
- DKPhotoGallery/Model (0.0.17):
- SDWebImage
- SwiftyGif
- DKPhotoGallery/Preview (0.0.17):
- DKPhotoGallery/Model
- DKPhotoGallery/Resource
- SDWebImage
- SwiftyGif
- DKPhotoGallery/Resource (0.0.17):
- SDWebImage
- SwiftyGif
- file_picker (0.0.1):
- DKImagePickerController/PhotoGallery
- Flutter
- Flutter (1.0.0)
- flutter_native_splash (0.0.1):
@@ -43,12 +11,8 @@ PODS:
- FlutterMacOS
- r_upgrade (0.0.1):
- Flutter
- SDWebImage (5.15.2):
- SDWebImage/Core (= 5.15.2)
- SDWebImage/Core (5.15.2)
- share_plus (0.0.1):
- Flutter
- SwiftyGif (5.4.4)
- url_launcher_ios (0.0.1):
- Flutter
@@ -62,13 +26,6 @@ DEPENDENCIES:
- share_plus (from `.symlinks/plugins/share_plus/ios`)
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
SPEC REPOS:
trunk:
- DKImagePickerController
- DKPhotoGallery
- SDWebImage
- SwiftyGif
EXTERNAL SOURCES:
countly_flutter:
:path: ".symlinks/plugins/countly_flutter/ios"
@@ -89,18 +46,14 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
countly_flutter: 135f1a4930f8e26ba223a14201d3f265ea7b4c83
DKImagePickerController: b512c28220a2b8ac7419f21c491fc8534b7601ac
DKPhotoGallery: fdfad5125a9fdda9cc57df834d49df790dbb4179
file_picker: ce3938a0df3cc1ef404671531facef740d03f920
file_picker: ec55172937ec2d774460eb4538bad01df0171d81
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
flutter_native_splash: 52501b97d1c0a5f898d687f1646226c1f93c56ef
path_provider_foundation: 37748e03f12783f9de2cb2c4eadfaa25fe6d4852
r_upgrade: 44d715c61914cce3d01ea225abffe894fd51c114
SDWebImage: 8ab87d4b3e5cc4927bd47f78db6ceb0b94442577
share_plus: 056a1e8ac890df3e33cb503afffaf1e9b4fbae68
SwiftyGif: 93a1cc87bf3a51916001cf8f3d63835fb64c819f
url_launcher_ios: ae1517e5e344f5544fb090b079e11f399dfbe4d2
PODFILE CHECKSUM: ef19549a9bc3046e7bb7d2fab4d021637c0c58a3
PODFILE CHECKSUM: 2b69360f043c9ddaf997545332dc5203c4792a49
COCOAPODS: 1.11.3

View File

@@ -356,7 +356,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = 221;
CURRENT_PROJECT_VERSION = 223;
DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
@@ -364,7 +364,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.221;
MARKETING_VERSION = 1.0.223;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
@@ -486,7 +486,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = 221;
CURRENT_PROJECT_VERSION = 223;
DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
@@ -494,7 +494,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.221;
MARKETING_VERSION = 1.0.223;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
@@ -510,7 +510,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = 221;
CURRENT_PROJECT_VERSION = 223;
DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
@@ -518,7 +518,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.221;
MARKETING_VERSION = 1.0.223;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";

View File

@@ -50,5 +50,13 @@
<true/>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
<key>UIBackgroundModes</key>
<array>
<string>fetch</string>
</array>
<key>LSSupportsOpeningDocumentsInPlace</key>
<true/>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
</dict>
</plist>

View File

@@ -1,5 +1,6 @@
import 'dart:io';
import 'package:file_picker/file_picker.dart';
import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart';
import 'package:share_plus/share_plus.dart';
@@ -26,3 +27,8 @@ Future<bool> shareFiles(BuildContext context, List<String> filePaths) async {
void copy(String text) {
Clipboard.setData(ClipboardData(text: text));
}
Future<String?> pickOneFile() async {
final result = await FilePicker.platform.pickFiles(type: FileType.any);
return result?.files.single.path;
}

View File

@@ -2,9 +2,8 @@
class BuildData {
static const String name = "ServerBox";
static const int build = 221;
static const String engine =
"Flutter 3.7.3 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision 9944297138 (8 days ago) • 2023-02-08 15:46:04 -0800\nEngine • revision 248290d6d5\nTools • Dart 2.19.2 • DevTools 2.20.1\n";
static const String buildAt = "2023-02-17 15:57:59.844806";
static const int modifications = 2;
static const int build = 223;
static const String engine = "Flutter 3.7.3 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision 9944297138 (8 days ago) • 2023-02-08 15:46:04 -0800\nEngine • revision 248290d6d5\nTools • Dart 2.19.2 • DevTools 2.20.1\n";
static const String buildAt = "2023-02-17 18:51:44.086252";
static const int modifications = 7;
}

View File

@@ -2,11 +2,11 @@ import 'dart:io';
import 'package:after_layout/after_layout.dart';
import 'package:dartssh2/dartssh2.dart';
import 'package:file_picker/file_picker.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:toolbox/core/extension/numx.dart';
import 'package:toolbox/core/utils/misc.dart';
import 'package:toolbox/data/res/misc.dart';
import '../../../core/utils/ui.dart';
@@ -97,12 +97,7 @@ class _PrivateKeyEditPageState extends State<PrivateKeyEditPage>
),
TextButton(
onPressed: () async {
final result = await FilePicker.platform.pickFiles();
if (result == null) {
return;
}
final path = result.files.single.path;
final path = await pickOneFile();
if (path == null) {
showSnackBar(context, const Text('path is null'));
return;