onControlFocusChanged method

void onControlFocusChanged(
  1. bool hasFocus
)

This method is called from FormControl to notify the controller that the focus in the control has changed.

The hasFocus argument represents the state of the FormControl.

Implementation

void onControlFocusChanged(bool hasFocus) {
  _modelToViewChanges = true;

  if (hasFocus && !focusNode.hasFocus) {
    focusNode.requestFocus();
  } else if (!hasFocus && focusNode.hasFocus) {
    focusNode.unfocus();
  }

  updateFocus(hasFocus);
}