Search code snippets, questions, articles...

Add border to container in flutter

    decoration: BoxDecoration(
        border: Border.all(
            width: 2.0,
            style: BorderStyle.solid
    child: Text(
        'Hello world'
Best JSON Validator, JSON Tree Viewer, JSON Beautifier at same place. Check how cool is the tool

The code snippet can be helpful if you want to add a border around a Container widget in Flutter. We can use decoration property for that and pass 'border' to BoxDecoration. We have used Border.all to specify border properties like width, color, and style of the border. This will add a 'solid' border of width '2.0' around the Container.

Was this helpful?