Source Code
Text(
'Welcome to Flutter!',
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
color: Colors.blue,
),
textAlign: TextAlign.center,
maxLines: 2,
overflow: TextOverflow.ellipsis,
)
Ai Code Analizer
🎨 2. Default Behavior
Without any additional parameters:
Font: Uses the app’s default font (typically Roboto on Android).
Size: Inherits the font size from the app’s theme (usually 14.0 or 16.0 sp).
Color: Also inherited from the current
ThemeData.Alignment: If not wrapped in a layout widget, it takes as much space as the text needs.
Overflow: No handling unless explicitly set (
overflowproperty).Soft wrap: Enabled by default (
softWrap: true).
⚙️ 3. Important Properties You Can Use
You can customize the Text widget with many parameters. Here are key ones:
| Property | Description |
|---|---|
style | A TextStyle object to define font size, weight, color, etc. |
textAlign | Aligns the text within its container (left, center, right, etc.). |
overflow | Handles overflow (ellipsis, fade, clip, etc.). |
maxLines | Limits the number of lines the text can occupy. |
softWrap | Whether the text should break at soft line breaks. |
textDirection | Determines left-to-right or right-to-left layout. |
locale | Used to select region-specific glyphs. |
semanticsLabel | A label used by accessibility tools like screen readers. |
