CupertinoFormSection.insetGrouped constructor Null safety

const CupertinoFormSection.insetGrouped(
  1. {Key? key,
  2. required List<Widget> children,
  3. Widget? header,
  4. Widget? footer,
  5. EdgeInsetsGeometry margin = _kFormDefaultInsetGroupedRowsMargin,
  6. Color backgroundColor = CupertinoColors.systemGroupedBackground,
  7. BoxDecoration? decoration,
  8. Clip clipBehavior = Clip.none}
)

Creates a section that mimics standard "Inset Grouped" iOS forms.

The CupertinoFormSection.insetGrouped constructor creates a round-edged and padded section that is commonly seen in notched-displays like iPhone X and beyond. Creates an iOS-style header, rows, and the dividers between rows. Does not create 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 the standard notched-style iOS form 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.insetGrouped({
  super.key,
  required this.children,
  this.header,
  this.footer,
  this.margin = _kFormDefaultInsetGroupedRowsMargin,
  this.backgroundColor = CupertinoColors.systemGroupedBackground,
  this.decoration,
  this.clipBehavior = Clip.none,
})  : _type = CupertinoListSectionType.insetGrouped,
      assert(children.length > 0);