Flet Dev Docs Controls Expansiontile
Flet Dev Docs Controls Expansiontile
ExpansionTile
A single-line ListTile with an expansion arrow icon that expands or collapses the tile to reveal
or hide its children.
Examples
Live example
Python
Convert web pages and HTML files to PDF in your applications with the Pdfcrowd HTML to PDF API Printed with Pdfcrowd.com
import flet as ft
def handle_expansion_tile_change(e):
page.show_snack_bar(
ft.SnackBar(ft.Text(f"ExpansionTile was {'expanded' if e.dat
)
if e.control.trailing:
e.control.trailing.name = (
ft.icons.ARROW_DROP_DOWN
if e.control.trailing.name == ft.icons.ARROW_DROP_DOWN_C
else ft.icons.ARROW_DROP_DOWN_CIRCLE
)
page.update()
page.add(
ft.ExpansionTile(
title=ft.Text("ExpansionTile 1"),
subtitle=ft.Text("Trailing expansion arrow icon"),
affinity=ft.TileAffinity.PLATFORM,
maintain_state=True,
collapsed_text_color=ft.colors.RED,
text_color=ft.colors.RED,
controls=[ft.ListTile(title=ft.Text("This is sub-tile number
),
ft.ExpansionTile(
title=ft.Text("ExpansionTile 2"),
subtitle=ft.Text("Custom expansion arrow icon"),
trailing=ft.Icon(ft.icons.ARROW_DROP_DOWN),
collapsed_text_color=ft.colors.GREEN,
text_color=ft.colors.GREEN,
on_change=handle_expansion_tile_change,
controls=[ft.ListTile(title=ft.Text("This is sub-tile number
),
ft.ExpansionTile(
title=ft.Text("ExpansionTile 3"),
subtitle=ft.Text("Leading expansion arrow icon"),
affinity=ft.TileAffinity.LEADING,
initially_expanded=True,
collapsed_text_color=ft.colors.BLUE,
Convert web pages and HTML files to PDF in your applications with the Pdfcrowd HTML to PDF API Printed with Pdfcrowd.com
text_color=ft.colors.BLUE,
controls=[
ft.ListTile(title=ft.Text("This is sub-tile number 3")),
ft.ListTile(title=ft.Text("This is sub-tile number 4")),
ft.ListTile(title=ft.Text("This is sub-tile number 5")),
],
),
)
ft.app(target=main)
Properties
affinity
Typically used to force the expansion arrow icon to the tile's leading or trailing edge.
LEADING
TRAILING
PLATFORM (default)
bgcolor
controls
The controls to be displayed when the tile expands. Typically ListTile controls.
controls_padding
clip_behavior
Convert web pages and HTML files to PDF in your applications with the Pdfcrowd HTML to PDF API Printed with Pdfcrowd.com
The content will be clipped (or not) according to this option.
NONE (default)
ANTI_ALIAS
ANTI_ALIAS_WITH_SAVE_LAYER
HARD_EDGE
collapsed_bgcolor
collapsed_icon_color
The icon color of tile's expansion arrow icon when the sublist is collapsed.
collapsed_shape
The tile's border shape when the sublist is collapsed. The value is an instance of type
OutlinedBorder from which the below inherit:
StadiumBorder
RoundedRectangleBorder
radius - border radius, an instance of BorderRadius class or a number.
CircleBorder
BeveledRectangleBorder
radius - border radius, an instance of BorderRadius class or a number.
ContinuousRectangleBorder
radius - border radius, an instance of BorderRadius class or a number.
collapsed_text_color
expanded_alignment
Defines the alignment of children, which are arranged in a column when the tile is expanded.
Convert web pages and HTML files to PDF in your applications with the Pdfcrowd HTML to PDF API Printed with Pdfcrowd.com
See Container.alignment property for more information and possible values.
expanded_cross_axis_alignment
Defines the alignment of each child control within controls when the tile is expanded.
START
CENTER (default)
END
STRETCH
BASELINE
icon_color
The icon color of tile's expansion arrow icon when the sublist is expanded.
initially_expanded
A boolean value which defines whether the tile is initially expanded or collapsed. Default value
is False .
leading
maintain_state
A boolean value which defines whether the state of the controls is maintained when the tile
expands and collapses. Default value is False .
shape
The tile's border shape when the sublist is expanded. The value is an instance of type
OutlinedBorder from which the below inherit:
StadiumBorder
RoundedRectangleBorder
Convert web pages and HTML files to PDF in your applications with the Pdfcrowd HTML to PDF API Printed with Pdfcrowd.com
radius - border radius, an instance of BorderRadius class or a number.
CircleBorder
BeveledRectangleBorder
radius - border radius, an instance of BorderRadius class or a number.
ContinuousRectangleBorder
radius - border radius, an instance of BorderRadius class or a number.
subtitle
text_color
tile_padding
title
trailing
Events
on_change
on_long_press
Convert web pages and HTML files to PDF in your applications with the Pdfcrowd HTML to PDF API Printed with Pdfcrowd.com
Edit this page
Convert web pages and HTML files to PDF in your applications with the Pdfcrowd HTML to PDF API Printed with Pdfcrowd.com