Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

oval shape in flutter

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

like image 554
Farhana Naaz Ansari Avatar asked Dec 05 '22 09:12

Farhana Naaz Ansari


1 Answers

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('     '),
            ),
          ),
like image 104
diegoveloper Avatar answered Dec 17 '22 20:12

diegoveloper