From def222a8abe9558fa2f013208fb22690363f4fbb Mon Sep 17 00:00:00 2001 From: Sarah Jamie Lewis Date: Fri, 21 Jan 2022 13:40:23 -0800 Subject: [PATCH] upgrade flutter file picker --- lib/views/messageview.dart | 7 ++++--- pubspec.lock | 4 ++-- pubspec.yaml | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/views/messageview.dart b/lib/views/messageview.dart index 9bdcacae..ade71beb 100644 --- a/lib/views/messageview.dart +++ b/lib/views/messageview.dart @@ -400,10 +400,11 @@ class _MessageViewState extends State { // while awaiting for pickFiles. var appstate = Provider.of(ctx, listen: false); appstate.disableFilePicker = true; - FilePickerResult? result = await FilePicker.platform.pickFiles(); + // currently lockParentWindow only works on Windows... + FilePickerResult? result = await FilePicker.platform.pickFiles(lockParentWindow: true); appstate.disableFilePicker = false; - if (result != null) { - File file = File(result.files.first.path); + if (result != null && result.files.first.path != null) { + File file = File(result.files.first.path!); // We have a maximum number of bytes we can represent in terms of // a manifest (see : https://git.openprivacy.ca/cwtch.im/cwtch/src/branch/master/protocol/files/manifest.go#L25) if (file.lengthSync() <= 10737418240) { diff --git a/pubspec.lock b/pubspec.lock index a967a6be..22a566d6 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -112,14 +112,14 @@ packages: name: file_picker url: "https://pub.dartlang.org" source: hosted - version: "4.0.1" + version: "4.3.2" file_picker_desktop: dependency: "direct main" description: name: file_picker_desktop url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.1.1" flutter: dependency: "direct main" description: flutter diff --git a/pubspec.yaml b/pubspec.yaml index 03d6d590..47e0b916 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -41,7 +41,7 @@ dependencies: flutter_test: sdk: flutter scrollable_positioned_list: ^0.2.0-nullsafety.0 - file_picker: ^4.0.1 + file_picker: ^4.3.2 file_picker_desktop: ^1.1.0 url_launcher: ^6.0.12