margin method

Widget margin({
  1. double all = 0,
  2. double horizontal = 0,
  3. double vertical = 0,
  4. double left = 0,
  5. double right = 0,
  6. double top = 0,
  7. double bottom = 0,
})

Apply margin

Implementation

Widget margin({
  double all = 0,
  double horizontal = 0,
  double vertical = 0,
  double left = 0,
  double right = 0,
  double top = 0,
  double bottom = 0,
}) {
  return Container(
    margin: EdgeInsets.only(
      left: left != 0 ? left : (horizontal != 0 ? horizontal : all),
      right: right != 0 ? right : (horizontal != 0 ? horizontal : all),
      top: top != 0 ? top : (vertical != 0 ? vertical : all),
      bottom: bottom != 0 ? bottom : (vertical != 0 ? vertical : all),
    ),
    child: this,
  );
}