-
Notifications
You must be signed in to change notification settings - Fork 3.5k
[file_selector] Implement canCreateDirectories on macos and linux #10443
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[file_selector] Implement canCreateDirectories on macos and linux #10443
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces the canCreateDirectories option across various platforms for the file_selector package. While the implementations for Linux and macOS seem complete with corresponding native changes and tests, there are some areas for improvement. Specifically, the Android and Web platforms are missing an implementation for getDirectoryPathsWithOptions, which could lead to runtime errors. On Android and Windows, the canCreateDirectories option is ignored in directory selection methods without documentation, which could be confusing. I've also noted some opportunities to reduce code duplication in the native tests for Linux and macOS to improve maintainability. My detailed feedback is in the comments below.
packages/file_selector/file_selector_android/lib/src/file_selector_android.dart
Outdated
Show resolved
Hide resolved
packages/file_selector/file_selector_web/lib/file_selector_web.dart
Outdated
Show resolved
Hide resolved
packages/file_selector/file_selector_linux/linux/test/file_selector_plugin_test.cc
Show resolved
Hide resolved
| let panelController = TestPanelController() | ||
| let plugin = FileSelectorPlugin( | ||
| viewProvider: TestViewProvider(), | ||
| panelController: panelController) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a lot of repeated setup code across your test cases (e.g., initializing TestPanelController and FileSelectorPlugin). You could reduce this duplication by moving the common setup into an override func setUp() method for the ExampleTests class. This would make the tests cleaner and easier to maintain.
packages/file_selector/file_selector_windows/lib/file_selector_windows.dart
Outdated
Show resolved
Hide resolved
5eb0740 to
b39655a
Compare
stuartmorgan-g
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@robert-ancell and @vashworth will do secondary review approvals for the two platforms.
| /// Nullable because it does not apply to the "save" action. | ||
| final bool? selectMultiple; | ||
|
|
||
| /// Whether to allow new folders creation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: folder
robert-ancell
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change looks good on Linux, thanks!
vashworth
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
macOS side LGTM
|
Linux repo_checks test is failing due to formatting: |
Weird, for some reason |
|
If you are running |
flutter/packages@b1e2fb0...e67b6be 2025-11-21 [email protected] [file_selector] Implement canCreateDirectories on macos and linux (flutter/packages#10443) 2025-11-21 [email protected] [various] Replace deprecated Color.value in SVG packages (flutter/packages#10482) 2025-11-20 [email protected] [pigeon] Fixes compilation error with unbounded type parameter for InstanceManager (flutter/packages#10483) 2025-11-20 [email protected] [webview_flutter] Replace deprecated Color.value (flutter/packages#10480) 2025-11-20 [email protected] [google_maps_flutter] Replace deprecated color APIs in platform interface (flutter/packages#10477) 2025-11-20 [email protected] Roll Flutter (stable) from b45fa18 to f5a8537 (12 revisions) (flutter/packages#10478) 2025-11-20 [email protected] Roll Flutter from de4be4f to 9f383e0 (21 revisions) (flutter/packages#10481) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages-flutter-autoroll Please CC [email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
…r#178927) flutter/packages@b1e2fb0...e67b6be 2025-11-21 [email protected] [file_selector] Implement canCreateDirectories on macos and linux (flutter/packages#10443) 2025-11-21 [email protected] [various] Replace deprecated Color.value in SVG packages (flutter/packages#10482) 2025-11-20 [email protected] [pigeon] Fixes compilation error with unbounded type parameter for InstanceManager (flutter/packages#10483) 2025-11-20 [email protected] [webview_flutter] Replace deprecated Color.value (flutter/packages#10480) 2025-11-20 [email protected] [google_maps_flutter] Replace deprecated color APIs in platform interface (flutter/packages#10477) 2025-11-20 [email protected] Roll Flutter (stable) from b45fa18 to f5a8537 (12 revisions) (flutter/packages#10478) 2025-11-20 [email protected] Roll Flutter from de4be4f to 9f383e0 (21 revisions) (flutter/packages#10481) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages-flutter-autoroll Please CC [email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Updates macos and linux
file_selectorplatforms to implement the newcanCreateDirectoriesparameter from platform interfaceUntil now, only macos and linux are able to override this parameter
This is the "platform implementations" step for #9965
Part of: flutter/flutter#141339
Pre-Review Checklist
[shared_preferences]pubspec.yamlwith an appropriate new version according to the pub versioning philosophy, or I have commented below to indicate which version change exemption this PR falls under1.CHANGELOG.mdto add a description of the change, following repository CHANGELOG style, or I have commented below to indicate which CHANGELOG exemption this PR falls under1.///).If you need help, consider asking for advice on the #hackers-new channel on Discord.
Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the
gemini-code-assistbot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.Footnotes
Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. ↩ ↩2 ↩3