-
Notifications
You must be signed in to change notification settings - Fork 536
v1: patches + enhancements #5254
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
…structive_action` to `destructive`
…structive_action` to `destructive`
attempts to fix a bug that occured in below code: ```py ft.AlertDialog( adaptive=True, content=ft.Column( controls=[ ft.TextField(), ft.TextField(), ], ) ) ```
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 refactors event handling and updates Cupertino and related controls by standardizing property names, improving layout behavior, and deprecating outdated APIs. Key changes include:
- Replacing legacy action properties with standardized names (“default” and “destructive”) and adding content validation.
- Refactoring event dataclasses by moving them to an events module and updating related import statements.
- Updating default animations, deprecation messages, and minor documentation (e.g. pubspec.yaml comments).
Reviewed Changes
Copilot reviewed 13 out of 25 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
sdk/python/packages/flet/src/flet/controls/cupertino/cupertino_context_menu_action.py | Replaces legacy action properties and adds a before_update content assertion. |
sdk/python/packages/flet/src/flet/controls/cupertino/cupertino_alert_dialog.py | Updates title type and inset animation default, with an enhanced before_update assertion. |
sdk/python/packages/flet/src/flet/controls/cupertino/cupertino_action_sheet_action.py | Standardizes action property names and improves assertion message clarity. |
sdk/python/packages/flet/src/flet/controls/core/interactive_viewer.py | Updates event handler import and assignment style for consistency. |
sdk/python/packages/flet/src/flet/controls/core/gesture_detector.py | Removes duplicate event dataclass definitions and updates event handler assignments. |
sdk/python/packages/flet/src/flet/controls/border.py | Revises deprecation messages for border utility functions. |
sdk/python/packages/flet/src/flet/init.py | Updates top-level control imports to align with recent refactors. |
packages/flet/pubspec.yaml | Minor documentation update regarding supported platforms. |
Files not reviewed (12)
- client/lib/main.dart: Language not supported
- packages/flet/lib/src/controls/button.dart: Language not supported
- packages/flet/lib/src/controls/cupertino_action_sheet_action.dart: Language not supported
- packages/flet/lib/src/controls/cupertino_alert_dialog.dart: Language not supported
- packages/flet/lib/src/controls/cupertino_context_menu_action.dart: Language not supported
- packages/flet/lib/src/controls/cupertino_dialog_action.dart: Language not supported
- packages/flet/lib/src/controls/cupertino_textfield.dart: Language not supported
- packages/flet/lib/src/controls/dropdownm2.dart: Language not supported
- packages/flet/lib/src/controls/list_tile.dart: Language not supported
- packages/flet/lib/src/controls/textfield.dart: Language not supported
- packages/flet/lib/src/utils/events.dart: Language not supported
- packages/flet/lib/src/utils/textfield.dart: Language not supported
Comments suppressed due to low confidence (1)
sdk/python/packages/flet/src/flet/controls/cupertino/cupertino_alert_dialog.py:110
- The assertion in before_update may throw an AttributeError if self.title is None since it attempts to access the 'visible' attribute. Consider checking that self.title is not None before evaluating its 'visible' property.
assert ((isinstance(self.title, str) or self.title.visible) or (self.content and self.content.visible) or any(a.visible for a in self.actions)), "AlertDialog has nothing to display. Provide at minimum one of the following: title, content, actions"
Summary by Sourcery
Refactor event handling, standardize Cupertino control properties, fix layout issues, and deprecate older APIs.
Bug Fixes:
options
instead ofcontrols
) when retrieving Dropdown options.Enhancements:
flet.controls.events
module.is_default_action
andis_destructive_action
properties todefault
anddestructive
across Cupertino action controls (CupertinoDialogAction
,CupertinoContextMenuAction
,CupertinoActionSheetAction
).CupertinoAlertDialog.title
to accept string values.inset_animation
toCupertinoAlertDialog
.Chores:
Page.open()
andPage.close()
in favor ofPage.show_dialog()
andPage.pop_dialog()
.all
,symmetric
,only
) in favor ofBorder
class methods (Border.all()
,Border.symmetric()
,Border.only()
).