CupertinoListSection class Null safety

An iOS-style list section.

The CupertinoListSection is a container for children widgets. These are most often CupertinoListTiles.

The base constructor for CupertinoListSection constructs an edge-to-edge style section which includes an iOS-style header, the dividers between rows, and borders on top and bottom of the rows. An example of such list section are sections in iOS Settings app.

The CupertinoListSection.insetGrouped constructor creates a round-edged and padded section that is seen in iOS Notes and Reminders apps. It creates an iOS-style header, and the dividers between rows. Does not create borders on top and bottom of the rows.

The section header lies above the children rows, with margins and style that match the iOS style.

The section footer lies below the children rows and is used to provide additional information for current list section.

The children is the list of widgets to be displayed in this list section. Typically, the children are of type CupertinoListTile, however these is not enforced.

The margin is used to provide spacing around the content area of the section encapsulating children.

The decoration of children specifies how they should be decorated. If it is not provided in constructor, the background color of children defaults to CupertinoColors.secondarySystemGroupedBackground and border radius of children group defaults to 10.0 circular radius when constructing with CupertinoListSection.insetGrouped. Defaults to zero radius for the standard CupertinoListSection constructor.

The dividerMargin and additionalDividerMargin specify the starting margin of the divider between list tiles. The dividerMargin is always present, but additionalDividerMargin is only added to the dividerMargin if hasLeading is set to true in the constructor, which is the default value.

The backgroundColor of the section defaults to CupertinoColors.systemGroupedBackground.

The content will be clipped (or not) according to this option.

See the enum Clip for details of all possible options and their common use cases.

Creates a base CupertinoListSection containing CupertinoListTiles with leading, title, additionalInfo and trailing widgets.
To create a local project with this code sample, run:
flutter create --sample=cupertino.CupertinoListSection.1 mysample

Creates an "Inset Grouped" CupertinoListSection containing notched CupertinoListTiles with leading, title, additionalInfo and trailing widgets.
To create a local project with this code sample, run:
flutter create --sample=cupertino.CupertinoListSection.2 mysample

See also:

Inheritance

Constructors

CupertinoListSection({Key? key, List<Widget>? children, Widget? header, Widget? footer, EdgeInsetsGeometry margin = _kDefaultRowsMargin, Color backgroundColor = CupertinoColors.systemGroupedBackground, BoxDecoration? decoration, Clip clipBehavior = Clip.none, double dividerMargin = _kBaseDividerMargin, double? additionalDividerMargin, double? topMargin = _kMarginTop, bool hasLeading = true})
Creates a section that mimics standard iOS forms.
const
CupertinoListSection.insetGrouped({Key? key, List<Widget>? children, Widget? header, Widget? footer, EdgeInsetsGeometry? margin, Color backgroundColor = CupertinoColors.systemGroupedBackground, BoxDecoration? decoration, Clip clipBehavior = Clip.hardEdge, double dividerMargin = _kInsetDividerMargin, double? additionalDividerMargin, double? topMargin, bool hasLeading = true})
Creates a section that mimicks standard "Inset Grouped" iOS list section.
const

Properties

additionalDividerMargin double
Additional starting inset of the divider used between rows. This is used when adding a leading icon to children and a divider should start at the text inset instead of the icon.
final
backgroundColor Color
Sets the background color behind the section.
final
children List<Widget>?
The list of rows in the section. Usually a list of CupertinoListTiles.
final
clipBehavior Clip
The content will be clipped (or not) according to this option.
final
decoration BoxDecoration?
Sets the decoration around children.
final
dividerMargin double
The starting offset of a margin between two list tiles.
final
Sets the form section footer. The section footer lies below the children rows. Usually a Text widget.
final
hashCode int
The hash code for this object.
nonVirtual">@nonVirtualread-onlyinherited
Sets the form section header. The section header lies above the children rows. Usually a Text widget.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
margin EdgeInsetsGeometry
Margin around the content area of the section encapsulating children.
final
runtimeType Type
A representation of the runtime type of the object.
read-onlyinherited
topMargin double?
Margin above the list section. Only used in edge-to-edge variant and it matches iOS style by default.
final
type CupertinoListSectionType
The type of list section, either base or inset grouped.
visibleForTesting">@visibleForTestingfinal

Methods

build(BuildContext context) Widget
Describes the part of the user interface represented by this widget.
override
createElement() StatelessElement
Creates a StatelessElement to manage this widget's location in the tree.
inherited
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
protected">@protectedinherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent 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.
nonVirtual">@nonVirtualinherited