flet-dev / flet-dev/flet

Row span/Vertical Text Truncation

Open
#1,435 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
17k
Forks
694
Avg merge
1d 14h
Merged PRs (30d)
33

Description

Not sure if this is more bug or feature request

  • First i'd like to give the motivation for what i'm trying implement. As far as im aware, flet's datatable does not support row span. The entirety of my 'app' is just supposed to mimic this but have it directly read from your files with no work required from the user. The layout of the table(s) clearly has row span. My solution is to cobble together columns, containers, and text. The containers are required because the bgcolor for text is only immediately around the text and not all available space to the text. As seen in the 1st 2 columns of the linked spreadsheet some row's text is rotated. I successfully got something close to the spreadsheet:
    example

  • the problem i'm facing is that if you look at the 2 left most columns, the text gets truncated. This is not because there is a lack of vertical space but rather because there is a lack of horizontal space. Is there a way to changed whatever property or mechanism that controls when the text is truncated such that it looks to the vertical space available in the parent? Proof the horizontal space is the issue:

  • Notice both container truncate when the non-rotated text runs out of horizontal space

  • Here is the code that makes that made that minimal example:

from flet import app, Page, Container, Text, Column, Row
from flet_core.alignment import center
from math import pi

VERTICAL = 3 * pi / 2


def main(page: Page) -> None:
    table = Row(
        expand=True,
        controls=[
            Column(
                expand=True,
                controls=[
                    Container(
                        bgcolor="#CC0000",
                        expand=True,
                        alignment=center,
                        content=Text(value="Clicking"),
                    )
                ],
            ),
            Column(
                expand=True,
                controls=[
                    Container(
                        bgcolor="#CC0000",
                        expand=True,
                        alignment=center,
                        content=Text(value="Clicking", rotate=VERTICAL),
                    )
                ],
            ),
        ],
    )

    page.add(table)
    page.update()


if __name__ == "__main__":
    app(target=main)

  • Again not sure if this is bug. If not then this is a feature request for either row span support in datatables or for the ability to change where/how to text truncates relative to the parent control.

Flet version: 0.7.4
Python version: 3.10.6
OS: Windows 10

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the supplied Python example from issue #1435 and inspect the Text, Container, Column, and Row controls involved in rotated text layout. Reproduce the truncation with Flet 0.7.4, then determine whether the existing behavior can account for the parent’s vertical space; done means the minimal example no longer truncates the rotated text or the limitation is clearly documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.