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

Fix issues with *Buttons #3582

Merged
merged 5 commits into from
Jul 5, 2024
Merged

Fix issues with *Buttons #3582

merged 5 commits into from
Jul 5, 2024

Conversation

ndonkoHenri
Copy link
Contributor

@ndonkoHenri ndonkoHenri commented Jul 2, 2024

Fixes #3573

  • Deprecated ThemeVisualDensity in favor of VisualDensity

Summary by Sourcery

This pull request addresses multiple issues with button components by adding new style properties, fixing color and elevation handling when disabled, and refactoring code for better readability and consistency. It also introduces new enums for visual density settings and ensures proper handling of deprecated enums.

  • New Features:
    • Added support for new button style properties including iconColor, alignment, enableFeedback, textStyle, iconSize, visualDensity, and mouseCursor.
    • Introduced ThemeVisualDensity and VisualDensity enums to handle visual density settings.
  • Bug Fixes:
    • Fixed issues with button color, background color, and elevation not being set correctly when disabled.
    • Resolved inconsistencies in CupertinoButton's icon color handling when disabled.
  • Enhancements:
    • Refactored button style parsing to include additional properties and improve readability.
    • Updated various button components to ensure text, icon, or visible content is provided before rendering.
    • Improved handling of deprecated MaterialState and ThemeVisualDensity enums with warnings and replacements.

Copy link
Contributor

sourcery-ai bot commented Jul 2, 2024

Reviewer's Guide by Sourcery

This pull request addresses issues with various button components by adding new properties, refactoring existing methods, and ensuring compatibility with both 'ThemeVisualDensity' and 'VisualDensity' enums. Key changes include updates to button style parsing, handling of disabled states, and assertions for minimum content requirements.

File-Level Changes

Files Changes
sdk/python/packages/flet-core/src/flet_core/types.py
sdk/python/packages/flet-core/src/flet_core/theme.py
sdk/python/packages/flet-core/src/flet_core/buttons.py
sdk/python/packages/flet-core/src/flet_core/chip.py
sdk/python/packages/flet-core/src/flet_core/checkbox.py
sdk/python/packages/flet-core/src/flet_core/expansion_tile.py
sdk/python/packages/flet-core/src/flet_core/list_tile.py
sdk/python/packages/flet-core/src/flet_core/radio.py
sdk/python/packages/flet-core/src/flet_core/icon_button.py
Updated various components to support both 'ThemeVisualDensity' and 'VisualDensity' enums.
sdk/python/packages/flet-core/src/flet_core/cupertino_filled_button.py
sdk/python/packages/flet-core/src/flet_core/cupertino_button.py
sdk/python/packages/flet-core/src/flet_core/floating_action_button.py
sdk/python/packages/flet-core/src/flet_core/outlined_button.py
Reorganized constructor parameters and added assertions for minimum content requirements.

Tips
  • Trigger a new Sourcery review by commenting @sourcery-ai review on the pull request.
  • Continue your discussion with Sourcery by replying directly to review comments.
  • You can change your review settings at any time by accessing your dashboard:
    • Enable or disable the Sourcery-generated pull request summary or reviewer's guide;
    • Change the review language;
  • You can always contact us if you have any questions or feedback.

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.

Hey @ndonkoHenri - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟡 General issues: 3 issues found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.

if any([self.__color, self.__bgcolor, self.__elevation]):
self.__style = self.__style or ButtonStyle()
if self.__style:
self.__style.color = (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (code-quality): Extract code out into method (extract-method)

@FeodorFitsner FeodorFitsner merged commit aa7148b into main Jul 5, 2024
2 checks passed
@ndonkoHenri ndonkoHenri deleted the fix-button-styles branch July 5, 2024 23:53
zrr1999 pushed a commit to zrr1999/flet that referenced this pull request Jul 17, 2024
* BorderSide: add stroke_align prop

* proper styling in buttons

* deprecate ThemeVisualDensity in favor of VisualDensity

* ButtonStyle: new props

* deprecation: disabled_color is renamed to disabled_bgcolor
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.

Filled and FilledTonal Buttons bgcolor stuck on default color
2 participants