Chrome Extension

Add border to widget in Flutter

//ADD BORDER TO ALL SIDES
Container(
  decoration: BoxDecoration(
    border: Border.all(
      color: Colors.red,
      width: 3.0,
    ),
  ),
)

//ADD BORDER TO SPECIFIC SIDES
Container(
  decoration: BoxDecoration(
    border: Border(
      left: BorderSide(
        color: Colors.red,
        width: 3.0,
      ),
      top: BorderSide(
        color: Colors.blue,
        width: 3.0,
      ),
    ),
  ),
)
Best JSON Validator, JSON Tree Viewer, JSON Beautifier at same place. Check how cool is the tool

You can easily add a border to a widget in Flutter by using decoration property and passing border property to it. You can add a border to all sides by using Border.all() and for adding border to specific sides of the widget, you can use BorderSide().

Was this helpful?
0 Comments