miguelpruivo / flutter_file_picker

File picker plugin for Flutter, compatible with mobile (iOS & Android), Web, Desktop (Mac, Linux, Windows) platforms with Flutter Go support.
MIT License
1.34k stars 673 forks source link

pickFiles dialog does not receive focus on macOS #1445

Open Hixie opened 9 months ago

Hixie commented 9 months ago

Describe the bug

I try to open an "open" dialog as follows, in reaction to a click on a material button:

Future<PlatformFile?> openFile(
  BuildContext context, {
  required String title,
  required String extension,
}) async {
  Navigator.push(context, _createModalBackdrop());
  try {
    FilePickerResult? result = await FilePicker.platform.pickFiles(
      dialogTitle: title,
      type: FileType.custom,
      allowedExtensions: [extension],
      withReadStream: true,
      lockParentWindow: true,
    );
    return result?.files.single;
  } finally {
    // ignore: use_build_context_synchronously
    Navigator.pop(context);
  }
}

...and the dialog pops up above my macOS application, but the open files dialog is not focused; the app retains focus.

Platform

Platform OS version

macOS 14.2.1

Flutter Version details

ianh@coupari app % flutter doctor -v
[✓] Flutter (Channel main, 3.20.0-7.0.pre.31, on macOS 14.2.1 23C71 darwin-arm64, locale en-US)
    • Flutter version 3.20.0-7.0.pre.31 on channel main at /Users/ianh/dev/flutter
    • Upstream repository git@github.com:flutter/flutter.git
    • Framework revision 5025681129 (55 minutes ago), 2024-02-13 21:48:41 +0000
    • Engine revision 0091a4914d
    • Dart version 3.4.0 (build 3.4.0-138.0.dev)
    • DevTools version 2.33.0-dev.6

[✗] Android toolchain - develop for Android devices
    ✗ Unable to locate Android SDK.
      Install Android Studio from: https://developer.android.com/studio/index.html
      On first launch it will assist you in installing the Android SDK components.
      (or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions).
      If the Android SDK has been installed to a custom location, please use
      `flutter config --android-sdk` to update to that location.

[!] Xcode - develop for iOS and macOS (Xcode 15.2)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15C500b
    ✗ Unable to get list of installed Simulator runtimes.
    • CocoaPods version 1.14.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[!] Android Studio (not installed)
    • Android Studio not found; download from https://developer.android.com/studio/index.html
      (or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions).

[✓] VS Code (version 1.85.2)
    • VS Code at /Users/ianh/Downloads/Visual Studio Code.app/Contents
    • Flutter extension version 3.82.0

[✓] Connected device (3 available)
    • macOS (desktop)                 • macos                 • darwin-arm64   • macOS 14.2.1 23C71 darwin-arm64
    • Mac Designed for iPad (desktop) • mac-designed-for-ipad • darwin         • macOS 14.2.1 23C71 darwin-arm64
    • Chrome (web)                    • chrome                • web-javascript • Google Chrome 121.0.6167.184

[✓] Network resources
    • All expected network resources are available.

! Doctor found issues in 3 categories.
ianh@coupari app % 
github-actions[bot] commented 8 months ago

This issue is stale because it has been open for 14 days with no activity.

amrgetment commented 8 months ago

+1 to remove stale label

github-actions[bot] commented 8 months ago

This issue is stale because it has been open for 14 days with no activity.

github-actions[bot] commented 8 months ago

This issue was closed because it has been inactive for 14 days since being marked as stale.

Hixie commented 8 months ago

I mean, the bug is still real, whether it's open or not. :-)

shubhamsinghshubham777 commented 2 months ago

+1 to remove stale label

+1

alterhuman commented 1 week ago

+1

filipraj08 commented 1 week ago

additionally macOS app can still be interacted with while picker is open which is not good. same happens with FilePicker.platform.saveFile