Let's start by updating the small box in the center and turning it into a shiny ball:
- In the ImmutableWidget class, replace the third container with this method:
@override
Widget build(BuildContext context) {
return Container(
color: Colors.green,
child: Padding(
padding: EdgeInsets.all(40),
child: Container(
color: Colors.purple,
child: Padding(
padding: const EdgeInsets.all(50.0),
child: _buildShinyCircle()
),
),
),
);
}
- Write the method for the shiny circle. You will be adding BoxDecoration to a Container, which can include gradients, shapes, shadows, borders, and even images.
After adding BoxDecoration, you should make sure to remove the original color property on the container, otherwise, you will get an exception. Containers can have a decoration or a color, but not both.
- Add the following code at the end of the ImmutableWidget class:
Widget _buildShinyCircle() {
return...