withSafety static method

Widget withSafety(
  1. BuildContext context,
  2. Widget widget
)

Applies SafeArea to the widget based on the SafeBar settings in the context.

This method is used internally by Bar to handle safe areas.

Implementation

static Widget withSafety(BuildContext context, Widget widget) {
  SafeBar? s = context.pylonOr<SafeBar>();

  if (s != null) {
    return SafeArea(
      top: s.top,
      bottom: s.bottom,
      left: s.left,
      right: s.right,
      child: widget,
    );
  }
  return widget;
}