CupertinoListTile class

An iOS-style list tile.

The CupertinoListTile is a Cupertino equivalent of Material ListTile. It comes in two forms, an old-fashioned edge-to-edge variant known from iOS Settings app and in a new, "Inset Grouped" form, known from either iOS Notes or Reminders app. The first is constructed using default constructor, and the latter using named constructor CupertinoListTile.notched.

The title, subtitle, and additionalInfo are usually Text widgets. They are all limited to one line so it is a responsibility of the caller to take care of text wrapping.

The size of leading is by default constrained to match the iOS size, depending of the type of list tile. This can however be overridden by providing leadingSize. The trailing widget is not constrained and is therefore a responsibility of the caller to ensure reasonable size of the trailing widget.

The background color of the tile can be set with backgroundColor for the state before tile was tapped and with backgroundColorActivated for the state after the tile was tapped. By default, both values are set to match the default iOS appearance.

The padding and leadingToTitle are by default set to match iOS but can be overwritten if necessary.

The onTap callback provides an option to react to taps anywhere inside the list tile. This can be used to navigate routes and according to iOS behavior it should not be used for example to toggle the CupertinoSwitch in the trailing widget.

See also:

Inheritance

Constructors

CupertinoListTile({Key? key, required Widget title, Widget? subtitle, Widget? additionalInfo, Widget? leading, Widget? trailing, FutureOr<void> onTap()?, Color? backgroundColor, Color? backgroundColorActivated, EdgeInsetsGeometry? padding, double leadingSize = _kLeadingSize, double leadingToTitle = _kLeadingToTitle})
Creates an edge-to-edge iOS-style list tile like the tiles in iOS Settings app.
const
CupertinoListTile.notched({Key? key, required Widget title, Widget? subtitle, Widget? additionalInfo, Widget? leading, Widget? trailing, FutureOr<void> onTap()?, Color? backgroundColor, Color? backgroundColorActivated, EdgeInsetsGeometry? padding, double leadingSize = _kNotchedLeadingSize, double leadingToTitle = _kNotchedLeadingToTitle})
Creates a notched iOS-style list tile like the tiles in iOS Notes app or Reminders app.
const

Properties

additionalInfo Widget?
Similar to subtitle, an additionalInfo is used to display additional information. However, instead of being displayed below title, it is displayed on the right, before trailing. Usually a Text widget.
final
backgroundColor Color?
The backgroundColor of the tile in normal state. Once the tile is tapped, the background color switches to backgroundColorActivated. It is set to match the iOS look by default.
final
backgroundColorActivated Color?
The backgroundColorActivated is the background color of the tile after the tile was tapped. It is set to match the iOS look by default.
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
leading Widget?
A widget displayed at the start of the CupertinoListTile. This is typically an Icon or an Image.
final
leadingSize double
The leadingSize is used to constrain the width and height of leading widget.
final
leadingToTitle double
The horizontal space between leading widget and title.
final
onTap → (FutureOr<void> Function()?)
The onTap function is called when a user taps on CupertinoListTile. If left null, the CupertinoListTile will not react on taps. If this is a Future<void> Function(), then the CupertinoListTile remains activated until the returned future is awaited. This is according to iOS behavior. However, if this function is a void Function(), then the tile is active only for the duration of invocation.
final
padding EdgeInsetsGeometry?
Padding of the content inside CupertinoListTile.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
subtitle Widget?
A subtitle is used to display additional information. It is located below title. Usually a Text widget.
final
title Widget
A title is used to convey the central information. Usually a Text.
final
trailing Widget?
A widget displayed at the end of the CupertinoListTile. This is usually a right chevron icon (e.g. CupertinoListTileChevron), or an Icon.
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<CupertinoListTile>
Creates the mutable state for this widget at a given location in the tree.
override
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited