systemPadding property

EdgeInsets get systemPadding

Keep system navigation insets, replacing camera strips with local checks.

Implementation

EdgeInsets get systemPadding {
  var leftDepth = 0.0;
  var rightDepth = 0.0;
  for (final camera in cutouts) {
    if (camera.left < size.width / 4) {
      leftDepth = math.max(leftDepth, camera.right);
    }
    if (camera.right > size.width * 3 / 4) {
      rightDepth = math.max(rightDepth, size.width - camera.left);
    }
  }
  double remaining(double inset, double cameraDepth) =>
      cameraDepth > 0 && inset <= cameraDepth + 8 ? 0 : inset;
  return EdgeInsets.fromLTRB(
    remaining(padding.left, leftDepth),
    padding.top,
    remaining(padding.right, rightDepth),
    padding.bottom,
  );
}