Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set Flutter Text line space?

Tags:

flutter

I had developing app using Android, now I use Flutter, but I want to find the property of Text that is same to android:includeFontPadding and android:lineSpacingExtra?

like image 713
andrew Avatar asked Mar 18 '19 06:03

andrew


People also ask

How do you add a space between words in Flutter?

The Spacer widget in Flutter, allows you to add an empty space that you can adjust to match your design. By default, it takes all the available space and shifts the adjacent widget to the far side. Using the flex property of the Spacer widget, you can control the space between widgets.

How do you add padding to text flutters?

But in Flutter, if you want add some extra space around a widget, then you wrap it in a Padding widget. Now to add padding, wrap the Text widget with a Padding widget. In Android Studio this can be accomplished by placing your cursor on the widget and pressing Option+Enter (or Alt+Enter in Windows/Linux).

How do you change text margins in Flutter?

In this example, you will learn different ways to add padding and margin on the Text widget in Flutter. We will use, Padding() and Container() widget to wrap Text() widget and apply padding and margin. Furthermore, you will learn about EdgeInsets method.

How do you add space between text and underline in Flutter?

You can control the gap between text and its underlining by adding a drop shadow and making the original text transparent. The Y offset of the shadow will determine the gap. Setting it to a negative number helps you to increase the space.


2 Answers

It looks like you looking for the height property of the TextStyle class. Here is an example:

Text(   "Some lines of text",   style: TextStyle(     fontSize: 14.0,     height: 1.5 //You can set your custom height here   ) ) 
like image 132
thedarthcoder Avatar answered Sep 28 '22 23:09

thedarthcoder


There are 2 properties you can set

Text("Hello World", style: TextStyle(   height: 1.2 // the height between text, default is null   letterSpacing: 1.0 // the white space between letter, default is 0.0 )); 
like image 45
Terry Avatar answered Sep 29 '22 00:09

Terry