bordered method

Widget bordered({
  1. bool top = true,
  2. bool bottom = true,
  3. bool left = true,
  4. bool right = true,
  5. Color color = Colors.black12,
  6. double radius = 4.0,
})

Implementation

Widget bordered({
  bool top = true,
  bool bottom = true,
  bool left = true,
  bool right = true,
  Color color = Colors.black12,
  double radius = 4.0,
}) {
  final border = BorderSide(color: color);

  return Container(
    decoration: BoxDecoration(
      borderRadius: top && bottom && left && right ? BorderRadius.all(Radius.circular(radius)) : null,
      border: Border(
        top: top ? border : BorderSide.none,
        bottom: bottom ? border : BorderSide.none,
        left: left ? border : BorderSide.none,
        right: right ? border : BorderSide.none,
      ),
    ),
    child: this,
  );
}