I suggest as below.

function handleScreenLayoutChange(evt) {
  if (evt.detail.name !== portrait)
     return;
  isPortrait = evt.detail.status; // true => portrait , false => landscape
  ...
}