3

Screenshot of the code and it's result:

enter image description here

Hi, I have StatelessWidget which has Container returning in its build method and the Text widget as a child widget. But it's look and feel is not as expected. Why is the yellow underline and how can I remove it?

I tried replacing the Container with Stack, Column and Row nothing change.

Blasanka
  • 21,001
  • 12
  • 102
  • 104

2 Answers2

10

Because of you havent wrap your Text widget with a material widget. You can wrap with a Scaffold or with Material widget with color property as you want.

Example:

Scaffold(body: Center(child: Text("Here is the text")))

or:

Material(color: Colors.white, child: Center(child: Text("Here is the text")))
Blasanka
  • 21,001
  • 12
  • 102
  • 104
  • The application root widget is set to scaffold in material app, one area of the ui shows yellow lines. Should they be wrapped, directly - even though the application root is scaffold? – lolelo Jun 28 '21 at 12:16
0

Every screen should have a scaffold widget

 @override
  Widget build(BuildContext context) {
    return Scaffold(
             body:Container(
                  child:Text("your text"),
           ),
        );
Krishna
  • 239
  • 2
  • 11