MediaQuery.removePadding constructor

MediaQuery.removePadding(
  1. {Key? key,
  2. required BuildContext context,
  3. bool removeLeft = false,
  4. bool removeTop = false,
  5. bool removeRight = false,
  6. bool removeBottom = false,
  7. required Widget child}
)

Creates a new MediaQuery that inherits from the ambient MediaQuery from the given context, but removes the specified padding.

This should be inserted into the widget tree when the MediaQuery padding is consumed by a widget in such a way that the padding is no longer exposed to the widget's descendants or siblings.

The context argument must have a MediaQuery in scope.

If all four of the removeLeft, removeTop, removeRight, and removeBottom arguments are false (the default), then the returned MediaQuery reuses the ambient MediaQueryData unmodified, which is not particularly useful.

See also:

Implementation

factory MediaQuery.removePadding({
  Key? key,
  required BuildContext context,
  bool removeLeft = false,
  bool removeTop = false,
  bool removeRight = false,
  bool removeBottom = false,
  required Widget child,
}) {
  return MediaQuery(
    key: key,
    data: MediaQuery.of(context).removePadding(
      removeLeft: removeLeft,
      removeTop: removeTop,
      removeRight: removeRight,
      removeBottom: removeBottom,
    ),
    child: child,
  );
}