Skip to content
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

Migrate colors and icons variables to Enums #4180

Merged
merged 19 commits into from
Oct 29, 2024

Conversation

ndonkoHenri
Copy link
Contributor

Description

Fixes #4169

Test Code

import flet as ft

print(ft.colors.BLACK)
print(ft.colors.RED.with_opacity(0.5))
print(ft.colors.random())

print(ft.icons.WB_SUNNY)
print(ft.icons.random())


# deprecated - use random() instead
print(ft.icons.random_icon())
print(ft.colors.random_color())


# broken
print(ft.colors.with_opacity(0.5, "blue"))

Note

  • I named the enums colors and icons (lowercased) mainly for backward compatibility, however the python convention is to have class names in CapWords. We could actually have both then deprecate the lowercase.
  • Once we conclude with the right way to do this, I will proceed with updating the cupertino icons/colors then the controls with color-props.

@FeodorFitsner

This comment was marked as resolved.

@FeodorFitsner
Copy link
Contributor

I'm not sure about MaterialIcons and MaterialColors. Material is the default theme in Flet. I like just Colors and Icons more.

@FeodorFitsner
Copy link
Contributor

...and cupertino is rarely used, so let's leave Colors and Icons.

@FeodorFitsner FeodorFitsner merged commit 93cce26 into main Oct 29, 2024
2 checks passed
@FeodorFitsner FeodorFitsner deleted the henri/colors-and-icons-as-enum branch October 29, 2024 23:10
pengwon added a commit to pengwon/flet that referenced this pull request Oct 30, 2024
* main: (31 commits)
  Migrate `colors` and `icons` variables to Enums (flet-dev#4180)
  feat: expose more properties in Controls (flet-dev#4105)
  feat!: Refactor `Badge` Control to a Dataclass; create new `Control.badge` property (flet-dev#4077)
  fix: clicking on `CupertinoContextMenuAction` doesn't close context menu (flet-dev#3948)
  fix dropdown `max_menu_height` (flet-dev#3974)
  Fix undefined name "Future" --> asyncio.Future (flet-dev#4230)
  wrap ListTile in material widget (flet-dev#4206)
  Update CONTRIBUTING.md (flet-dev#4208)
  TextField: suffix_icon, prefix_icon and icon can be Control or str (flet-dev#4173)
  feat!: enhance `Map` control (flet-dev#3994)
  skip running flutter doctor on windows if no_rich_output is True (flet-dev#4108)
  add --pyinstaller-build-args to pack cli command (flet-dev#4187)
  fix/feat: make `SearchBar`'s view height adjustable; add new properties (flet-dev#4039)
  fix: prevent button `style` from being modified in `before_update()` (flet-dev#4181)
  fix: disabling filled buttons is not visually respected (flet-dev#4090)
  when `label` is set, use `MainAxisSize.min` for the `Row` (flet-dev#3998)
  fix: `NavigationBarDestination.disabled` has no visual effect (flet-dev#4073)
  fix autofill in CupertinoTextField (flet-dev#4103)
  Linechart: jsonDecode tooltip before displaying (flet-dev#4069)
  fixed bgcolor, color and elevation (flet-dev#4126)
  ...
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.

Migrate colors and icons to Enums
2 participants