FeatureForm

fun FeatureForm(featureForm: FeatureForm, modifier: Modifier = Modifier, validationErrorVisibility: ValidationErrorVisibility = ValidationErrorVisibility.Automatic, onBarcodeButtonClick: (FieldFormElement) -> Unit? = null, colorScheme: FeatureFormColorScheme = FeatureFormDefaults.colorScheme(), typography: FeatureFormTypography = FeatureFormDefaults.typography())

A composable Form toolkit component that enables users to edit field values of features in a layer using forms that have been configured externally. Forms may be configured in the Web Map Viewer or Fields Maps Designer) and can be obtained from either an ArcGISFeature, ArcGISFeatureTable, FeatureLayer or SubtypeSublayer.

The FeatureForm component supports the following FormElement types as part of its configuration.

  • AttachmentsFormElement

  • FieldFormElement with the following FormInput types -

    • BarcodeScannerFormInput

    • ComboBoxFormInput

    • DateTimePickerFormInput

    • RadioButtonsFormInput

    • SwitchFormInput

    • TextAreaFormInput

    • TextBoxFormInput

  • GroupFormElement

  • TextFormElement

For any elements of input type BarcodeScannerFormInput, a default barcode scanner based on MLKit is provided. The scanner requires the Manifest.permission.CAMERA permission to be granted. A callback is also provided via the onBarcodeButtonClick parameter, which is invoked with the FieldFormElement when its barcode accessory is clicked. This can be used to provide a custom barcode scanning experience. Simply call FieldFormElement.updateValue with the scanned barcode value to update the field value.

For adding any attachments, camera permissions are required. If the permissions are not granted, then the specific functionality is disabled in the form.

Any AttachmentsFormElement present in the FeatureForm.elements collection are not currently supported. A default attachments editing support is provided using the FeatureForm.defaultAttachmentsElement property.

The colors and typography for the Form can use customized using FeatureFormColorScheme and FeatureFormTypography. This customization is built on top of MaterialTheme. If a custom color is specified in both the color scheme and the typography, the color from the color scheme will take precedence and will be merged with the text style, if one is provided.

Note : Even though the FeatureForm class is not stable, there exists an internal mechanism to enable smart recompositions.

Since

200.4.0

Parameters

featureForm

The FeatureForm configuration.

modifier

The Modifier to be applied to layout corresponding to the content of this FeatureForm.

validationErrorVisibility

The ValidationErrorVisibility that determines the behavior of when the validation errors are visible. Default is ValidationErrorVisibility.Automatic which indicates errors are only visible once the respective field gains focus.

onBarcodeButtonClick

A callback that is invoked when the barcode accessory is clicked. The callback is invoked with the FieldFormElement that has the barcode accessory. If null, the default barcode scanner is used.

colorScheme

The FeatureFormColorScheme to use for the FeatureForm.

typography

The FeatureFormTypography to use for the FeatureForm.