Material Text Widget Tutorial

The Text widget displays a string of text with single style. The string might break across multiple lines or might all be displayed on the same line depending on the layout constraints.


Material Text Widget useful Inputs

  • First input is the string text.

  • textAlign: Whether and how to align text horizontally.

  • overflow: How overflowing text should be handled.


Material Text Widget example

Text(
    'Bismillah App',
    textAlign: TextAlign.center,
    overflow: TextOverflow.ellipsis,
)

Full example

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

void main() => (runApp(TextExample()));

class TextExample extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Container(
        child: Text("Material Text"),
        alignment: Alignment.center,
      ),
    );
  }
}