Expanded
is just a shorthand for Flexible
Using expanded this way:
Expanded(
child: Foo(),
);
is strictly equivalent to:
Flexible(
fit: FlexFit.tight,
child: Foo(),
);
You may want to use Flexible
over Expanded
when you want a different fit
, useful in some responsive layouts.
The difference between FlexFit.tight
and FlexFit.loose
is that loose will allow its child to have a maximum size while tight forces that child to fill all the available space.