A single row typically containing an icon and some text.
List items are one to three lines of text optionally flanked by icons or other widgets, such as check boxes. The icons (or other widgets) for the item are defined with the leading and trailing parameters. The first line of text is not optional and is specified with title. The value of subtitle, which is optional, will occupy the space allocated for an additional line of text, or two lines if isThreeLine is true. If dense is true then the overall height of this list item and the size of the DefaultTextStyles that wrap the title and subtitle widget are reduced.
List items are typically used in MaterialLists or in Cards.
Requires one of its ancestors to be a Material widget.
See also:
- MaterialList, which takes a list of ListItem widgets and shows them as a scrolling list.
- Card, which can be used with Column to show a few ListItems.
- CircleAvatar, which shows an icon representing a person.
- Divider, which can be used to separate ListItems.
- ListItem.divideItems, another way to separate ListItems.
- material.google.com/components/lists.html
- Inheritance
- Object
- Widget
- StatelessWidget
- ListItem
Static Methods
-
divideItems(
{BuildContext context, Iterable<Widget> items, Color color }) → Iterable<Widget> -
Add a one pixel border in between each item. If color isn't specified the ThemeData.dividerColor of the context's Theme is used.
Constructors
Properties
- dense → bool
-
Whether this list item is part of a vertically dense list.
read-only - enabled → bool
-
Whether this list item is interactive.
read-only - isThreeLine → bool
-
Whether this list item is intended to display three lines of text.
read-only - leading → Widget
-
A widget to display before the title.
read-only - onLongPress → GestureLongPressCallback
-
Called when the user long-presses on this list item.
read-only - onTap → GestureTapCallback
-
Called when the user taps this list item.
read-only - subtitle → Widget
-
Additional content displayed below the title.
read-only - title → Widget
-
The primary content of the list item.
read-only - trailing → Widget
-
A widget to display after the title.
read-only - hashCode → int
-
Get a hash code for this object.
read-only, inherited - key → Key
-
Controls how one widget replaces another widget in the tree.
read-only, inherited - runtimeType → Type
-
A representation of the runtime type of the object.
read-only, inherited
Operators
-
operator ==(
other) → bool -
The equality operator.
inherited
Methods
-
build(
BuildContext context) → Widget -
Describes the part of the user interface represented by this widget.
-
createElement(
) → StatelessElement -
Creates a StatelessElement to manage this widget's location in the tree.
inherited -
debugFillDescription(
List<String> description) → void -
Add additional information to the given description for use by toString.
inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed.
inherited -
toString(
) → String -
Returns a string representation of this object.
inherited -
toStringShort(
) → String -
A short, textual description of this widget.
inherited