border method
边框
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,
);
}