简体   繁体   English

为什么文字有黄色下划线,字体大?

[英]Why text has underline with yellow color with big font size?

Screenshot of the code and it's result:代码截图和结果:

在此处输入图片说明

Hi, I have StatelessWidget which has Container returning in its build method and the Text widget as a child widget.嗨,我有StatelessWidget ,它在其构建方法中返回Container ,而Text小部件作为子小部件。 But it's look and feel is not as expected.但它的外观和感觉并不像预期的那样。 Why is the yellow underline and how can I remove it?为什么是yellow下划线,如何去除?

I tried replacing the Container with Stack , Column and Row nothing change.我尝试用StackColumnRow替换Container没有任何变化。

Because of you havent wrap your Text widget with a material widget.因为你还没有用材质小部件包装你的Text小部件。 You can wrap with a Scaffold or with Material widget with color property as you want.您可以根据需要使用Scaffold或具有颜色属性的Material小部件进行包装。

Example:例子:

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

or:或者:

Material(color: Colors.white, child: Center(child: Text("Here is the text")))

Every screen should have a scaffold widget每个屏幕都应该有一个脚手架小部件

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM