Search code examples
flutterdartflutter-layout

Yellow lines under Text Widgets in Flutter?


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

However, in the new screen, all the text widget have some weird yellow line / double-line underneath.

Any ideas on why this is happening?

Yellow Lines


Solution

  • The problem is not 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.