CupertinoFormRow class Null safety

An iOS-style form row.

Creates an iOS-style split form row with a standard prefix and child widget. Also provides a space for error and helper widgets that appear underneath.

The child parameter is required. This widget is displayed at the end of the row.

The prefix parameter is optional and is displayed at the start of the row. Standard iOS guidelines encourage passing a Text widget to prefix to detail the nature of the row's child widget.

The padding parameter is used to pad the contents of the row. It defaults to the standard iOS padding. If no edge insets are intended, explicitly pass EdgeInsets.zero to padding.

The helper and error parameters are both optional widgets targeted at displaying more information about the row. Both widgets are placed underneath the prefix and child, and will expand the row's height to accommodate for their presence. When a Text is given to error, it will be shown in CupertinoColors.destructiveRed coloring and medium-weighted font.

Creates a CupertinoFormSection containing a CupertinoFormRow with the prefix, child, helper and error widgets.
class FlutterDemo extends StatefulWidget {
  const FlutterDemo({Key? key}) : super(key: key);

  @override
  State<FlutterDemo> createState() => _FlutterDemoState();
}

class _FlutterDemoState extends State<FlutterDemo> {
  bool toggleValue = false;

  @override
  Widget build(BuildContext context) {
    return CupertinoPageScaffold(
      child: Center(
        child: CupertinoFormSection(
          header: const Text('SECTION 1'),
          children: <Widget>[
            CupertinoFormRow(
              child: CupertinoSwitch(
                value: toggleValue,
                onChanged: (bool value) {
                  setState(() {
                    toggleValue = value;
                  });
                },
              ),
              prefix: const Text('Toggle'),
              helper: const Text('Use your instincts'),
              error: toggleValue ? const Text('Cannot be true') : null,
            ),
          ],
        ),
      ),
    );
  }
}

Inheritance

Constructors

CupertinoFormRow({Key? key, required Widget child, Widget? prefix, EdgeInsetsGeometry? padding, Widget? helper, Widget? error})
Creates an iOS-style split form row with a standard prefix and child widget. Also provides a space for error and helper widgets that appear underneath. [...]
const

Properties

child Widget
Child widget. [...]
final
error Widget?
A widget that is displayed underneath the prefix and child widgets. [...]
final
hashCode int
The hash code for this object. [...]
@nonVirtual, read-only, inherited
helper Widget?
A widget that is displayed underneath the prefix and child widgets. [...]
final
key Key?
Controls how one widget replaces another widget in the tree. [...]
final, inherited
padding EdgeInsetsGeometry?
Content padding for the row. [...]
final
prefix Widget?
A widget that is displayed at the start of the row. [...]
final
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

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, inherited
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, inherited