hook method

  1. @override
Element hook(
  1. BuildContext context,
  2. Element v
)
override

Implementation

@override
Element hook(BuildContext context, Element v) {
  // TODO: see how we can update the value when calling a new build
  if (controller?.isAttached == true && controller?.element is InputElement) {
    context.element = controller!.element;
    return controller!.element;
  }
  // TODO: update the attribute of the InputElement if the widget parameter are changed

  final el = v as InputElement;

  controller?.attachMe(el);

  if (value != null) el.value = value;
  if (placeholder != null) el.placeholder = placeholder!;
  if (autofocus != null) el.autofocus = autofocus!;
  if (autocomplete != null) el.autocomplete = autocomplete!;
  if (autocapitalize != null) el.autocapitalize = autocapitalize!;
  if (disabled != null) el.disabled = disabled!;
  if (checked != null) el.checked = checked!;
  if (readOnly != null) el.readOnly = readOnly!;

  return super.hook(context, el);
}