Skip to content

Conversation

@FeodorFitsner
Copy link
Contributor

@FeodorFitsner FeodorFitsner commented Oct 27, 2025

Summary by Sourcery

Rename black and white opacity enum members to include an underscore, introduce a deprecation meta to alias and warn on the old names, update internal imports and utility exports, refine attribute setting in Observable, and adjust documentation and examples to use the new color names.

New Features:

  • Add DeprecatedEnumMeta to enable deprecation aliases for enum members.

Enhancements:

  • Rename Colors.BLACK{n} and Colors.WHITE{n} to Colors.BLACK_{n} and Colors.WHITE_{n} with backward‐compatible aliasing.
  • Reorganize exported utilities in all for consistency.

Documentation:

  • Update code examples and documentation to reference the new color enum names.
  • Correct example_images path for SubmenuButton documentation.

Chores:

  • Simplify Observable.setattr logic to set attributes before change detection.

Corrects logic in Observable to set attribute directly if it does not exist, preventing unnecessary value comparison and notification for new attributes.
Simplifies logic for setting attributes by removing redundant checks and directly handling cases where the attribute may not exist. This improves code clarity and maintains correct notification behavior.
Moves attribute assignment before value comparison in Observable.__setattr__ to ensure correct notification behavior when attribute values change.
Introduced DeprecatedEnumMeta to support deprecated enum members and added deprecated color aliases to the Colors enum for backward compatibility. Deprecated aliases now emit a DeprecationWarning and redirect to the new member names. Also updated __all__ and imports to expose DeprecatedEnumMeta.
Replaces deprecated color constants like BLACK54, WHITE24, etc. with their new underscore-named versions (e.g., BLACK_54, WHITE_24) across all example, tutorial, and documentation files for consistency with the latest Flet API.
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a 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

@FeodorFitsner FeodorFitsner changed the title v1: Replace Colors.BLACK{shade} with Colors.BLACK_{shade}, Colors.WHITE{shade} with Colors.WHITE_{shade} v1: Replace Colors.BLACK{shade} with BLACK_{shade}, WHITE{shade} with WHITE_{shade} Oct 27, 2025
@cloudflare-workers-and-pages
Copy link

Deploying flet-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: a386059
Status: ✅  Deploy successful!
Preview URL: https://61ddb42a.flet-docs.pages.dev
Branch Preview URL: https://v1-color-deprecations.flet-docs.pages.dev

View logs

@ndonkoHenri
Copy link
Contributor

ndonkoHenri commented Oct 28, 2025

#5736 (comment)
Please can you mention this info on dismissible key in docs, if its not already? Seems important info to me.

@FeodorFitsner
Copy link
Contributor Author

#5736 (comment) Please can you mention this info on dismissible key in docs, if its not already? Seems important info to me.

Sure, it's already here: https://docs.flet.dev/controls/dismissible/?h=dismiss#remove-dismissible-on_dismiss-inside-component

Added a TODO comment indicating that deprecated color aliases should be removed in Flet 1.0. This helps track planned cleanup for future releases.
@FeodorFitsner FeodorFitsner merged commit dcf9396 into main Oct 28, 2025
15 of 36 checks passed
@FeodorFitsner FeodorFitsner deleted the v1-color-deprecations branch October 28, 2025 16:19
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.

3 participants