setViewPortOffsets method

void setViewPortOffsets(
  1. double left,
  2. double top,
  3. double right,
  4. double bottom,
)

Replaces the automatic offsets with fixed ones and applies them on the next UI loop pass. Legend and axis labels are no longer accounted for; prefer setExtraOffsets unless you need this. resetViewPortOffsets restores automatic offsets.

left, top, right and bottom are the space in pixels between each view edge and the content area.

Implementation

void setViewPortOffsets(
  double left,
  double top,
  double right,
  double bottom,
) {
  _customViewPortEnabled = true;
  post(() {
    viewPortHandler.restrainViewPort(left, top, right, bottom);
    prepareOffsetMatrix();
    prepareValuePxMatrix();
  });
}