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

Customize colors of Checkbox and Radio #320

Closed
YutaRedux opened this issue Sep 14, 2022 · 6 comments
Closed

Customize colors of Checkbox and Radio #320

YutaRedux opened this issue Sep 14, 2022 · 6 comments
Milestone

Comments

@YutaRedux
Copy link

There is no color property in the Checkbox control. Therefore, no way to customize the color of a checkbox.
This gives me a lot of pain and just because of that I need to place my widgets on a dark card.
Is it THAT HARD to make colors customizable?

@hololeo
Copy link

hololeo commented Sep 14, 2022

possible workaround: Can you create a checkbox without a label and put it in a row with a text control with color of your choice? Wrap that together in a custom control?

yeah not ideal but in theory...

@FeodorFitsner
Copy link
Contributor

I'm sorry for your pain. It's not "that hard" to implement - you could just kindly ask, no need to complain right away.

@FeodorFitsner FeodorFitsner changed the title Cannot customize color of Checkbox Customize colors of Checkbox Sep 14, 2022
@ndonkoHenri
Copy link
Contributor

possible workaround: Can you create a checkbox without a label and put it in a row with a text control with color of your choice? Wrap that together in a custom control?

I think he/she meant the color of the checkbox itself, not that of the associated label.

@ndonkoHenri
Copy link
Contributor

I'm sorry for your pain. It's not "that hard" to implement - you could just kindly ask, no need to complain right away.

"Not that hard"? I am impressed!
I still don't understand how the flutter widgets are converted for use in python code. And I am so curious to know that someday.
Please, Try making a video showing how this is done. I think this may attract Flutter guys who are also proficient Pythoneers, so they could contribute to Flet's development.

@FeodorFitsner FeodorFitsner added this to the Controls-S2 milestone Sep 20, 2022
@FeodorFitsner FeodorFitsner changed the title Customize colors of Checkbox Customize colors of Checkbox and Radio Sep 25, 2022
@FeodorFitsner FeodorFitsner added the status: working on it Working on a fix for the issue label Oct 6, 2022
@FeodorFitsner
Copy link
Contributor

Added new properties:

  • Checkbox.check_color
  • Checkbox.fill_color
  • Radio.fill_color

Styled checkbox example:

import flet
from flet import Checkbox, Page

def main(page: Page):
    page.add(
        Checkbox(label="Checkbox with default style"),
        Checkbox(
            label="Checkbox with constant fill color",
            fill_color="red",
            check_color="yellow",
        ),
        Checkbox(
            label="Checkbox with dynamic fill color",
            fill_color={"hovered": "blue", "selected": "green", "": "red"},
        ),
    )

flet.app(target=main)

Styled radio example:

import flet
from flet import Column, Page, Radio, RadioGroup

def main(page: Page):
    page.add(
        RadioGroup(
            Column(
                [
                    Radio(label="Radio with default style", value="1"),
                    Radio(
                        label="Radio with constant fill color",
                        value="2",
                        fill_color="red",
                    ),
                    Radio(
                        label="Radio with dynamic fill color",
                        value="3",
                        fill_color={"hovered": "blue", "selected": "green", "": "red"},
                    ),
                ]
            )
        )
    )

flet.app(target=main)

FeodorFitsner added a commit that referenced this issue Oct 6, 2022
@FeodorFitsner FeodorFitsner removed the status: working on it Working on a fix for the issue label Oct 11, 2022
@llealcode
Copy link

Como personalizar a cor da label do RADIO? Consegui entender que posso alterar a cor da seleção, mas quero entender como posso fazer isso com LABEL

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

No branches or pull requests

5 participants