CupertinoFormSection constructor Null safety
- {Key? key,
- required List<
Widget> children, - Widget? header,
- EdgeInsetsGeometry margin = EdgeInsets.zero,
- Color backgroundColor = CupertinoColors.systemGroupedBackground,
- BoxDecoration? decoration,
- Clip clipBehavior = Clip.none}
Creates a section that mimics standard iOS forms.
The base constructor for CupertinoFormSection constructs an edge-to-edge style section which includes an iOS-style header, rows, the dividers between rows, and borders on top and bottom of the rows.
The header parameter sets the form section header. The section header lies above the children rows, with margins that match the iOS style.
The footer parameter sets the form section footer. The section footer lies below the children rows.
The children parameter is required and sets the list of rows shown in the section. The children parameter takes a list, as opposed to a more efficient builder function that lazy builds, because forms are intended to be short in row count. It is recommended that only CupertinoFormRow and CupertinoTextFormFieldRow widgets be included in the children list in order to retain the iOS look.
The margin parameter sets the spacing around the content area of the section encapsulating children, and defaults to zero padding.
The decoration parameter sets the decoration around children. If null, defaults to CupertinoColors.secondarySystemGroupedBackground. If null, defaults to 10.0 circular radius when constructing with CupertinoFormSection.insetGrouped. Defaults to zero radius for the standard CupertinoFormSection constructor.
The backgroundColor parameter sets the background color behind the section. If null, 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.
Implementation
const CupertinoFormSection({
super.key,
required this.children,
this.header,
this.footer,
this.margin = EdgeInsets.zero,
this.backgroundColor = CupertinoColors.systemGroupedBackground,
this.decoration,
this.clipBehavior = Clip.none,
}) : _type = CupertinoListSectionType.base,
assert(children.length > 0);