Text

This article shows some examples with Text widget.

Download source code

Default

Text('Lorem ipsum dolor sit amet, consectetur adipiscing elit.'),

TextStyle

Text(
              'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
              style: TextStyle(
                color: Colors.deepPurple,
                fontSize: 20,
                letterSpacing: 5,
                wordSpacing: 10,
                fontWeight: FontWeight.bold,
              ),
            ),

Underline

Text(
              'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
              style: TextStyle(
                decoration: TextDecoration.underline,
              ),
            ),

RichText

RichText(
              text: TextSpan(
                  style: new TextStyle(
                    color: Colors.black,
                  ),
                  children: <TextSpan>[
                    TextSpan(text: "Lorem ipsum dolor sit "),
                    TextSpan(
                        text: 'amet',
                        style: new TextStyle(fontWeight: FontWeight.bold)),
                    TextSpan(text: ", consectetur "),
                    TextSpan(
                        text: 'adipiscing',
                        style: new TextStyle(
                            decoration: TextDecoration.lineThrough)),
                    TextSpan(text: " elit."),
                  ]),
            ),

Horizontal divider with text in the middle

Row(children: <Widget>[
              Expanded(child: Divider(color: Colors.black)),
              Text(" THE END ", style: TextStyle(color: Colors.black)),
              Expanded(child: Divider(color: Colors.black)),
            ]),