updateSize method

  1. @action
void updateSize(
  1. int index,
  2. DragUpdateDetails dragDetails
)

Resize the child panels when the user is draggin the using the panel dividers.

Implementation

@action
void updateSize(int index, DragUpdateDetails dragDetails) {
  if (panelSizes == null || panelSizes!.length <= index) return;

  final delta =
      axis == Axis.vertical ? dragDetails.delta.dy : dragDetails.delta.dx;

  if (panelSizes![index] + delta > 50 &&
      panelSizes![index + 1] - delta > 50) {
    panelSizes![index] += delta;
    panelSizes![index + 1] -= delta;
  }
}