A CupertinoColorPickerField inside a CupertinoFormSection using CupertinoColorPickerFormFieldRow
CupertinoFormSection.insetGrouped(
header: constText('Section 1'),
children: [
// A field with an always showing clear buttonCupertinoColorPickerFormFieldRow(
prefix: constText('Enter Color'),
defaultColor: defaultColor,
clearButtonMode: ClearButtonVisibilityMode.always,
placeholder: 'Enter Color',
onChanged: _onChanged,
validator: (List<Color>? value) {
if (value == null || value.isEmpty) {
return'Please enter at least one color';
}
returnnull;
},
),
// A field with a reversed position and order of the chosen colors listCupertinoColorPickerFormFieldRow(
prefix: constText('Enter Color'),
defaultColor: defaultColor,
placeholder: 'Enter Color',
onChanged: (Color value) {},
colorListReversed: true,
validator: (List<Color>? value) {
if (value == null || value.isEmpty) {
return'Please enter at least one color';
}
returnnull;
},
),
// Forcing Text Direction using Directionality widget, // by default the TextDirection will be read from the LocalizationDirectionality(
textDirection: TextDirection.rtl,
child: CupertinoColorPickerFormFieldRow(
prefix: constText('Enter Color rtl'),
defaultColor: defaultColor,
placeholder: 'Enter Color rtl',
onChanged: (Color value) {},
validator: (List<Color>? value) {
if (value == null || value.isEmpty) {
return'Please enter at least one color';
}
returnnull;
},
),
),
],
),