Yellow lines under Text Widgets in Flutter?

前端 未结 11 1668
没有蜡笔的小新
没有蜡笔的小新 2020-12-04 20:52

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

相关标签:
11条回答
  • 2020-12-04 21:16

    There is an other solution for this , especially if you are using multiple pages wrapped under main.dart file You can do something like this:

      child: MaterialApp(
        home: Material(child: Wrapper()),
      ),
    

    This will remove the yellow lines under text that is present in any pages referenced/used under wrapper.

    0 讨论(0)
  • 2020-12-04 21:17

    Also you can use decoration: TextDecoration.none to remove underline

    0 讨论(0)
  • 2020-12-04 21:20

    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 Theme as a parent.

    Why is that important to know? Because when you'll develop a Modal (using showDialog for example), you'll face the same problem. BUT Scaffold is an opaque fullscreen widget! And you obviously don't want that in your Modal.

    There are many ways to introduce a Theme instance. In Material App, this is usually achieved by instantiating a Material Widget. And guess what? Scaffold creates one for you. But Dialog too!

    0 讨论(0)
  • 2020-12-04 21:22

    2 ways is avalible:

    use scaffuld in parent of screen

    Scaffold(body: Container(child:Text("My Text")))
    

    use material for parent of widget

    Material(child: Text("My Text"))
    
    0 讨论(0)
  • 2020-12-04 21:25

    You should add Material and Scaffold widgets in main.dart file

     MaterialApp(
      home: Scaffold(
        body: Text('Hello world'),
      ),
    );
    
    0 讨论(0)
提交回复
热议问题