MediaQueryModifier.removePadding constructor
MediaQueryModifier.removePadding({})
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 is required, must not be null, and must have a
MediaQuery in scope.
The removeLeft
, removeTop
, removeRight
, and removeBottom
arguments
must not be null. If all four are false (the default) then the returned
MediaQuery reuses the ambient MediaQueryData unmodified, which is not
particularly useful.
The child
argument is required and must not be null.
See also:
- SafeArea, which both removes the padding from the MediaQuery and adds a Padding widget.
- MediaQueryData.padding, the affected property of the MediaQueryData.
- removeViewInsets, the same thing but for MediaQueryData.viewInsets.
- removeViewPadding, the same thing but for MediaQueryData.viewPadding.
Implementation
factory MediaQueryModifier.removePadding({
Key? key,
required BuildContext context,
bool removeLeft = false,
bool removeTop = false,
bool removeRight = false,
bool removeBottom = false,
Widget? child,
}) {
return MediaQueryModifier(
key: key,
data: MediaQuery.of(context).removePadding(
removeLeft: removeLeft,
removeTop: removeTop,
removeRight: removeRight,
removeBottom: removeBottom,
),
child: child,
);
}