EnhancedCupertinoListSection class

EnhancedCupertinoListSection is based on CupertinoListSection from Flutter's standard library, but with some enhancements:

  • The headerType and footerType arguments allow a EnhancedCupertinoListSection to combine the "insetGrouped" style and the "base" style. This enables an EnhancedCupertinoListSection to have new-style curved borders ("insetGrouped" style) with a header and footer of the "base" style. This makes the appearance similar to the iOS settings app.

An iOS-style list section.

The EnhancedCupertinoListSection is a container for children widgets. These are most often EnhancedCupertinoListTiles.

The base constructor for EnhancedCupertinoListSection 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 EnhancedCupertinoListSection 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.

{@tool dartpad} Creates a base EnhancedCupertinoListSection containing CupertinoListTiles with leading, title, additionalInfo and trailing widgets.

** See code in examples/api/lib/cupertino/list_section/list_section_base.0.dart ** {@end-tool}

{@tool dartpad} Creates an "Inset Grouped" EnhancedCupertinoListSection containing notched CupertinoListTiles with leading, title, additionalInfo and trailing widgets.

** See code in examples/api/lib/cupertino/list_section/list_section_inset.0.dart ** {@end-tool}

See also:

Inheritance

Constructors

EnhancedCupertinoListSection({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, Color? separatorColor, CupertinoListSectionType headerType = CupertinoListSectionType.base, CupertinoListSectionType footerType = CupertinoListSectionType.base})
Creates a section that mimics standard iOS forms.
const
EnhancedCupertinoListSection.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, Color? separatorColor, CupertinoListSectionType headerType = CupertinoListSectionType.insetGrouped, CupertinoListSectionType footerType = CupertinoListSectionType.insetGrouped})
Creates a section that mimics 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
footerType CupertinoListSectionType
The type of the footer. If "insetGrouped", no styling will be applied. If "base", the footer will be displayed in the style of the iOS settings app.
final
hashCode int
The hash code for this object.
no setterinherited
Sets the form section header. The section header lies above the children rows. Usually a Text widget.
final
headerType CupertinoListSectionType
The type of the header. If "insetGrouped", the header will be displayed large and bold like the iOS notes app. If "base", the header will be displayed smaller, like the iOS settings app.
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.
no setterinherited
separatorColor Color?
Sets the color for the dividers between rows, and borders on top and bottom of the rows.
final
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 the body of the list section, either base or inset grouped.
final

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.
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, int wrapWidth = 65}) 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