flet icon indicating copy to clipboard operation
flet copied to clipboard

trailing control of `ListTile` not shown

Open clstaudt opened this issue 3 years ago • 4 comments

def make_project_view(project: Project):
    return Card(
        content=Container(
            content=Column(
                [
                    ListTile(
                        leading=Icon(icons.WORK),
                        title=Text(project.title),
                        subtitle=Text(project.tag),
                        trailing=PopupMenuButton(
                            icon=icons.WARNING,
                            items=[
                                PopupMenuItem(
                                    icon=icons.EDIT,
                                    text="Edit",
                                ),
                                PopupMenuItem(
                                    icon=icons.DELETE,
                                    text="Delete",
                                ),
                            ],
                        )
                    ),
                ]
            ),
            padding=10,
        )
    )

While the ListTile is shown, the trailing PopupMenuButton is not.

Screenshot 2022-09-10 at 19 10 28

clstaudt avatar Sep 10 '22 17:09 clstaudt

What do you get with this sample: https://github.com/flet-dev/examples/blob/main/python/controls/listtile/listtiles.py ?

FeodorFitsner avatar Sep 10 '22 17:09 FeodorFitsner

The sample code works fine. I have also solved the problem, without understanding the why: Whether the ListTile is displayed correctly depended on where the Card was added:

  • if added to Column contained in a Row: trailing control not displayed
  • if added only to a Column: trailing control displayed

Screenshot 2022-09-10 at 19 33 13

Any idea why?

It seems like much depends on the context of where the Control is used, which makes it somewhat hard to debug or post a minimal example.

In general, error messages whenever something is not rendered correctly would be a great help.

clstaudt avatar Sep 10 '22 17:09 clstaudt

Could you post a repro code for that?

FeodorFitsner avatar Sep 10 '22 17:09 FeodorFitsner

Difficult for me to tell how much context is needed. Does the full app layout help?

https://github.com/tuttle-dev/tuttle/blob/a0198c5f0804edb566c77e005d8ebc6aba89ed4a/app/Tuttle2.py

https://github.com/tuttle-dev/tuttle/blob/a0198c5f0804edb566c77e005d8ebc6aba89ed4a/app/views.py

clstaudt avatar Sep 10 '22 17:09 clstaudt