Reputation: 101
How can I add a rounded border for only 3 sides of the box? It's giving me errors if i add an "only" per sides if there is a border radius included.
this is my Code
Container(
padding: const EdgeInsets.all(10.0),
decoration: BoxDecoration(
border: Border.all(color:Colors.grey, width: 2.5),
borderRadius: BorderRadius.circular(13.0),
),
child: child,
)
Upvotes: 3
Views: 3202
Reputation: 267404
I didn't quite get the screenshot but to have border for three sides, say for only left, right and bottom, use:
final borderSide = BorderSide(color: Colors.white, width: 2);
Container(
decoration: BoxDecoration(
border: Border(
left: borderSide,
right: borderSide,
bottom: borderSide,
),
),
child: child,
)
Upvotes: 4
Reputation: 2272
simply use .only in place of .circular
Container(
padding: const EdgeInsets.all(10.0),
decoration: BoxDecoration(
border: Border.all(color:Colors.grey, width: 2.5),
borderRadius: BorderRadius.only(topLeft: Radius.circular(13.0),topRight: Radius.circular(13.0)),
),
child: child,
)
Similarly you can add bottomLeft and bottomRight in .only
Upvotes: 1