TextField

Overview

Text inputs enable the user to interact with and input content and data. This component can be used for long and short form entries.

Widget API

The CTextField widget parameters are identical to the normal TextField widget, however, it also has some extra parameters:

PropertyDescription

enable

Whether the text field is enabled or not.

  • Type: bool

  • Default: true

label

An optional text that describes the input field.

  • Type: String?

  • Default: optional

description

A text that provides context about the value, such as how the value will be used.

  • Type: String?

  • Default: optional

validator

An optional method that validates an input.

  • Type: CValidationResult? Function(String? value)?

  • Default: optional

isRequired

If required, the text field label will be followed by red * .

  • Type: bool

  • Default: false

Example

CTextField(
  label: 'Label',
  description: 'Description',
  validator: (value) {
    // OR return null
    return CValidationResult(
        kind: CValidationKind.warning,
        message: 'Your input is missing something.',
    );
  },
);

Last updated