Skip to content

Commit 8240267

Browse files
v1: Added GestureDetector events, error message customization (#5802)
* Add fullscreen_dialog property to View Introduces a fullscreen_dialog boolean property to the View class, allowing views to be marked as fullscreen modal dialogs. * Refactor gesture tap event handling Removed unused TapDownDetails state in Dart GestureDetector and simplified tap event triggers to not require tap down details. Updated Python GestureDetector to use ControlEventHandler for tap events instead of EventHandler for consistency and improved type safety. Fix #5786 * Add extended gesture event support to GestureDetector Expanded GestureDetector to support new gesture events including tap move/cancel, secondary/tertiary tap cancel, long press down/cancel/move update/up, secondary/tertiary long press variants, double tap cancel, drag down/cancel, pan down/cancel, and force press events. Updated Dart and Python event mapping, event classes, and control properties to enable richer gesture handling and event data propagation. * Refactor file picker usage in examples Updated file picker examples to use local instances instead of appending to page services. Introduced a State dataclass in pick_and_upload.py for better state management and improved code clarity. * Improve error handling and logging in session management Refactored error handling across Flet backend and Python SDK to use structured logging instead of print/traceback, and to propagate error messages more consistently to the client. Now, errors in before_main and event handlers are logged with stack traces and sent to the session, and session creation is aborted if before_main fails. Also fixed a bug in Dart backend where isLoading was incorrectly set on error. * Add customizable app error message template to FletApp Introduced the `FletApp.appErrorMessage` template to allow customization of loading screen error messages. Updated error handling to include stack traces for better debugging in Python and Dart backends. Adjusted UI components to use the formatted error message template. * Fix tab bar theme key in parseTheme function Corrects the key from 'tabs_theme' to 'tab_bar_theme' when parsing the tab bar theme in the parseTheme function, ensuring the correct theme property is used. * Refactor test window resizing to use resize_page Replaced direct assignments to page.window.width and page.window.height with calls to resize_page in integration tests. This improves consistency and maintainability of test setup. Also removed an unused import and updated golden image assets for markdown and snack bar tests. * Remove await from resize_page calls in integration tests Replaces 'await flet_app.resize_page(...)' with synchronous 'flet_app.resize_page(...)' in all integration test files. This change reflects an update to the resize_page method, which is now synchronous and no longer requires awaiting. * Add use_ref hook for mutable references in components Introduces the use_ref hook and MutableRef class to allow components to preserve mutable values across renders without causing re-renders. Updates __init__.py to export use_ref. * Add audio player example and update shake detector usage Added a new declarative audio player example using flet_audio. Updated the shake detector example to store the ShakeDetector instance in the session store instead of appending to services, ensuring a reference is held for session management. * Add documentation for use_ref type Created a new documentation page for the use_ref type and added it to the mkdocs navigation under types. * Add docstrings for FletApp class attributes Replaced placeholder 'TBD' docstrings with descriptive explanations for FletApp class attributes, improving code documentation and clarity. * Fix frozen flag handling in DiffBuilder and add test Corrects the use of the 'frozen' parameter in DiffBuilder methods to ensure it is passed through instead of being hardcoded. Adds a test to verify that lists with keys can be updated correctly.
1 parent e075a87 commit 8240267

File tree

99 files changed

+1033
-239
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+1033
-239
lines changed

CHANGELOG.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
* Controls in Python are now defined as plain dataclasses
1414
* Unified diffing algorithm supports both imperative and declarative styles
1515
* Refactored Flutter layer using inherited widgets and `Provider`
16+
* Added `FletApp.appErrorMessage` template to customize loading screen errors.
1617
* See the list of [breaking changes](https://github.com/flet-dev/flet/issues/5238)
1718

1819
## 0.28.3
@@ -703,7 +704,7 @@ from flet.auth.providers import GitHubOAuthProvider
703704
## 0.4.1
704705

705706
* Slider.round to round slider value on a label
706-
* Fix page.client_storage.get_keys() timeout
707+
* Fix page.client_storage.get_keys() timeout
707708
* Fix encode() import in PyInstaller integration
708709
* Fix "ConnectionAbortedError" error on Windows
709710
* Consistent licensing across the code - Apache 2.0
@@ -1115,4 +1116,4 @@ Fix ElevatedButton regression ([9540beb](https://github.com/flet-dev/flet/commit
11151116

11161117
## 0.1.4
11171118

1118-
* mkdir server/server/content
1119+
* mkdir server/server/content

client/lib/main.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ void main([List<String>? args]) async {
116116
errorsHandler: errorsHandler,
117117
showAppStartupScreen: true,
118118
appStartupScreenMessage: "Working...",
119+
appErrorMessage: "The application encountered an error: {message}",
119120
extensions: extensions,
120121
multiView: isMultiView(),
121122
tester: tester,

packages/flet/CHANGELOG.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
* Controls in Python are now defined as plain dataclasses
1212
* Unified diffing algorithm supports both imperative and declarative styles
1313
* Refactored Flutter layer using inherited widgets and `Provider`
14+
* Added `FletApp.appErrorMessage` template to customize loading screen errors.
1415
* See the list of [breaking changes](https://github.com/flet-dev/flet/issues/5238)
1516

1617
# 0.28.3
@@ -689,7 +690,7 @@ from flet.auth.providers import GitHubOAuthProvider
689690
## 0.4.1
690691

691692
* Slider.round to round slider value on a label
692-
* Fix page.client_storage.get_keys() timeout
693+
* Fix page.client_storage.get_keys() timeout
693694
* Fix encode() import in PyInstaller integration
694695
* Fix "ConnectionAbortedError" error on Windows
695696
* Consistent licensing across the code - Apache 2.0
@@ -792,4 +793,4 @@ from flet.auth.providers import GitHubOAuthProvider
792793
* removed all problems except dart:html problem because it needs material html kind of thing ([#461](https://github.com/flet-dev/flet/issues/461))
793794
* fix: ensure correct version is fetched in dev mode ([#443](https://github.com/flet-dev/flet/issues/443))
794795
* Fix controls setter for empty list input ([#454](https://github.com/flet-dev/flet/issues/454))
795-
* make ink=True behavior consistent with ink=False ([#427](https://github.com/flet-dev/flet/issues/427))
796+
* make ink=True behavior consistent with ink=False ([#427](https://github.com/flet-dev/flet/issues/427))

packages/flet/lib/src/controls/flet_app_control.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ class _FletAppControlState extends State<FletAppControl> {
3131
widget.control.getBool("show_app_startup_screen");
3232
var appStartupScreenMessage =
3333
widget.control.getString("app_startup_screen_message");
34+
var appErrorMessage = widget.control.getString("app_error_message");
3435

3536
return LayoutControl(
3637
control: widget.control,
@@ -40,6 +41,7 @@ class _FletAppControlState extends State<FletAppControl> {
4041
reconnectTimeoutMs: reconnectTimeoutMs,
4142
showAppStartupScreen: showAppStartupScreen,
4243
appStartupScreenMessage: appStartupScreenMessage,
44+
appErrorMessage: appErrorMessage,
4345
pageUrl: url,
4446
assetsDir: "",
4547
errorsHandler: _errorsHandler,

0 commit comments

Comments
 (0)