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

Added TextStyle for the Text control #2270

Merged
merged 7 commits into from
Dec 30, 2023
Merged

Conversation

50Bytes-dev
Copy link
Contributor

Added TextStyle support for the Text control and added a height attribute for TextStyle

@CLAassistant
Copy link

CLAassistant commented Dec 27, 2023

CLA assistant check
All committers have signed the CLA.

@@ -137,7 +138,7 @@ def __init__(
size: OptionalNumber = None,
weight: Optional[FontWeight] = None,
italic: Optional[bool] = None,
style: Optional[TextThemeStyle] = None,
style: Optional[Union[TextThemeStyle, TextStyle]] = None,
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice idea! I'm not a big fan of mixing types though, but let's users decide! :)

Copy link
Contributor

@ndonkoHenri ndonkoHenri Dec 28, 2023

Choose a reason for hiding this comment

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

I think we should separate props. Perhaps create text_style and theme_style? - such that one can use both. Or it should not be permitted?

Copy link
Contributor

Choose a reason for hiding this comment

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

Since @ndonkoHenri noticed this 🫣 I'm not going to try convincing him that "it's OK like that" - let's have two separate properties 😏

Now, I'd love to have style property be of TextStyle to look the same as TextSpan.style, and then theme_style for named styles.

However, we don't want to break a lot of existing applications. I'm thinking what if we "temporary" make style property accepting both TextThemeStyle and TextStyle (like in this PR) and also add theme_style which accepts only TextThemeStyle. Will update docs for .style property to allow only TextStyle. What do you guys think?

Copy link
Contributor

Choose a reason for hiding this comment

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

@50Bytes-dev would you implement that (along with previous note) please?

@50Bytes-dev
Copy link
Contributor Author

@FeodorFitsner check it

@FeodorFitsner FeodorFitsner merged commit 6c4e475 into flet-dev:main Dec 30, 2023
2 checks passed
zrr1999 pushed a commit to zrr1999/flet that referenced this pull request Jul 17, 2024
* add TextStyle for Text

* fix

* add theme_style

* fix types

* fix types

* change to _before_build_command()

* fix
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.

4 participants