@@ -6,19 +6,50 @@ In Flutter, a widget is a class that represents a visual element in the user int
Widgets respond to state changes, so when the state changes, Flutter will rebuild its description and compare the new description with the previous description to determine the minimal changes needed to change the UI.
# Difference between a Stateless and Stateful Widget
If the widget can change when the user interacts with it, meaning it can react to state changes, it's a stateful widget. If the widget never changes throughout the lifetime of the application, such as the `icon` and `Text` widgets, then the widget is stateless. When creating a widget, think about if the widget needs to be changed at any point
### Side Note: When to Use `const` with a Widget
To determine if a widget needs the `const` keyword, think "does the widget change at any point?" If the answer is no, use const. If yes, don't use const.
# A Few Basic Built-in Widgets
### Text
The `Text` widget lets you create stylized text for your application
The `Text` widget lets you create stylized text for your application. Example:
```dart
Test(
"Hello, world",
textAlign:TextAlign.center,
style:constTextStyle(fontWeight:FontWeight.bold),
)
```
### Row / Column
These flex widets lets you create flexible layouts in both the horizontal `Row` and vertical `Column` directions. The design of these are based on the web's flexbox layout model
These flex widets lets you create flexible layouts in both the horizontal `Row` and vertical `Column` directions. The design of these are based on the web's flexbox layout model.
Example:
```dart
Row(
children:const[
Icon(Icons.person),
SizedBox(
width:10,
),
Text('Username'),
],
)
```
In this example, a person icon and the text "username" is displayed, with a small separator placed between them.
A `Column` works in a similar fashion but instead of placing items side by side, items go top to bottom.
### Container
The `Container` widget lets you create a rectangular visual element. Containers can be decorated with a `BoxDecoration`, such as a background, a border, or a shadow. They can also have margins, padding, and constraints applied to its size
The `Container` widget lets you create a rectangular visual element. Containers can be decorated with a `BoxDecoration`, such as a background, a border, or a shadow. They can also have margins, padding, and constraints applied to its size.