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

Unexpected Container.on_animation_end call inside the BottomSheet when it is opened #4792

Open
1 task done
lastdayafter opened this issue Jan 27, 2025 · 0 comments
Open
1 task done

Comments

@lastdayafter
Copy link

lastdayafter commented Jan 27, 2025

Duplicate Check

Describe the bug

If the Container inside the BottomSheet is assigned the animate and bgcolor attributes, along with the on_animation_end handler, the handler will be called when the BottomSheet is opened.

The behavior changes if the bgcolor attribute is None.

Code sample

Code
import flet as ft


class TestItem(ft.Container):
    def __init__(self, *args, **kwargs):
        
        super().__init__(*args, **kwargs)
        # issue with animate and bgcolor
        self.bgcolor = ft.Colors.PRIMARY_CONTAINER
        self.animate = ft.Animation(300, ft.AnimationCurve.EASE)
        self.on_animation_end = self.test_issue
        self.content = ft.Text('Test')

    def test_issue(self, _):
        print('if bgcolor is defined, then on_animation_end will be called')


sheet = ft.BottomSheet(
    content=ft.Column(
        controls=[TestItem() for _ in range(10)],
        scroll=ft.ScrollMode.AUTO, width=400
    )
)


def main(page: ft.Page):
    page.floating_action_button = ft.FloatingActionButton(
        icon=ft.Icons.ADD, on_click=lambda e: e.page.open(sheet)
    )
    page.update()


ft.app(main)

To reproduce

  1. Run the code
  2. Click the floating button
  3. See the print output in the terminal

Expected behavior

No response

Screenshots / Videos

Operating System

macOS

Operating system details

Sequoia 15.2

Flet version

0.26.0

Regression

Yes, it worked as expected in 0.25.2

Suggestions

No response

Logs

Additional details

No response

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

1 participant