List tiles
Material list rows: the plain
ListTile
, rows with a checkbox, a radio button and a switch, and the expandable
ExpansionTile
. A row's content is laid out by
slots
— children with an
id:
(
title
,
subtitle
,
leading
,
trailing
,
secondary
); the row puts them in place itself and sets the height, padding and text style.
Use them when you need a typical menu, settings or list item. For a custom row layout — a Row inside an InkWell .
ListTile
A list row: an icon or avatar on the left, a title and a subtitle, an element on the right. The height depends on the number of text lines: one line, two (
subtitle
) or three (
isThreeLine
).
Type:
multi-child
(slots by
id:
)
ListTile
CircleAvatar id:leading backgroundColor:#4f46e5
Text "A"
#style color:#ffffff
Text id:title "Anna Smith"
Text id:subtitle "Online"
Icon id:trailing chevron_right
Slots
id:
|
What it is |
|---|---|
title
|
Title |
subtitle
|
Caption under the title |
leading
|
Element on the left (icon, avatar) |
trailing
|
Element on the right (arrow, icon, text) |
Children without an
id:
from this list are not drawn.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
onTap
|
callback | — | Tap on the row. Without it the row is not tappable |
onLongPress
|
callback | — | Long press |
enabled
|
bool | true |
false
— the row is not tappable, text and icons are dimmed
|
selected
|
bool | false |
A selected row: text and icons are painted with
selectedColor
(the theme's primary color by default), the background with
selectedTileColor
|
dense
|
bool | — | Compact row: smaller height and font size |
tileColor
|
color | — | Row background |
selectedTileColor
|
color | — | Background of a selected row |
selectedColor
|
color | — | Text and icon color of a selected row |
iconColor
|
color | — |
Color of icons in
leading
/
trailing
|
textColor
|
color | — | Color of the title and subtitle |
contentPadding
|
#contentPadding
|
— | Inner padding of the row (like `#padding` ) |
shape
|
#shape
|
— |
Row shape, for example
#shape rounded
with its own
#borderRadius
|
visualDensity
|
#visualDensity
|
— |
Density:
standard
,
comfortable
,
compact
,
adaptivePlatformDensity
|
titleAlignment
|
string |
threeLine
|
How
leading
/
trailing
are aligned vertically:
top
,
center
,
bottom
,
threeLine
,
titleHeight
|
isThreeLine
|
bool | false | A row with three lines of text: the subtitle can take two |
horizontalTitleGap
|
double | 16 |
Gap between
leading
and the title
|
minVerticalPadding
|
double | 4 | Minimum padding at the top and bottom |
minLeadingWidth
|
double | 24 |
Minimum width of the
leading
area
|
Example: settings menu
@page:"profile"
Column
ListTile selected:{page == "profile"} onTap:(){page = "profile"}
Icon id:leading person
Text id:title "Profile"
ListTile selected:{page == "privacy"} onTap:(){page = "privacy"}
Icon id:leading lock
Text id:title "Privacy"
Text id:subtitle "Who sees your data"
ListTile enabled:false
Icon id:leading cloud
Text id:title "Backup"
Text id:subtitle "Unavailable"
Example: a rounded card row
@count:0
Column
ListTile tileColor:#eef2ff onTap:(){count = count + 1}
#shape rounded
#borderRadius circular 12
#contentPadding symmetric horizontal:20 vertical:4
CircleAvatar id:leading backgroundColor:#4f46e5
Icon person color:#ffffff
Text id:title "Tap the row"
Text id:subtitle $"Taps: ${count}"
Icon id:trailing chevron_right
CheckboxListTile
A row with a checkbox. A tap anywhere on the row toggles the checkbox. Like
Checkbox
, the row does not store a value: it shows
value
and reports the new value in
onChanged
.
Type:
multi-child
(slots by
id:
)
@agree:false
CheckboxListTile value:$agree onChanged:(value){agree = value}
Text id:title "I accept the terms"
Slots:
title
,
subtitle
,
secondary
(an element on the side opposite the checkbox).
| Parameter | Type | Default | Description |
|---|---|---|---|
value
|
bool | — |
Whether the checkbox is checked. With
tristate
an empty value means "indeterminate"
|
tristate
|
bool | false | Third state — "indeterminate" |
onChanged
|
callback | — |
Receives the new value in
value
:
(value){…}
.
Without it the row is disabled
: grey and not tappable
|
controlAffinity
|
string |
platform
|
Where the checkbox is:
leading
(left),
trailing
(right),
platform
(by platform; for a checkbox that is the right)
|
activeColor
|
color | — | Color of a checked checkbox |
checkColor
|
color | — | Check mark color |
side
|
#side
|
— |
Checkbox border:
#side color:… width:…
|
dense
|
bool | — | Compact row |
selected
|
bool | false | Selected row (text and background highlight) |
tileColor
|
color | — | Row background |
selectedTileColor
|
color | — | Background of a selected row |
contentPadding
|
#contentPadding
|
— | Inner padding of the row |
shape
|
#shape
|
— | Row shape |
@news:true
CheckboxListTile value:$news controlAffinity:leading activeColor:#4f46e5 onChanged:(value){news = value}
#side color:#94a3b8 width:2
Text id:title "Subscribe to the newsletter"
Text id:subtitle "Once a week"
RadioListTile
A row with a radio button. Several rows with the same
groupValue
form a group: the selected one is the row whose
value
equals
groupValue
. A tap on a row passes its
value
to
onChanged
.
Type:
multi-child
(slots by
id:
)
@plan:"month"
Column
RadioListTile value:"month" groupValue:$plan onChanged:(value){plan = value}
Text id:title "Month"
RadioListTile value:"year" groupValue:$plan onChanged:(value){plan = value}
Text id:title "Year"
Text id:subtitle "20 % cheaper"
Slots:
title
,
subtitle
,
secondary
.
| Parameter | Type | Default | Description |
|---|---|---|---|
value
|
any | — | The value of this row |
groupValue
|
any | — | The selected value of the group |
onChanged
|
callback | — |
The
value
argument is the value of the tapped row:
(value){…}
.
Without it the row is disabled
|
toggleable
|
bool | false |
Tapping the selected row again clears the selection (
onChanged
receives an empty value)
|
controlAffinity
|
string |
platform
|
Where the button is:
leading
,
trailing
,
platform
|
activeColor
|
color | — | Color of the selected button |
dense
|
bool | — | Compact row |
selected
|
bool | false | Selected row (text and background highlight) |
tileColor
|
color | — | Row background |
selectedTileColor
|
color | — | Background of a selected row |
contentPadding
|
#contentPadding
|
— | Inner padding of the row |
shape
|
#shape
|
— | Row shape |
SwitchListTile
A row with a switch. A tap on the row toggles it; the new value comes in
onChanged
.
Type:
multi-child
(slots by
id:
)
@push:true
SwitchListTile value:$push onChanged:(value){push = value}
Text id:title "Notifications"
Text id:subtitle "Send push notifications"
Icon id:secondary notifications
Slots:
title
,
subtitle
,
secondary
.
| Parameter | Type | Default | Description |
|---|---|---|---|
value
|
bool | false | Whether the switch is on |
onChanged
|
callback | — |
Receives the new value in
value
:
(value){…}
.
Without it the row is disabled
|
controlAffinity
|
string |
platform
|
Where the switch is:
leading
,
trailing
,
platform
(right)
|
activeThumbColor
|
color | — | Thumb color when on |
activeTrackColor
|
color | — | Track color when on |
inactiveThumbColor
|
color | — | Thumb color when off |
inactiveTrackColor
|
color | — | Track color when off |
dense
|
bool | — | Compact row |
selected
|
bool | false | Selected row (text and background highlight) |
tileColor
|
color | — | Row background |
selectedTileColor
|
color | — | Background of a selected row |
contentPadding
|
#contentPadding
|
— | Inner padding of the row |
shape
|
#shape
|
— | Row shape |
@wifi:true
@bt:false
@agree:true
Column
SwitchListTile value:$wifi activeTrackColor:#4f46e5 onChanged:(value){wifi = value}
Text id:title "Wi-Fi"
Icon id:secondary wifi
SwitchListTile value:$bt onChanged:(value){bt = value}
Text id:title "Bluetooth"
Icon id:secondary bluetooth
CheckboxListTile value:$agree controlAffinity:leading onChanged:(value){agree = value}
Text id:title "Send crash reports"
ExpansionTile
An expandable row: a header with an arrow; a tap opens the content below it. Children with
id:title
,
id:subtitle
,
id:leading
,
id:trailing
go into the header,
all other children
— into the expandable part.
Type:
multi-child
(slots by
id:
+ content)
ExpansionTile
Text id:title "Advanced"
Text id:subtitle "3 items"
ListTile
Text id:title "Language"
ListTile
Text id:title "Time zone"
ListTile
Text id:title "Date format"
| Parameter | Type | Default | Description |
|---|---|---|---|
initiallyExpanded
|
bool | false | Whether the row starts expanded |
maintainState
|
bool | false | Keep the content in the tree while collapsed too (preserves its state) |
tilePadding
|
#tilePadding
|
— | Header padding |
childrenPadding
|
#childrenPadding
|
— | Padding of the expandable part |
expandedCrossAxisAlignment
|
string |
center
|
Cross-axis alignment of the content:
start
,
center
,
end
,
stretch
|
expandedAlignment
|
alignment | — |
Alignment of the content (
center
,
topLeft
,
centerStart
, …)
|
backgroundColor
|
color | — | Background of the expanded row |
collapsedBackgroundColor
|
color | — | Background of the collapsed row |
textColor
|
color | — | Header color when expanded |
collapsedTextColor
|
color | — | Header color when collapsed |
iconColor
|
color | — | Arrow color when expanded |
collapsedIconColor
|
color | — | Arrow color when collapsed |
shape
|
#shape
|
— | Border of the expanded row |
collapsedShape
|
#collapsedShape
|
— | Border of the collapsed row |
clipBehavior
|
string | — |
Clipping to the shape:
none
,
hardEdge
,
antiAlias
,
antiAliasWithSaveLayer
|
dense
|
bool | — | Compact header |
visualDensity
|
#visualDensity
|
— | Header density |
enableFeedback
|
bool | — | Sound and vibration on tap (by platform) |
ExpansionTile initiallyExpanded:true backgroundColor:#f0f9ff collapsedBackgroundColor:#ffffff expandedCrossAxisAlignment:start
#childrenPadding symmetric horizontal:16 vertical:8
Text id:title "How do I return an item?"
Text "Request a return within 14 days in the Orders section."
Differences between the app and the site
-
ListTileon the site is a tappable row with the same geometry: height by the number of lines,dense,contentPadding,horizontalTitleGap,minLeadingWidth,minVerticalPadding,titleAlignment, rounding from#shape;onTap,onLongPress,selected,enabledand the colors work. -
CheckboxListTile,RadioListTile,SwitchListTileon the site are real input fields inside a<label>: a tap anywhere on the row toggles the control,value:$varandonChangedwork. The control colors are as for a standalone Checkbox and Switch : for the checkboxactiveColor,checkColor,#sideare read; for the switch onlyactiveTrackColor(activeThumbColor,inactiveThumbColor,inactiveTrackColorare not read).selectedandselectedTileColorof these rows are not read on the site. -
ExpansionTileon the site does not expand or collapse : it is drawn in the state set byinitiallyExpanded. A collapsed row comes out with no content at all. OnlyinitiallyExpandedand the colors are read (backgroundColor/collapsedBackgroundColor,textColor/collapsedTextColor,iconColor/collapsedIconColor); theleading/trailingslots do not get into the header. For expandable blocks on the site use state and a Switcher orif:.
Bad practices
A checkbox row without onChanged
// BAD — the row is disabled: grey and not tappable
CheckboxListTile value:true
Text id:title "Remember me"
// GOOD
@remember:true
CheckboxListTile value:$remember onChanged:(value){remember = value}
Text id:title "Remember me"
See also
- Checkbox , Switch — the same controls without a row
- ListView — a scrollable list of rows
- InkWell — a tappable area for your own row layout
-
CircleAvatar
— an avatar for the
leadingslot