TextFieldComponent constructor

TextFieldComponent({
  1. required Vector2 position,
  2. required Vector2 size,
  3. PositionComponent? background,
  4. PositionComponent? backgroundFocused,
  5. TextStyle textStyle = const TextStyle(color: Colors.white, fontSize: 12),
  6. OnTextChanged? onChanged,
  7. String? hintText,
  8. EdgeInsets padding = EdgeInsets.zero,
  9. TextEditingController? controller,
})

Creates a TextFieldComponent.

position and size define the position and size of the text field. Accepts generic background components for both states.

Implementation

TextFieldComponent({
  required Vector2 position,
  required Vector2 size,
  this.background,
  this.backgroundFocused,
  this.textStyle = const TextStyle(color: Colors.white, fontSize: 12),
  this.onChanged,
  this.hintText,
  this.padding = EdgeInsets.zero,
  TextEditingController? controller,
}) : super(position: position, size: size) {
  _controller = controller ?? TextEditingController();
  textPaint = TextPaint(style: textStyle);
  hintTextPaint = TextPaint(
    style: textStyle.copyWith(
      color: (textStyle.color ?? Colors.white).withAlpha(127),
    ),
  );
}