What is the difference between Expanded and Flexible widgets?
What is the difference between Expanded and Flexible widgets?
The main differences between the Expanded and Flexible widgets in Flutter are:
Expanded always takes up all the available space along the main axis (width for Row, height for Column), while Flexible only takes up the space it needs.
Expanded is a subclass of Flexible with fit: FlexFit.tight by default, which means it forces its child to fill the available space. Flexible has fit: FlexFit.loose by default, allowing its child to be smaller than the available space.
Expanded has a flex property that determines how the available space is distributed between multiple Expanded widgets. Flexible also has a flex property to control space distribution, but it's more flexible in how it sizes its child.
Đăng nhập để tham gia thảo luận cùng mọi người.
Chưa có bình luận nào
Hãy là người đầu tiên chia sẻ suy nghĩ của bạn.