示例#1
0
        public override Widget build(BuildContext context)
        {
            D.assert(WidgetsD.debugCheckHasMediaQuery(context));
            MediaQueryData data    = MediaQuery.of(context);
            EdgeInsets     padding = data.padding;

            if (data.padding.bottom == 0.0 && data.viewInsets.bottom != 0.0 && maintainBottomViewPadding)
            {
                padding = padding.copyWith(bottom: data.viewPadding.bottom);
            }
            return(new Padding(
                       padding: EdgeInsets.only(
                           left: Mathf.Max(left ? padding.left : 0.0f, minimum.left),
                           top: Mathf.Max(top ? padding.top : 0.0f, minimum.top),
                           right: Mathf.Max(right ? padding.right : 0.0f, minimum.right),
                           bottom: Mathf.Max(bottom ? padding.bottom : 0.0f, minimum.bottom)
                           ),
                       child: MediaQuery.removePadding(
                           context: context,
                           removeLeft: left,
                           removeTop: top,
                           removeRight: right,
                           removeBottom: bottom,
                           child: child)));
        }
示例#2
0
 public MediaQueryData removePadding(
     bool removeLeft   = false,
     bool removeTop    = false,
     bool removeRight  = false,
     bool removeBottom = false
     )
 {
     if (!(removeLeft || removeTop || removeRight || removeBottom))
     {
         return(this);
     }
     return(new MediaQueryData(
                size: size,
                devicePixelRatio: devicePixelRatio,
                textScaleFactor: textScaleFactor,
                platformBrightness: platformBrightness,
                padding: padding.copyWith(
                    left: removeLeft ? (float?)0.0f : null,
                    top: removeTop ?(float?)0.0f : null,
                    right: removeRight ? (float?)0.0f : null,
                    bottom: removeBottom ?(float?)0.0f : null
                    ),
                viewPadding: viewPadding.copyWith(
                    left: removeLeft ? (float?)Mathf.Max(0.0f, viewPadding.left - padding.left) : null,
                    top: removeTop ? (float?)Mathf.Max(0.0f, viewPadding.top - padding.top) : null,
                    right: removeRight ? (float?)Mathf.Max(0.0f, viewPadding.right - padding.right) : null,
                    bottom: removeBottom ? (float?)Mathf.Max(0.0f, viewPadding.bottom - padding.bottom) : null
                    ),
                viewInsets: viewInsets,
                alwaysUse24HourFormat: alwaysUse24HourFormat,
                highContrast: highContrast,
                disableAnimations: disableAnimations,
                invertColors: invertColors,
                accessibleNavigation: accessibleNavigation,
                boldText: boldText
                ));
 }