oval shape in flutter

Asked by At

I'm trying to create Oval shape by using Radius.circular but it looks like circular shape and I have also tried to change Radius.elliptical but still getting a different shape.

  Expanded(
            flex: 13,
            child:  Container(
              height: 100,
              width:100,
              margin: EdgeInsets.only(top: 40,left: 40,right: 40),
              decoration: new BoxDecoration(
                color: MyColors.colorPrimary,
                border: Border.all(color: Colors.black, width: 0.0),
                borderRadius:
                new BorderRadius.all(Radius.elliptical(90,45)),
              ),
              child: Text('     '),
            ),

I want this

enter image description here

but getting this

enter image description here

1 Answers

2
diegoveloper On Best Solutions

I assume you are using a Column or Row widget as parent and using Expanded your child is trying to expand to the horizontal.

Add an Align or Center widget as a parent of your Container and it should work:

    Align(
            child: Container(
              height: 50,
              width: 100,
              margin: EdgeInsets.only(top: 40, left: 40, right: 40),
              decoration: new BoxDecoration(
                color: Colors.green,
                border: Border.all(color: Colors.black, width: 0.0),
                borderRadius: new BorderRadius.all(Radius.elliptical(100, 50)),
              ),
              child: Text('     '),
            ),
          ),