How to change the border height of an unfilled or partially filled ft.TextField?

91 Views Asked by At

How to change the border height of an unfilled or partially filled ft.TextField?

How to set fixed size of field borders. In the current implementation with the width=400 parameter it sets the maximum values of the element size. But the borders change dynamically, depending on the filled text. I want the borders to be static c initially with set size=width. Video demonstration:

https://user-images.githubusercontent.com/105080268/283751675-26162ef5-6f3e-4050-9cdd-59d52e1ffadd.mov

entry_message = ft.TextField(label="Message", multiline=True, expand=False, width=400, height=200)

1

There are 1 best solutions below

0
On BEST ANSWER

I am not sure what you really want to do. You want the multi-line text field to have a fixed size? If so you can just put a very large number in parameters min_lines and max_lines, like the following:

import flet as ft

def main(page: ft.Page):
    width = 400
    entry_message = ft.TextField(
        label="Message",
        multiline=True,
        min_lines=10000,
        max_lines=10000,
        width=width,
        height=200,
    )
    recipient = ft.TextField(label="Recipient Name", expand=1)
    chat = ft.TextField(label="Chat ID", expand=1)
    row = ft.Row([recipient, chat], width=width)
    page.add(entry_message, row)

ft.app(target=main)

This will result in the following:

form