flutter_file_picker icon indicating copy to clipboard operation
flutter_file_picker copied to clipboard

pickFiles dialog does not receive focus on macOS

Open Hixie opened this issue 1 year ago • 6 comments

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

  • [ ] Android
  • [ ] iOS
  • [ ] Web
  • [x] Desktop

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 [email protected]: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 % 

Hixie avatar Feb 13 '24 22:02 Hixie

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

github-actions[bot] avatar Feb 21 '24 01:02 github-actions[bot]

+1 to remove stale label

amrgetment avatar Feb 21 '24 05:02 amrgetment

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

github-actions[bot] avatar Mar 01 '24 01:03 github-actions[bot]

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

github-actions[bot] avatar Mar 16 '24 01:03 github-actions[bot]

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

Hixie avatar Mar 18 '24 21:03 Hixie