0

Someone knows how to do soft border radius, something like that :

enter image description here

Is it even possible with Flutter, I can't find how.

nativ
  • 39
  • 1
  • 6

2 Answers2

1

You can achieve this by using the borderRadius property of the decoration inside a Container.

For example:

Column(
  mainAxisAlignment: MainAxisAlignment.spaceAround,
  children: [
     Container(
      height: 200,
      width: 200,
      decoration: BoxDecoration(
        color: Colors.blue,
        borderRadius: BorderRadius.all(Radius.elliptical(20, 10)),
      ),
    ),
    Container(
      height: 200,
      width: 200,
      decoration: BoxDecoration(
        color: Colors.blue,
        borderRadius: BorderRadius.all(Radius.circular(20)),
      ),
    ),
  ],
),

will yield this result

Example using decoration

on the other hand, if you want to have a different color for the border, you can try this, setting the color in the border property of the decoration property in the Container:

Center(
    child: Column(
      mainAxisAlignment: MainAxisAlignment.spaceAround,
      children: [
        Container(
          height: 200,
          width: 200,
          decoration: BoxDecoration(
            borderRadius: BorderRadius.all(Radius.circular(20)),
            border: Border.all(
              color: Colors.red,
            ),
          ),
          child: Center(
            child: Text('Content...'),
          ),
        ),
      ],
    ),
),

the result for this is

Example using a border Color

Luis Cárcamo
  • 309
  • 1
  • 3
  • 11
0

You can use ClipRect.

ClipRRect(
    // Change border radius and type(.zero, .roundrect, or absolute values) to get your desired effect
    borderRadius: BorderRadius.circular(8.0),
    child: Container(color: Colors.grey),
)
RealRK
  • 315
  • 3
  • 19