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. InputVariant variant = InputVariant.outline,
  10. ComponentSize size = ComponentSize.md,
  11. String? error,
  12. FormErrors? errors,
  13. String? helpText,
  14. String? className,
  15. Map<String, Object?> props = const {},
  16. Map<String, Object?> inputProps = const {},
  17. Map<String, Object?> style = const {},
  18. Map<String, Object?> inputStyle = const {},
  19. DartStyle? dartStyle,
  20. DartStyle? inputDartStyle,
  21. void onChanged(
    1. Object event
    )?,
})

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,
  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,
}) : 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,
         variant: variant,
         size: size,
         error: resolveFieldError(name: name, error: error, errors: errors),
         helpText: helpText,
         inputProps: inputProps,
         inputStyle: inputStyle,
         inputDartStyle: inputDartStyle,
         onChanged: _controlledOnChanged(controller, onChanged),
       ),
     );