-
Notifications
You must be signed in to change notification settings - Fork 600
v1 fix: Update properties or actions of opened AlertDialog #5547
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
Removed deprecated 'open' and 'close' methods in favor of 'show_dialog' and 'pop_dialog'. Enhanced 'show_dialog' to better manage dialog lifecycle and dismissal, including improved event handling and error checking. Updated docstrings for clarity and maintainability. Fix #5439
Replaces direct widget construction with ControlInheritedNotifier in both AlertDialogControl and CupertinoAlertDialogControl for improved state management. Error handling is now managed via a string error message instead of an ErrorControl widget instance.
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've reviewed this pull request using the Sourcery rules engine
Deploying flet-docs with
|
| Latest commit: |
11041c2
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://470ea8bf.flet-docs.pages.dev |
| Branch Preview URL: | https://v1-alert-dialog-fix.flet-docs.pages.dev |
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 fixes issues with updating properties or actions of opened AlertDialog, CupertinoAlertDialog, and Banner controls by replacing cached dialog instances with live rebuilding through ControlInheritedNotifier. The fix addresses stale dialog instances and improves the Python SDK dialog lifecycle methods.
- Replaces cached
_dialogfields withControlInheritedNotifierwrapper for live updates - Improves Python SDK dialog methods by removing deprecated functions and enhancing async handling
- Adds integration tests to verify dynamic dialog property updates
Reviewed Changes
Copilot reviewed 6 out of 10 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
sdk/python/packages/flet/src/flet/controls/base_page.py |
Removes deprecated methods, enhances show_dialog/pop_dialog with better async handling and documentation |
packages/flet/lib/src/controls/alert_dialog.dart |
Wraps dialog in ControlInheritedNotifier for live updates, removes cached _dialog field |
packages/flet/lib/src/controls/cupertino_alert_dialog.dart |
Similar changes to AlertDialog - adds ControlInheritedNotifier wrapper and removes caching |
packages/flet/lib/src/controls/banner.dart |
Simplifies banner creation by removing caching and using direct error string handling |
sdk/python/packages/flet/integration_tests/controls/test_alert_dialog.py |
Adds test for dynamic dialog property updates with screenshots |
sdk/python/packages/flet/integration_tests/controls/test_cupertino_alert_dialog.py |
Adds test for dynamic Cupertino dialog action updates with screenshots |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Fix #5487
Fix #5439
Summary by Sourcery
Enable live updates of AlertDialog, CupertinoAlertDialog, and Banner controls by rebuilding them via ControlInheritedNotifier instead of caching, add error handling for missing content, and enhance the Python SDK dialog lifecycle methods by removing deprecated Page.open/close and improving show_dialog/pop_dialog docstrings and async on_dismiss handling.
Bug Fixes:
Enhancements:
Documentation: