Flutter Tutorial | Flutter Flex and Expanded Widgets | Flex and Expanded widget in Flutter |

preview_player
Показать описание
Flutter – Flexible Widget

#Flex #Expanded #Flutter #widgets #tutorial #Programming

Flex Widget
A widget that displays its children in a one-dimensional array.
The Flex widget allows you to control the axis along which the children are placed (horizontal or vertical). This is referred to as the main axis. If you know the main axis in advance, then consider using a Row (if it's horizontal) or Column (if it's vertical) instead, because that will be less verbose.
To cause a child to expand to fill the available space in the direction of this widget's main axis, wrap the child in an Expanded widget.
The Flex widget does not scroll (and in general it is considered an error to have more children in a Flex than will fit in the available room). If you have some widgets and want them to be able to scroll if there is insufficient room, consider using a ListView.
If you only have one child, then rather than using Flex, Row, or Column, consider using Align or Center to position the child.

Flutter – Expanded Widget

Expanded Widget
A widget that expands a child of a Row, Column, or Flex so that the child fills the available space.
Using an Expanded widget makes a child of a Row, Column, or Flex expand to fill the available space along the main axis (e.g., horizontally for a Row or vertically for a Column). If multiple children are expanded, the available space is divided among them according to the flex factor.
An Expanded widget must be a descendant of a Row, Column, or Flex, and the path from the Expanded widget to its enclosing Row, Column, or Flex must contain only StatelessWidgets or StatefulWidgets (not other kinds of widgets, like RenderObjectWidgets).

Рекомендации по теме