Text Widget Properties in Flutter

TextDirection


Represents the directionality of the text.


Example:


import 'package:flutter/material.dart';

void main() {

  runApp(

    MaterialApp(

      home: Scaffold(

        appBar: AppBar(

          title: const Text('Sample App'),

        ),

        body: const Text('Lorem Ipsum is simply dummy text of the printing.',

        textDirection: TextDirection.ltr,

        ),

      ),

    ),

  );

}


TextAlign


How the text should be aligned horizontally.


Example:


textAlign: TextAlign.center,


Overflow


How visual overflow should be handled.


Example:


overflow: TextOverflow.ellipsis,


TextScaleFactor


If the text scale factor is 1.5, the text will be 50% larger than the specified font size.


SoftWrap


Whether the text should break at soft line breaks.


Example:


softWrap: true,


MaxLines


The maximum number of lines for the text to span, wrapping if necessary.


Example:


maxLines: 10,


semanticLabel


Used to provide a description of the image, icons and symbols.


Example:


Text(

          '#',

          semanticsLabel: 'Hash sign',

),


Video Link:

 
Post a Comment (0)
Previous Post Next Post