Flutter - about adapting the application screen (you need to know this)

Опубликовано: 25 Октябрь 2024
на канале: СТОЛЕЦ
4,612
165

Go to the TG chat "Dart and Flutter in simple words" https://t.me/dart_flutter_prostymi_sl... and discuss the lessons learned.

In this video I will talk about the nuances of adaptive layout on Flutter. I'll tell you how to use dynamic height and width.

The default unit in Flutter is DP (density independent pixel). Different devices have different screen sizes and resolutions, resulting in different pixel ratios. DP (DIP) is designed to allow you to create widgets that are roughly the same size visually, regardless of device.

px (Pixel) - depends on density and not the same physical size
in (Inch) - does not depend on density and the same physical size
mm (Millimeter) - 25.4 inches, does not depend on density and the same size
pt (Point) - 72 inches, independent of density and the same size
dp (Density Independent Pixel) - ~160 inches, density independent, not the same physical size
sp (Pixel independent of scaling) - ~160 in inches, density independent, not the same physical size