TextFieldComponent constructor
TextFieldComponent({
- required Vector2 position,
- required Vector2 size,
- PositionComponent? background,
- PositionComponent? backgroundFocused,
- TextStyle textStyle = const TextStyle(color: Colors.white, fontSize: 12),
- OnTextChanged? onChanged,
- String? hintText,
- EdgeInsets padding = EdgeInsets.zero,
- 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),
),
);
}