border method

Widget border({
  1. Key? key,
  2. double? all,
  3. double? left,
  4. double? right,
  5. double? top,
  6. double? bottom,
  7. double? radius,
  8. Color? backgroundColor,
  9. Color color = const Color(0xFF000000),
  10. BorderStyle style = BorderStyle.solid,
})

边框

Implementation

Widget border({
  Key? key,
  double? all,
  double? left,
  double? right,
  double? top,
  double? bottom,
  double? radius,
  Color? backgroundColor,
  Color color = const Color(0xFF000000),
  BorderStyle style = BorderStyle.solid,
}) {
  Border border = Border(
    left: (left ?? all) == null
        ? BorderSide.none
        : BorderSide(color: color, width: left ?? all ?? 0, style: style),
    right: (right ?? all) == null
        ? BorderSide.none
        : BorderSide(color: color, width: right ?? all ?? 0, style: style),
    top: (top ?? all) == null
        ? BorderSide.none
        : BorderSide(color: color, width: top ?? all ?? 0, style: style),
    bottom: (bottom ?? all) == null
        ? BorderSide.none
        : BorderSide(color: color, width: bottom ?? all ?? 0, style: style),
  );
  BorderRadius borderRadius = BorderRadius.all(Radius.circular(radius ?? 0));
  return decorated(
    color: backgroundColor,
    key: key,
    border: border,
    borderRadius: borderRadius,
  );
}