v1: Web Multi-View - embedding Flet web app into existing web page#5274
Merged
FeodorFitsner merged 31 commits intov1from May 6, 2025
Merged
v1: Web Multi-View - embedding Flet web app into existing web page#5274FeodorFitsner merged 31 commits intov1from
FeodorFitsner merged 31 commits intov1from
Conversation
ndonkoHenri
reviewed
May 4, 2025
ndonkoHenri
reviewed
May 4, 2025
ndonkoHenri
reviewed
May 4, 2025
ndonkoHenri
reviewed
May 4, 2025
ndonkoHenri
reviewed
May 4, 2025
ndonkoHenri
reviewed
May 4, 2025
ndonkoHenri
reviewed
May 4, 2025
ndonkoHenri
reviewed
May 4, 2025
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds multi-view support to allow embedding Flet web apps into existing web pages while improving the application's configuration and initialization flow.
- Introduces a new multi-view initialization mechanism with initial data passing and view constraints.
- Refactors configuration handling in both the worker setup and Flutter bootstrap process.
- Cleans up meta tags and inline configurations in the main HTML file.
Reviewed Changes
Copilot reviewed 28 out of 45 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| client/web/python.js | Updated worker initialization to use flet configuration values. |
| client/web/index.html | Replaced meta tags with a flet config object and added multi-view initialization. |
| client/web/flutter_bootstrap.js | Refactored configuration merging and Flutter app bootstrap using a new config object. |
Files not reviewed (17)
- client/lib/main.dart: Language not supported
- packages/flet/lib/flet.dart: Language not supported
- packages/flet/lib/src/controls/circle_avatar.dart: Language not supported
- packages/flet/lib/src/controls/markdown.dart: Language not supported
- packages/flet/lib/src/controls/page.dart: Language not supported
- packages/flet/lib/src/controls/view.dart: Language not supported
- packages/flet/lib/src/flet_app.dart: Language not supported
- packages/flet/lib/src/flet_backend.dart: Language not supported
- packages/flet/lib/src/models/multi_view.dart: Language not supported
- packages/flet/lib/src/models/page_args_model.dart: Language not supported
- packages/flet/lib/src/utils/locale.dart: Language not supported
- packages/flet/lib/src/utils/platform_utils_non_web.dart: Language not supported
- packages/flet/lib/src/utils/platform_utils_web.dart: Language not supported
- packages/flet/lib/src/utils/session_store_web.dart: Language not supported
- packages/flet/lib/src/widgets/flet_app_context.dart: Language not supported
- packages/flet/lib/src/widgets/flet_store_mixin.dart: Language not supported
- packages/flet/lib/src/widgets/page_context.dart: Language not supported
Comments suppressed due to low confidence (1)
client/web/python.js:33
- Ensure that the 'flet.noCdn' flag is set intentionally and that 'flet.pyodideUrl' is guaranteed to be defined when noCdn is true.
pyodideUrl: flet.noCdn ? flet.pyodideUrl : defaultPyodideUrl,
| }, | ||
| viewConstraints: { | ||
| minWidth: 620, | ||
| //maxWidth: 320, |
There was a problem hiding this comment.
[nitpick] If the commented-out view constraint is no longer required, consider removing it to improve code clarity; otherwise, add a clarifying comment explaining its purpose.
Suggested change
| //maxWidth: 320, |
ndonkoHenri
reviewed
May 5, 2025
|
|
||
| src: OptionalString = None | ||
| src_base64: OptionalString = None | ||
| src_bytes: Optional[bytes] = None |
Contributor
There was a problem hiding this comment.
We should perhaps think of having just one src prop, and have intelligent ifs on dart end.
ndonkoHenri
reviewed
May 5, 2025
sdk/python/packages/flet-web/src/flet_web/fastapi/serve_fastapi_web_app.py
Outdated
Show resolved
Hide resolved
ndonkoHenri
reviewed
May 5, 2025
sdk/python/packages/flet-web/src/flet_web/fastapi/serve_fastapi_web_app.py
Outdated
Show resolved
Hide resolved
ndonkoHenri
reviewed
May 5, 2025
sdk/python/packages/flet/src/flet/controls/services/file_picker.py
Outdated
Show resolved
Hide resolved
Breaking changes: DragTarget.on_will_accept is of `DragWillAcceptEvent` type with `accept: bool` field. Use `e.accept` instead of `e.data`. DragTarget.on_leave is of `DragTargetLeaveEvent` type with `src_id` field. Use `e.src_id` instead of `e.data`.
ndonkoHenri
reviewed
May 6, 2025
ndonkoHenri
reviewed
May 6, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary by Human
before_mainA new
before_mainarg added toft.run().before_mainis a hook that allows to reliable configure page-level event handlers before Flutter client starts sending events.before_mainis a function that accepts one parameter:page: ft.PageExample usage:
Summary by Sourcery
Implement Web Multi-View support for embedding Flet web apps into existing web pages
New Features:
Enhancements:
Chores: