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
?
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.
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).
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.
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.
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 ) )
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 ));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With