byhuang1998
byhuang1998

Reputation: 417

flutter: how to get a rounded container in flutter?

I'm new in flutter and I want to make a round container. I have done this but I don't know how to adjust the value to adapt it. Is there a better solution? Thanks in advance.

Widget Cube() {
  return Container(
    width: 70, height: 70,
    child: Container(
      width: 64, height: 64,
      decoration: BoxDecoration(
        color: CalendarColor.blue,
        borderRadius: BorderRadius.all(
          Radius.circular(32),
        )
      ),
    ),
  );
}

what I want is like this. enter image description here

Upvotes: 0

Views: 936

Answers (3)

Bensal
Bensal

Reputation: 4130

You can also use RawMaterialButton for more options like this:

RawMaterialButton(
      elevation: 2.0,
      fillColor:  Colors.black,
      shape: CircleBorder(),
      onPressed: () {});
      },
    )

Upvotes: 1

John Joe
John Joe

Reputation: 12803

Is there a better solution?

How about FoatingActionButton?

FloatingActionButton(
                backgroundColor: Colors.blue,
                elevation: 0.0,
                child: Text("15", style: TextStyle(color: Colors.white)),
                onPressed: () {})

Upvotes: 1

camelCase1492
camelCase1492

Reputation: 672

Container(
  decoration: BoxDecoration(
    shape: BoxShape.circle //This will make container round
  )
)

Upvotes: 2

Related Questions