-
Notifications
You must be signed in to change notification settings - Fork 536
v1: Web Multi-View - embedding Flet web app into existing web page #5274
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
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[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.
//maxWidth: 320, |
Copilot uses AI. Check for mistakes.
@@ -48,6 +48,7 @@ def main(page: ft.Page): | |||
|
|||
src: OptionalString = None | |||
src_base64: OptionalString = None | |||
src_bytes: Optional[bytes] = None |
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.
We should perhaps think of having just one src
prop, and have intelligent ifs on dart end.
sdk/python/packages/flet-web/src/flet_web/fastapi/serve_fastapi_web_app.py
Outdated
Show resolved
Hide resolved
sdk/python/packages/flet-web/src/flet_web/fastapi/serve_fastapi_web_app.py
Outdated
Show resolved
Hide resolved
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`.
Summary by Human
before_main
A new
before_main
arg added toft.run()
.before_main
is a hook that allows to reliable configure page-level event handlers before Flutter client starts sending events.before_main
is a function that accepts one parameter:page: ft.Page
Example usage:
Summary by Sourcery
Implement Web Multi-View support for embedding Flet web apps into existing web pages
New Features:
Enhancements:
Chores: