Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Yellow lines under Text Widgets in Flutter?

Tags:

flutter

Working on my first flutter app. The main app screen doesn't have this issue, all the texts show up as they should.

However in this new screen I'm developing, all the text widget have some weird yellow line / double-line underneath.

Any ideas on why this is happening?

Yellow Lines

like image 499
dasfima Avatar asked Nov 04 '17 19:11

dasfima


People also ask

How do you get rid of the yellow lines under text widgets in Flutter?

By setting the decoration argument of TextStyle to TextDecoration. none, you can remove the yellow lines as well.

Why is there a yellow line under text Flutter?

Why Flutter displays Yellow lines? The problem is not having a Scaffold Widget. A Scaffold is a helper for Material apps like AppBar, Drawer.

What is softWrap in text Flutter?

softWrap. Whether the text should break at soft line breaks. If false, the glyphs in the text will be positioned as if there was unlimited horizontal space.


1 Answers

The problem is having a Scaffold or not. Scaffold is a helper for Material apps (AppBar, Drawer, that sort of stuff). But you're not forced to use Material.

What you're missing is an instance of DefaultTextStyle as a parent:

DefaultTextStyle(   style: TextStyle(...),   child: Text('Hello world'), ) 

Various widgets add one to change the default text theme, such as Scaffold, Dialog, AppBar, ListTile, ...

It's DefaultTextStyle that allows your app-bar title to be bold by default for example.

like image 56
Rémi Rousselet Avatar answered Oct 14 '22 04:10

Rémi Rousselet