MediaQuery.removeViewInsets constructor
Creates a new MediaQuery that inherits from the ambient MediaQuery from the given context, but removes the specified view insets.
This should be inserted into the widget tree when the MediaQuery view insets are consumed by a widget in such a way that the view insets are 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:
- MediaQueryData.viewInsets, the affected property of the MediaQueryData.
- MediaQuery.removePadding, the same thing but for MediaQueryData.padding.
- MediaQuery.removeViewPadding, the same thing but for MediaQueryData.viewPadding.
Implementation
MediaQuery.removeViewInsets({
super.key,
required BuildContext context,
bool removeLeft = false,
bool removeTop = false,
bool removeRight = false,
bool removeBottom = false,
required super.child,
}) : data = MediaQuery.of(context).removeViewInsets(
removeLeft: removeLeft,
removeTop: removeTop,
removeRight: removeRight,
removeBottom: removeBottom,
);