0

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

byhuang1998
  • 377
  • 1
  • 5
  • 25

3 Answers3

1
Container(
  decoration: BoxDecoration(
    shape: BoxShape.circle //This will make container round
  )
)
camelCase1492
  • 642
  • 8
  • 17
1

Is there a better solution?

How about FoatingActionButton?

FloatingActionButton(
                backgroundColor: Colors.blue,
                elevation: 0.0,
                child: Text("15", style: TextStyle(color: Colors.white)),
                onPressed: () {})
John Joe
  • 12,412
  • 16
  • 70
  • 135
1

You can also use RawMaterialButton for more options like this:

RawMaterialButton(
      elevation: 2.0,
      fillColor:  Colors.black,
      shape: CircleBorder(),
      onPressed: () {});
      },
    )
Bensal
  • 3,316
  • 1
  • 23
  • 35