resizeWindow method

dynamic resizeWindow({
  1. required Key key,
  2. required double dx,
  3. required double dy,
  4. bool moveHorizontalBase = false,
  5. bool moveVerticalBase = false,
})

Implementation

resizeWindow(
    {required Key key,
    required double dx,
    required double dy,
    bool moveHorizontalBase = false,
    bool moveVerticalBase = false}) {
  final wwi = _findWindowWithIndex(key);
  final newWindow = wwi.windowState.copyWith(
    x: moveHorizontalBase &&
            wwi.windowState.width + dx > wwi.windowState.minWidth
        ? wwi.windowState.x - dx
        : null,
    y: moveVerticalBase &&
            wwi.windowState.height + dy > wwi.windowState.minHeight
        ? wwi.windowState.y - dy
        : null,
    width: (wwi.windowState.width + dx)
        .clamp(wwi.windowState.minWidth, double.infinity),
    height: (wwi.windowState.height + dy)
        .clamp(wwi.windowState.minHeight, double.infinity),
  );
  _windows[wwi.index] = newWindow;
  notifyListeners();
}