Flutter Widgets (Boxes Part-2) The Whole Picture

Murtaza Sulaihi
Flutter Community

--

Number 10 is afraid of Number 7, do you know why? you might have to read my story to know the answer. 7 is my lucky number and this is my seventh story on medium, so let’s get on with it.

Welcome back to the 2nd part of my story on Flutter Boxes. We are going to discuss another 5 types of Box widgets in Flutter. FittedBox, LimitedBox, PlaceHolder, RotatedBox and DecoratedBox. I would like to add 1 more widget to the list the Spacer, though it doesn’t end with a box as its suffix but falls in the same category. Let us start with FittedBox first.

FittedBox

Fitted Box is used to scale and position its child within itself according to its fit property. If you want to lay or adjust a widget that you feel it is out of place according to the widgets on the screen, a Fitted box comes in handy to scale and position in its proper place.

--------------------------- Constructor ----------------------
FittedBox
(
fit: BoxFit.contain, // default fit property
alignment: Alignment.center, // default alignment
clipBehavior: Clip.hardEdge,
child: )

There are seven different fit properties, BoxFit.Contain which is the default property then…

--

--

Murtaza Sulaihi
Flutter Community

By profession, I am a school professor and I also develop Android applications and also Flutter applications.