Skip to content

user customized style for SegmentedButton not wrapped #4313

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

Closed
1 task done
lixxu opened this issue Nov 6, 2024 · 0 comments · Fixed by #4314
Closed
1 task done

user customized style for SegmentedButton not wrapped #4313

lixxu opened this issue Nov 6, 2024 · 0 comments · Fixed by #4314
Assignees
Labels
bug Something isn't working

Comments

@lixxu
Copy link
Contributor

lixxu commented Nov 6, 2024

Duplicate Check

Describe the bug

user cutomized style is not working in SegmentButton
image

Code sample

Code
import flet as ft


def main(page: ft.Page):
    page.window.width = 800
    page.window.height = 500
    page.window.alignment = ft.alignment.center

    def handle_change(e):
        print("on_change data : " + str(e.data))

    def on_error(e) -> None:
        print("error: ", e.data)

    page.on_error = on_error

    style = ft.ButtonStyle(shape=ft.RoundedRectangleBorder(radius=5))
    page.add(
        ft.SegmentedButton(
            on_change=handle_change,
            selected_icon=ft.Icon(ft.icons.ONETWOTHREE),
            selected={"1", "4"},
            allow_multiple_selection=True,
            style=style,
            segments=[
                ft.Segment(
                    value="1",
                    label=ft.Text("1"),
                    icon=ft.Icon(ft.icons.LOOKS_ONE),
                ),
                ft.Segment(
                    value="2",
                    label=ft.Text("2"),
                    icon=ft.Icon(ft.icons.LOOKS_TWO),
                ),
                ft.Segment(
                    value="3",
                    label=ft.Text("3"),
                    icon=ft.Icon(ft.icons.LOOKS_3),
                ),
                ft.Segment(
                    value="4",
                    label=ft.Text("4"),
                    icon=ft.Icon(ft.icons.LOOKS_4),
                ),
            ],
        )
    )


ft.app(main)

To reproduce

pass customized style to SegmentedButton (style has customized attribute value, e.g. style = ft.ButtonStyle(shape=ft.RoundedRectangleBorder(radius=5)))

Expected behavior

SegmentedButton has RoundedRectangleBorder

Screenshots / Videos

Captures

[Upload media here]
Code_2eBKOg7ESB

Operating System

Windows

Operating system details

Windows 11 24H2

Flet version

0.24.1

Regression

No, it isn't

Suggestions

No response

Logs

Logs
[Paste your logs here]

Additional details

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants