Basic widgets : Text and Center






Text
The Text widget lets you create a run of styled text within your application.
Source Code :


import 'package:flutter/material.dart'; void main() {                                  // main function  .....   runApp(Text(                                 // Text Widget  .....     "Hello Flutter 1.7",                       // data ....     textAlign: TextAlign.center,               // alignment ....     textDirection: TextDirection.ltr,          // text direction  ....   )); }

Run Applications : Output

See the output of program on top



Center
A widget that centers its child within itself.
Source Code :

import 'package:flutter/material.dart';



void main() {

  // main function  .....

  runApp(

    Center(   //Center Widgets

        child: Text(

      // Text Widget  .....

      "Hello Flutter 1.7", // data ....

      textAlign: TextAlign.center, // alignment ....

      textDirection: TextDirection.ltr, // text direction  ....

    )),

  );

}

Run Applications : Output





Comments

Popular posts from this blog

Building Weather App using MVVM design pattern (Kotlin)

4. Do Coding