Skip to content

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

Merged
merged 10 commits into from
Apr 29, 2025
Merged

v1: patches + enhancements #5254

merged 10 commits into from
Apr 29, 2025

Conversation

ndonkoHenri
Copy link
Contributor

@ndonkoHenri ndonkoHenri commented Apr 28, 2025

Summary by Sourcery

Refactor event handling, standardize Cupertino control properties, fix layout issues, and deprecate older APIs.

Bug Fixes:

  • Fix layout behavior for TextField and CupertinoTextField to apply a default width when no explicit width is set.
  • Use the correct attribute name (options instead of controls) when retrieving Dropdown options.

Enhancements:

  • Refactor Python event dataclasses into a dedicated flet.controls.events module.
  • Refactor Dart pointer event handling, adding more event details.
  • Standardize is_default_action and is_destructive_action properties to default and destructive across Cupertino action controls (CupertinoDialogAction, CupertinoContextMenuAction, CupertinoActionSheetAction).
  • Add validation to ensure Cupertino action/dialog controls have content or actions to display before updating.
  • Allow CupertinoAlertDialog.title to accept string values.
  • Set ListTile's underlying Material type to transparency to avoid potential background color issues.
  • Add default inset_animation to CupertinoAlertDialog.

Chores:

  • Deprecate Page.open() and Page.close() in favor of Page.show_dialog() and Page.pop_dialog().
  • Deprecate standalone border utility functions (all, symmetric, only) in favor of Border class methods (Border.all(), Border.symmetric(), Border.only()).
  • Update Flet extension registration mechanism in the example client.

Copy link

@Copilot Copilot AI left a 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"

@FeodorFitsner FeodorFitsner merged commit 39a33a7 into v1 Apr 29, 2025
2 checks passed
@FeodorFitsner FeodorFitsner deleted the v1-fixes branch April 29, 2025 01:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants