/*
 * @Author: XianKaiQun
 * @Date: 2020-07-28 15:11:21
 * @LastEditors: XianKaiQun
 * @LastEditTime: 2020-08-18 16:24:50
 * @Description: 
 */
import 'package:flutter/widgets.dart';

///在外部套一个Padding
extension ExtensionPadding on Widget {
  Widget asPaddingFromLTRB(
      double left, double top, double right, double bottom) {
    return Padding(
      padding: EdgeInsets.fromLTRB(left, top, right, bottom),
      child: this,
    );
  }

  Widget asPaddingAll(double value) {
    return Padding(
      padding: EdgeInsets.all(value),
      child: this,
    );
  }

  Widget asPaddingOnly(
      {double left = 0, double top = 0, double right = 0, double bottom = 0}) {
    return Padding(
      padding: EdgeInsets.only(
        left: left,
        top: top,
        right: right,
        bottom: bottom,
      ),
      child: this,
    );
  }

  Widget asPaddingSymmetric({double? vertical, double? horizontal}) {
    if (vertical == null && horizontal == null) return this;
    return Padding(
      padding: EdgeInsets.symmetric(
        vertical: vertical ?? 0,
        horizontal: horizontal ?? 0,
      ),
      child: this,
    );
  }
}
