TextField constructor

TextField({
  1. String? label,
  2. String? name,
  3. TextEditingController? controller,
  4. Object? value,
  5. String? placeholder,
  6. String type = 'text',
  7. bool required = false,
  8. bool disabled = false,
  9. bool readonly = false,
  10. InputVariant variant = InputVariant.outline,
  11. ComponentSize size = ComponentSize.md,
  12. String? error,
  13. FormErrors? errors,
  14. String? helpText,
  15. String? className,
  16. Map<String, Object?> props = const {},
  17. Map<String, Object?> inputProps = const {},
  18. Map<String, Object?> style = const {},
  19. Map<String, Object?> inputStyle = const {},
  20. DartStyle? dartStyle,
  21. DartStyle? inputDartStyle,
  22. void onChanged(
    1. Object event
    )?,
  23. void onSubmitted(
    1. String value
    )?,
})

Creates a text input field.

Implementation

TextField({
  String? label,
  String? name,
  TextEditingController? controller,
  Object? value,
  String? placeholder,
  String type = 'text',
  bool required = false,
  bool disabled = false,
  bool readonly = false,
  InputVariant variant = InputVariant.outline,
  ComponentSize size = ComponentSize.md,
  String? error,
  FormErrors? errors,
  String? helpText,
  String? className,
  Map<String, Object?> props = const {},
  Map<String, Object?> inputProps = const {},
  Map<String, Object?> style = const {},
  Map<String, Object?> inputStyle = const {},
  DartStyle? dartStyle,
  DartStyle? inputDartStyle,
  void Function(Object event)? onChanged,
  void Function(String value)? onSubmitted,
}) : super(
        'div',
        props: fieldWrapperProps(
          props: props,
          className: className,
          dartStyle: dartStyle,
          style: style,
        ),
        children: _children(
          label: label,
          name: name,
          value: controller?.text ?? value,
          placeholder: placeholder,
          type: type,
          required: required,
          disabled: disabled,
          readonly: readonly,
          variant: variant,
          size: size,
          error: resolveFieldError(name: name, error: error, errors: errors),
          helpText: helpText,
          inputProps: inputProps,
          inputStyle: inputStyle,
          inputDartStyle: inputDartStyle,
          onChanged: _controlledOnChanged(controller, onChanged),
          onSubmitted: onSubmitted,
        ),
      );