Globant
Published in

Globant

Flutter: Text Widgets

  • Flutter Text widget allows you to display text in your Flutter application.
  • In Flutter Application we can use Text Widgets to display title text of our application and a message in the body of an application.
  • Let’s see Text Widget with example :
class TextWidget extends StatelessWidget{
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Flutter Text Demo'),
),
body: Center(
child: Text('Hi , Welcome to Flutter Text Demo'),
),
);

}
}
  • So in TextWidget class which extends StatelessWidget I have used title for appbar which contains Text Widget title: Text(‘Flutter Text Demo’).
  • To display message I have use child: Text(‘Hi , Welcome to Flutter Text Demo’) in body.
Output
  • Above output shows text in center.
  • You can also use textAlign: TextAlign.center in Text Widget.
  • You can also use overflow: TextOverflow.ellipsis the text-overflow property specifies how overflowed content that is not displayed should be signaled to the user. It can be clipped, display an ellipsis (…), or display a custom string.
  • And you can provide style to Text with style: TextStyle(fontWeight: FontWeight.bold).This will make our Text in bold.

This is a small description of Text widgets.

In my next blog I will explain RaisedButton and FlatButton Widgets.

Happy Reading :)

--

--

--

Our thoughts as a strategic disruptor in business and cognitive transformation. Visit us at www.globant.com

Recommended from Medium

Why do we use elliptic curves for cryptography?

The “Coding” Begins

Amara Latest Progress from March to April

Error Connecting to Substrate

Real time monitoring using Prometheus & Grafana

Programming Timelapse: Growing Flowers

Nate Bot Rewrite — Release

Data Structures and Algorithms Revisited: Part 7

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Richa Sharma

Richa Sharma

Android developer

More from Medium

Design Custom Map Markers from widgets (Flutter)

Implement Reading Progress Bar using Flutter

Dark Theme Using GetX and Get_Storage

Package of the week: Badges. Full example with Badges + Riverpod + App Badger + shared_preferences