Skip to content

how to trigger page update when clicked on list tile #67

Answered by FeodorFitsner
asagarshinde asked this question in Q&A
Discussion options

You must be logged in to vote

This Text(f"selected menu is {self.selected_item}") won't work. I mean it works only once when build() is called. build() is called only once before "mounting" the control.

You have to update Text's value property in on_click and call self.update():

import flet
from flet import (
    Column,
    Container,
    ElevatedButton,
    ListTile,
    Page,
    Row,
    Tab,
    Tabs,
    Text,
    UserControl,
    alignment,
    colors,
    padding,
)


def main(page: Page):
    t = Tabs(
        selected_index=1,
        animation_duration=300,
        expand=True,
        tabs=[
            Tab(text="Kafka", content=KafkaPanel()),
            Tab(
                text="Cassandra",
            …

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@asagarshinde
Comment options

Answer selected by asagarshinde
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants