Replies: 4 comments 5 replies
-
Could you please submit code example as text? |
Beta Was this translation helpful? Give feedback.
0 replies
-
from time import sleep
import flet
from flet import Page, Text, ElevatedButton, View, AppBar, colors, theme, UserControl, TextField, icons, Icon, \
IconButton, PopupMenuButton, PopupMenuItem, FloatingActionButton, Tabs, Tab, Container, alignment, Column, ListView, \
ListTile, padding, ButtonStyle, TextButton, ProgressRing
def main(page: Page):
page.theme = theme.Theme(color_scheme_seed="green")
home_view = View(route='/', controls=[
Tabs(
selected_index=0,
# animation_duration=300,
tabs=[
Tab(
text="latest",
content=Container(content=ListView(controls=[
ListTile(
leading=Icon(icons.CHAT_BUBBLE, color=colors.GREEN_400),
title=Text("AAAAAAAAAAA"),
trailing=PopupMenuButton(
icon=icons.MORE_VERT,
items=[
PopupMenuItem(text="Item 1"),
PopupMenuItem(text="Item 2"),
],
),
),
ListTile(
leading=Icon(icons.CHAT_BUBBLE_OUTLINE),
title=Text("BBBBBBBBBBBBB"),
trailing=PopupMenuButton(
icon=icons.MORE_VERT,
items=[
PopupMenuItem(text="Item 1"),
PopupMenuItem(text="Item 2"),
],
),
),
# ProgressRing(), Text("I'm going to run for ages...")
]), padding=padding.symmetric(20.0, 0))
),
Tab(
text="FAQ",
),
],
),
# Text('affa'),
],
scroll="always", )
page.views.clear()
page.views.append(home_view)
print(page.views)
page.update()
if __name__ == "__main__":
# flet.app(target=main2, view=flet.FLET_APP_HIDDEN)
flet.app(target=main, view=flet.WEB_BROWSER, port=8080)
|
Beta Was this translation helpful? Give feedback.
0 replies
-
Below is the working example. Changes to your code:
from time import sleep
import flet
from flet import (
AppBar,
ButtonStyle,
Column,
Container,
ElevatedButton,
FloatingActionButton,
Icon,
IconButton,
ListTile,
ListView,
Page,
PopupMenuButton,
PopupMenuItem,
ProgressRing,
Tab,
Tabs,
Text,
TextButton,
TextField,
UserControl,
View,
alignment,
colors,
icons,
padding,
theme,
)
def main(page: Page):
page.theme = theme.Theme(color_scheme_seed="green")
home_view = View(
route="/",
controls=[
Tabs(
selected_index=0,
# animation_duration=300,
tabs=[
Tab(
text="latest",
content=Container(
content=ListView(
controls=[
ListTile(
leading=Icon(
icons.CHAT_BUBBLE, color=colors.GREEN_400
),
title=Text("AAAAAAAAAAA"),
trailing=PopupMenuButton(
icon=icons.MORE_VERT,
items=[
PopupMenuItem(text="Item 1"),
PopupMenuItem(text="Item 2"),
],
),
),
ListTile(
leading=Icon(icons.CHAT_BUBBLE_OUTLINE),
title=Text("BBBBBBBBBBBBB"),
trailing=PopupMenuButton(
icon=icons.MORE_VERT,
items=[
PopupMenuItem(text="Item 1"),
PopupMenuItem(text="Item 2"),
],
),
),
# ProgressRing(), Text("I'm going to run for ages...")
],
),
padding=padding.symmetric(20.0, 0),
),
),
Tab(
text="FAQ",
),
],
expand=True,
),
# Text('affa'),
],
)
page.views.clear()
page.views.append(home_view)
print(page.views)
page.update()
if __name__ == "__main__":
# flet.app(target=main2, view=flet.FLET_APP_HIDDEN)
flet.app(target=main, view=flet.WEB_BROWSER, port=8080) |
Beta Was this translation helpful? Give feedback.
2 replies
-
When ListView is changed to Column, it can be displayed normally. Why? from time import sleep
import flet
from flet import (
AppBar,
ButtonStyle,
Column,
Container,
ElevatedButton,
FloatingActionButton,
Icon,
IconButton,
ListTile,
ListView,
Page,
PopupMenuButton,
PopupMenuItem,
ProgressRing,
Tab,
Tabs,
Text,
TextButton,
TextField,
UserControl,
View,
alignment,
colors,
icons,
padding,
theme, Row,
)
def main(page: Page):
page.theme = theme.Theme(color_scheme_seed="green")
home_view = View(
route="/",
controls=[
Column(controls=[
Text("A control that displays its children in a horizontal array.", style="headlineLarge"),
Text(
'When a child Control is placed into a Row you can "expand" it to fill the available space. Every Control has expand property that can have either a boolean value (True - expand control to fill all available space) or an integer - an "expand factor" specifying how to divide a free space with other expanded child controls.',
style='bodyLarge'),
Text(
'When a child Control is placed into a Row you can "expand" it to fill the available space. Every Control has expand property that can have either a boolean value (True - expand control to fill all available space) or an integer - an "expand factor" specifying how to divide a free space with other expanded child controls.',
style='bodyLarge'),
Text(
'When a child Control is placed into a Row you can "expand" it to fill the available space. Every Control has expand property that can have either a boolean value (True - expand control to fill all available space) or an integer - an "expand factor" specifying how to divide a free space with other expanded child controls.',
style='bodyLarge'),
Row(
[TextButton("👍"), TextButton("❤️")],
alignment="end",
),
Tabs(
selected_index=0,
# animation_duration=300,
tabs=[
Tab(
text="latest",
content=Container(
content=Column(
controls=[
ListTile(
leading=Icon(
icons.CHAT_BUBBLE, color=colors.GREEN_400
),
title=Text("AAAAAAAAAAA"),
trailing=PopupMenuButton(
icon=icons.MORE_VERT,
items=[
PopupMenuItem(text="Item 1"),
PopupMenuItem(text="Item 2"),
],
),
),
ListTile(
leading=Icon(icons.CHAT_BUBBLE_OUTLINE),
title=Text("BBBBBBBBBBBBB"),
trailing=PopupMenuButton(
icon=icons.MORE_VERT,
items=[
PopupMenuItem(text="Item 1"),
PopupMenuItem(text="Item 2"),
],
),
),
ListTile(
leading=Icon(icons.CHAT_BUBBLE_OUTLINE),
title=Text("BBBBBBBBBBBBB"),
trailing=PopupMenuButton(
icon=icons.MORE_VERT,
items=[
PopupMenuItem(text="Item 1"),
PopupMenuItem(text="Item 2"),
],
),
),
ListTile(
leading=Icon(icons.CHAT_BUBBLE_OUTLINE),
title=Text("BBBBBBBBBBBBB"),
trailing=PopupMenuButton(
icon=icons.MORE_VERT,
items=[
PopupMenuItem(text="Item 1"),
PopupMenuItem(text="Item 2"),
],
),
),
ListTile(
leading=Icon(icons.CHAT_BUBBLE_OUTLINE),
title=Text("BBBBBBBBBBBBB"),
trailing=PopupMenuButton(
icon=icons.MORE_VERT,
items=[
PopupMenuItem(text="Item 1"),
PopupMenuItem(text="Item 2"),
],
),
),
ListTile(
leading=Icon(icons.CHAT_BUBBLE_OUTLINE),
title=Text("BBBBBBBBBBBBB"),
trailing=PopupMenuButton(
icon=icons.MORE_VERT,
items=[
PopupMenuItem(text="Item 1"),
PopupMenuItem(text="Item 2"),
],
),
),
ListTile(
leading=Icon(icons.CHAT_BUBBLE_OUTLINE),
title=Text("BBBBBBBBBBBBB"),
trailing=PopupMenuButton(
icon=icons.MORE_VERT,
items=[
PopupMenuItem(text="Item 1"),
PopupMenuItem(text="Item 2"),
],
),
),
ListTile(
leading=Icon(icons.CHAT_BUBBLE_OUTLINE),
title=Text("BBBBBBBBBBBBB"),
trailing=PopupMenuButton(
icon=icons.MORE_VERT,
items=[
PopupMenuItem(text="Item 1"),
PopupMenuItem(text="Item 2"),
],
),
),
ListTile(
leading=Icon(icons.CHAT_BUBBLE_OUTLINE),
title=Text("BBBBBBBBBBBBB"),
trailing=PopupMenuButton(
icon=icons.MORE_VERT,
items=[
PopupMenuItem(text="Item 1"),
PopupMenuItem(text="Item 2"),
],
),
),
# ProgressRing(), Text("I'm going to run for ages...")
],
),
padding=padding.symmetric(20.0, 0),
),
),
Tab(
text="FAQ",
content=Container(
content=Column(controls=[Text('faq')])
)
),
],
),
]),
# Text('affa'),
], scroll="hidden"
)
page.views.clear()
page.views.append(home_view)
print(page.views)
page.update()
if __name__ == "__main__":
# flet.app(target=main2, view=flet.FLET_APP_HIDDEN)
flet.app(target=main, view=flet.WEB_BROWSER, port=8080) |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
ListView can't display in tabs, if I change ListView to Column, it's worked.
Beta Was this translation helpful? Give feedback.
All reactions