Space between Flutter text and underline implementation. In this post, I will be introducing a very easy method to set a space between Flutter text and underline. I will be implementing the space between Flutter text and underline using a very simple example so you can also easily implement it in your own Flutter code. So let’s jump right into implementing space between Flutter text and underline.
Outline
- What is Space Between Flutter Text And Underline?
- Default Space Between Flutter Text And Underline
- Default Space Between Text And Thick Underline
- Implementing Space Between Flutter Text And Underline(All Steps)
- Space Between Flutter Text And Underline Implementation Source Code
- Conclusion
What is Space Between Flutter Text And Underline?
Space between Flutter text and underline as the name suggests, it is the distance between the Flutter text and underline. When we define a Flutter text widget and give it an underline then there is not much of a distance/space between the text and underline and if we make the underline a little thick(heighted) then the Flutter text and underline will be attached and will look very bad.
Let’s understand it using a proper Flutter code implementation. First we will see what the default space between Flutter text and underline looks like, then we change it using a simple method.
Default Space Between Flutter Text And Underline
To see the default space between Flutter text and underline, we have to define a Flutter text widget with some text and an underline. If you want to know how to properly implement Flutter text underline then underline. See the below code:
Text('Default space between text and underline', style: TextStyle(decoration: TextDecoration.underline))

Default Space Between Text And Thick Underline
Let’s now make the underline a bit thick and then see what the default space between Flutter text and underline will look. To make the Flutter text underline thick, we have to use the decoration thickness constructor of the text style class. This constructor takes a double(decimal) value but integer will also work(it will convert it automatically). For demonstration, we have passed it a value of 3. See the below code:
Text( 'Space between text and thick underline', style: TextStyle( decoration: TextDecoration.underline, decorationThickness: 3))

Implementing Space Between Flutter Text And Underline(All Steps)
In order to implement it, we will use a simple trick. See the below steps:
Step 1: Give Shadow To The Text
shadows: [Shadow(color: Colors.black45, offset: Offset(0, -10))]

Step 2: Give Custom Colors To The Underline
decorationColor: Colors.grey

Step 3: Make The Flutter Text Color Transparent
color: Colors.transparent

Now the final step is to make the color of the Flutter text transparent. For that we have to use the color constructor of the text style class and pass it Colors.transparent. In the image above you can see that the text color is transparent and cannot be seen. We also have made the shadow color complete from Colors.black45 to Colors.black. You can leave the thickness of the underline or you can change it depends on the requirements of your Flutter app project.
You can see that we have successfully implemented a space between Flutter text and underline. The text is actually a shadow in the above image but still it works. Hope you now have a complete understanding of how to implement space between Flutter text and underline. Don’t hesitate to ask in the comment section if you still have any doubts related to the implementation of space between Flutter text and underline. I would love to answer all.
The complete source code for the above implemented space between Flutter text and underline is given in the below section.
Space Between Flutter Text And Underline Implementation Source Code
import 'package:flutter/material.dart'; void main() { runApp(const MyApp()); } class MyApp extends StatelessWidget { const MyApp({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return MaterialApp( debugShowCheckedModeBanner: false, home: Homepage(), ); } } class Homepage extends StatelessWidget { @override Widget build(BuildContext context) { return SafeArea( child: Scaffold( body: Center( child: Padding( padding: const EdgeInsets.all(15), child: Text('Custom space between text and thick underline', style: TextStyle( color: Colors.transparent, decorationColor: Colors.grey, shadows: [Shadow(color: Colors.black, offset: Offset(0, -10))], decoration: TextDecoration.underline, decorationThickness: 3)), )))); } }
Conclusion
To conclude this post, now you have a complete implementation knowledge of how to use and implement space between Flutter text and underline. Don’t hesitate to share your valuable thoughts about this post. I would highly recommend that you visit my other posts on Flutter widgets, Flutter app development, beautiful Flutter templates with free source code, Flutter books, Flutter custom animations, Flutter web and many more. Links to some of the above mentioned informative topics can be found below while others can be found by the use of search box of this site or the menu navigation bar. Thanks for reading this article.
Flutter app articles you might like to read: beautiful gradient login UI, Dart Vs JavaScript, flutter login UI form, flutter basics for beginners, explanation of widgets in flutter, flutter architecture, flutter vs native, flutter sliverappbar customization, mobile app marketing tips, flutter bottom navigation bar, flutter appbar actions, flutter appbar title center, why learn react native framework, react native jobs, react native elements, unique flutter development, Acer Chromebook Spin 511 Laptop.
You might also like:
How To Easily Change Flutter Text Underline Color
How To Easily Align Flutter Text Justify
How To Easily Set Flutter Text Letter Spacing
Acer Nitro 5 AN515 57 79TD Gaming Laptop Amazing Specs-Best Gaming Laptop
How To Easily Set Flutter Text Underline
How To Easily Add Flutter Text Shadow
How To Easily Set Flutter Text Word Spacing
How To Change Flutter Text Line Height-Easy Flutter Code Example
Samsung 13.3 Galaxy Book 2 Pro Laptop Amazing Hidden Specs
Amazing Specs Of Galaxy Chromebook Mercury Gray Laptop
How To Set Flutter Text Italic-Easy Flutter Code Example
How To Easily Change Flutter Text Size
Acer Chromebook Spin 511 Laptop Hidden Specs
How To Make Flutter Text Bold-Example Code
How To Easily Change Flutter Text Font Size
Acer Aspire C27 1655 UA91 AIl In One Desktop PC Amazing Specs
How To Easily Set Flutter Text Align Center
How To Easily Change Flutter FlatButton Color
Acer Swift 3 Intel Evo Laptop Amazing Specs
How To Change Flutter Icon Button Size