Logo

K-Learn

Flutter Text Widget

< Previous Next >

The Text widget is a basic widget in Flutter that displays a string of text on the screen. It can be used to create titles, headings, labels, buttons, and more.

Here's an example of using the "Text" widget to create a simple title:

Text(
  'Hello, World!',
  style: TextStyle(
    fontSize: 24,
    fontWeight: FontWeight.bold,
    color: Colors.blue,
  ),
),

Text Widget Properties:

data: The actual text that the widget will display.
style: Defines the style of the text, including font size, font weight, color, and more.
textAlign: Determines the horizontal alignment of the text within its container, with options like left, center, and right.
maxLines: Limits the number of lines of text that will be displayed.
overflow: Determines how the widget will handle overflow text, with options like ellipsis and fade.
textDirection: Determines the direction of the text, with options like ltr (left-to-right) and rtl (right-to-left).

Output:


< Previous Next >