StackLearn

Welcome to the blog of Sarvesh Bhatnagar

Most used widget in flutter, Text Widget

Flutter: Text Widget In Depth

Have you ever thought what is the thing we use the most in flutter? Its Text Widget which allows us to render text on application. July 27, 2020

We use Text Widget in flutter to render text to our application. Text widget is very commonly used as an independent widget or as a sub widget in some other widget. E.g. as a child to a RaisedButton.

Here is a small code which uses almost all the properties you might use when developing flutter application for Text Widget and also shows how you can use Text.rich() for multiple formatting of the text.



We use Text Widget to render text in flutter with all the text styled in a single style. If you want multiple styling then for that we use Text.rich() which contains a TextSpan widget and a children property where we can add more TextSpan widgets.

Some Common Property when we use Text Widget are:

  • style : takes in a TextStyle widget (see also google_fonts )
    • fontSize : used to size our text
    • fontWeight : gives thickness to our text
    • color : used to specify color of the text
  • textAlign : used to align our text with respect to its parent.

Screenshots :

Hello World application in flutter

- Sarvesh Bhatnagar

About Me

I am Sarvesh Bhatnagar, I love to code and I enjoy teaching. This website is an effort to help people learn basics of programming. I am starting with teaching App Development using flutter. If you want to contribute to this website and become an author in this website, mail to: contact@sarveshbhatnagar.com