This Flutter tutorials teach you how to use the Flutter framework to build mobile applications for iOS and Android. Flutter is an open-source framework to create high quality, high-performance mobile applications across mobile operating systems in both Android and iOS in a single code. Now, you don't have to learn two programming languages to make Mobile application as Java / Kotlin is only based on Android development and Swift / Obj-C is only based on iOS development. Developed and released by Google in 2017 Flutter has already achieved great success because of its features as it provides a simple, powerful, efficient, and easy to understand SDK to write a mobile application in Google’s own language, Dart

Basic Code to run the Application

Create a Flutter project, Remove all the codes from the main.dart file and can also delete the "widget_test.dart" file from test folder and insert this code in main.dart file

import "package:flutter/material.dart"; //imports material.dart flutter package

void main() => runApp(MaterialApp(debugShowCheckedModeBanner: false, home: MyApp(),)); //use to call MyApp() class

class MyApp extends StatelessWidget { //Stateless Widget
  @override
  Widget build(BuildContext context) {
    return Scaffold( //home(main) page of application-
        appBar: AppBar( //top bar of the app
          title: Text("Review2Tech Application"), //Title above the home page
        ),
        body: Container( //Container Widget
           // Widgets goes here
        ),
      );
  }
}

// We will learn about the above codes in detail in later flutter parts. Don't worry if you don't understand now

Note: Text after '//' sign are comments so ignore them

Now run the application by connecting your mobile it will show AppBar at the top of the screen with the above Title

Widgets in Flutter

The core concept of the Flutter framework is, In Flutter Everything is a widget. Widgets are basically user interface components used to create the user interface of the application. In Flutter, the application is itself a widget. The application is the top-level widget and its UI is build using one or more children (widgets), which again build using its children (widgets). For example, the widget hierarchy of the basic flutter application is as specified in the following diagram:-

flutter widgets hierarchy

Text Widget in Flutter

The text widget is used to display a piece of string in Flutter application.

import "package:flutter/material.dart";

void main() => runApp(MaterialApp(debugShowCheckedModeBanner: false, home: MyApp(),));

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: Text("Review2Tech Application"),
        ),
        body: Container(
          child: Center(
            child: Text("This is the Text widget"), //Text Widget -> Child of Container Widget
          ),
        ),
      );
  }
}

The style of the string can be set by using style property and TextStyle class. The sample code for this purpose is as follows:-

Text("Text Widget", textDirection: TextDirection.ltr, style: TextStyle(fontSize: 18.0, color: Colors.white),),

The loaded output is as shown below:-

flutter text widget

Complete Flutter Series List: Click here 

Categories: Blog Tags: flutter, review2tech flutter series, flutter-tutorial, text widget, text in flutter, basic flutter widgets, flutter android, flutter ios


2 Comments

  • Comment

    nike air vapormax

    2020-08-09 00:30:06

    That is the right blog for anybody who desires to search out out about this topic. You notice so much its almost onerous to argue with you (not that I truly would want匟aHa). You definitely put a new spin on a subject thats been written about for years. Nice stuff, just nice!

    Reply

  • Comment

    huarache shoes

    2020-08-15 21:36:26

    I must show my gratitude for your generosity in support of people that must have help on that topic. Your special commitment to passing the message across turned out to be astonishingly insightful and has consistently encouraged girls much like me to realize their ambitions. This valuable advice signifies a whole lot a person like me and still more to my office workers. With thanks; from everyone of us.

    Reply

Leave a comment