bringToFront method

void bringToFront(
  1. Window win
)

Brings the given window to the front of all windows.

Implementation

void bringToFront(Window win) {
  if (windows.isEmpty) return;
  var maxZ = win.zIndex;
  for (final other in windows) {
    if (other != win && other.zIndex > maxZ) {
      maxZ = other.zIndex;
    }
  }
  if (win.zIndex <= maxZ) {
    win.zIndex = maxZ + 1;
  }
}