Skip to content

feat(FilePicker): add compression_quality and cancel_upload_on_window_blur to pick_files()#6573

Merged
FeodorFitsner merged 11 commits into
flet-0.86from
file-picker-improvements
Jun 18, 2026
Merged

feat(FilePicker): add compression_quality and cancel_upload_on_window_blur to pick_files()#6573
FeodorFitsner merged 11 commits into
flet-0.86from
file-picker-improvements

Conversation

@ndonkoHenri

@ndonkoHenri ndonkoHenri commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Upgrades the file_picker package from ^10.3.10 to ^11.0.2 (migrating to its new static API — FilePicker.pickFiles() instead of FilePicker.platform.pickFiles()) and exposes some of its capabilities:

  • New FilePicker.pick_files() parameters:
    • compression_quality: int = 0 — image compression quality from 0 to 100, used on supported platforms. 0 (default) disables compression.
    • cancel_upload_on_window_blur: bool = True — web-only. Controls whether browser window blur is treated as a cancelled selection. Passing False prevents valid file selections from being reported as cancelled when the window loses focus during picking on slow machines or slow network shares. Fixes FilePicker times out when picking files on a slow network #771.
  • FilePicker.save_file() documentation now reflects actual desktop behavior: the dialog returns the chosen path and, if src_bytes is provided, those bytes are written to the selected file (instead of claiming the file is never created).
  • FloatingActionButtonLocation enum members now each have proper API docs instead of a bare link to the Flutter docs.

Summary by Sourcery

Add configurable image compression and window-blur handling to file picking, align FilePicker usage with the new static API, and improve related documentation.

New Features:

  • Expose a compression_quality parameter on FilePicker.pick_files() to control image compression level on supported platforms.
  • Expose a cancel_upload_on_window_blur parameter on FilePicker.pick_files() to control how web treats browser window blur during file selection.

Bug Fixes:

  • Prevent valid web file selections from being reported as cancelled on slow machines or network shares by allowing cancel_upload_on_window_blur to be disabled.

Enhancements:

  • Update FilePicker service to use the new static FilePicker API for picking, saving, and directory selection.
  • Enhance FloatingActionButtonLocation enum members with detailed API documentation for each location variant.

Build:

  • Bump the file_picker dependency from ^10.3.10 to ^11.0.2.

Documentation:

  • Clarify FilePicker.save_file() desktop behavior to note that providing src_bytes writes those bytes to the selected file.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 11, 2026

Copy link
Copy Markdown

Deploying flet-website-v2 with  Cloudflare Pages  Cloudflare Pages

Latest commit: 1a49bfd
Status: ✅  Deploy successful!
Preview URL: https://9db4990f.flet-website-v2.pages.dev
Branch Preview URL: https://file-picker-improvements.flet-website-v2.pages.dev

View logs

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've reviewed this pull request using the Sourcery rules engine

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR upgrades the Flutter file_picker dependency and adapts the Dart service to the new static FilePicker.* API, while exposing new pick_files() capabilities to the Python SDK and improving related API documentation.

Changes:

  • Bump Flutter file_picker from ^10.3.10 to ^11.0.2 and migrate service calls to FilePicker.pickFiles()/saveFile()/getDirectoryPath().
  • Add compression_quality and cancel_upload_on_window_blur parameters to Python FilePicker.pick_files() and forward them through to the Flutter service.
  • Improve Python API documentation (FilePicker.save_file behavior; richer docs for FloatingActionButtonLocation enum members).

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
sdk/python/packages/flet/src/flet/controls/types.py Adds detailed per-enum-member docs for FloatingActionButtonLocation.
sdk/python/packages/flet/src/flet/controls/services/file_picker.py Adds new pick_files() parameters, forwards them to the backend, and updates save_file() docs.
packages/flet/pubspec.yaml Upgrades file_picker dependency to ^11.0.2.
packages/flet/lib/src/services/file_picker.dart Migrates to FilePicker static API and wires new pick-files arguments.
CHANGELOG.md Documents the new parameters and the web blur-cancel workaround (Issue #771).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/flet/lib/src/services/file_picker.dart
Comment thread packages/flet/lib/src/services/file_picker.dart
Comment thread sdk/python/packages/flet/src/flet/controls/services/file_picker.py
@FeodorFitsner

Copy link
Copy Markdown
Contributor

Re-target it to flet-0.86

@ndonkoHenri ndonkoHenri changed the base branch from main to flet-0.86 June 18, 2026 14:22
@FeodorFitsner FeodorFitsner merged commit ea7435c into flet-0.86 Jun 18, 2026
52 of 162 checks passed
@FeodorFitsner FeodorFitsner deleted the file-picker-improvements branch June 18, 2026 14:57
FeodorFitsner added a commit that referenced this pull request Jun 18, 2026
Pulls 6 commits from the flet-0.86 release branch:

* feat(FilePicker): compression_quality + cancel_upload_on_window_blur
  on pick_files() (#6573)
* fix(android): pickFirsts libc++_shared.so (#6571)
* chore: docs + code improvements across packages/flet Dart controls
  (#6589)
* fix(typing): explicit handler signatures in PubSubClient (#6564)
* feat(cli): flet clean command + deprecate --clear-cache (#6590)
* fix(flet-secure-storage): bump flutter_secure_storage 10.0.0 ->
  10.3.1 (#6586)

Conflicts and resolutions:

* sdk/python/templates/build/{{cookiecutter.out_dir}}/android/app/build.gradle.kts
  flet-0.86's #6571 reinstates useLegacyPackaging + keepDebugSymbols +
  pickFirsts inside packaging.jniLibs. dart-bridge intentionally dropped
  useLegacyPackaging / keepDebugSymbols because serious_python's new
  native-mmap loader makes them redundant (CHANGELOG 0.86.0 Improvements).
  The libc++_shared.so collision is a different problem (multi-plugin
  jniLibs duplication, not Python extraction), so keep just the pickFirsts
  block. Restructured the packaging block I added in the previous commit
  so pickFirsts is unconditional and excludes stays gated on
  android_excluded_abis.

* CHANGELOG.md
  Merged the new-features and bug-fixes sections preserving entries from
  both branches: dart-bridge's DataChannel + in-process dart_bridge +
  multi-version Python (with the corrected 314.0.0 GA / sp >= 3.0.0
  blurb that supersedes flet-0.86's 314.0.0a2 / sp >= 2.0.0 stub),
  plus flet-0.86's flet clean, compression_quality, libc++_shared fix,
  PubSubClient typing, and FilePicker pick_files entry. Documentation
  subsection from flet-0.86 added.

* sdk/python/packages/flet-secure-storage/.../pubspec.yaml
  Took flet-0.86's pinned `flutter_secure_storage: 10.3.1` over
  dart-bridge's `^10.0.0` caret range.

* website/docs/updates/breaking-changes/index.md
  Kept dart-bridge's #### Breaking changes subsection and added
  flet-0.86's #### Deprecations subsection beneath it.

* tests/test_python_versions.py (post-merge follow-up, not a conflict)
  Updated the local fixture manifest to carry android_abis on every
  row. Required because the manifest-driven PythonRelease parser no
  longer falls back to an inferred ABI list — the fixtures must reflect
  the same schema as python-build's 20260618+ releases.

Verification: ruff clean on touched files; 62 flet-cli unit tests pass;
imports succeed for build_base, build, clean, python_versions, android.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FilePicker times out when picking files on a slow network

3 participants