How To Set Textalign Example Using Flutter Android App

admin_img Posted By Bajarangi soft , Posted On 09-10-2020

TextAlign property works inside Container widget which has increase width and height so the Text widget can move in all directions according to given alignment.

How To Set Textalign Example Using Flutter Android App

Textalign Example
Complete Code For Textalign Example In Flutter
main.dart

import 'package:flutter/material.dart';

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
        home: Scaffold(
            appBar: AppBar(
              backgroundColor: Colors.amberAccent,
                title: Text(' TextAlign Example')),
            body: Padding(
              padding: const EdgeInsets.all(20.0),
              child: Container(
                  height: 200,
                  width: 400,
                  decoration: BoxDecoration(
                      border: Border.all(
                        color: Colors.black54,
                        width: 2,
                      )),
                  child :Text('Enter Text',
                      style: TextStyle(fontSize: 20),
                      textAlign: TextAlign.center)
              ),
            )
        )
    );
  }
}

Related Post