Target Audience: Beginner
Recipe: Learn to use FittedBox layout widget to create responsive layouts for Flutter applications.
Focus Widget: FittedBox
FittedBox widget is a single child layout widget which means it can have only one child assigned to it. In this example, the
Row widget is added as child to
FittedBox widget. The
Row widget has two
Image widgets as its children. Normally, the second child of
Row widget will overflow to right when it renders its children on a screen size which is not sufficient to accommodate all of its children. However, with
FittedBox this problem of widget overflowing is solved. It scales and position its child within the parent widget.
Checkout the companion video tutorial:
FittedBox( child: Row( children: [ Image.asset('assets/flutter_icon.png'), Image.asset('assets/flutter_icon.png'), ], ), )
Source Code Repo
Happy cooking with Flutter :)
_Liked the article?Liked the article? Let me know with 👏👏👏