withBorder method

Widget withBorder({
  1. Color color = Colors.black,
  2. double width = 1.0,
})

Adds a border to the widget with customizable color and width

Example:

Widget myWidget = Text("Hello").withBorder(color: Colors.red, width: 2.0);

Implementation

Widget withBorder({Color color = Colors.black, double width = 1.0}) {
  return Container(
    decoration: BoxDecoration(
      border: Border.all(color: color, width: width),
    ),
    child: this,
  );
}