繁体   English   中英

Flutter中文本的黄色下划线的路由原因是什么

[英]what is the route cause of Yellow underline for the Text in Flutter

我是Flutter的新手。 我正在准备登录页面。 同样,我正在使用“文本”小部件。 为此,我得到黄色双下划线。

我正在尝试使用脚手架作为路线布局进行修复

return new Scaffold(
  body: Container(
    decoration: BoxDecoration(
      image: DecorationImage(
        image: AssetImage("assets/images/bg.png"),
        fit: BoxFit.cover,
      ),
    ),
    child: MaterialApp(
      home: SingleChildScrollView(
        child:Text('Test')
      ),
    ),
  ),
);

这是我的截图

只需更改Scaffold的父级, MaterialApp应该是所有小部件树的父级。

  return MaterialApp(
      home: Scaffold(
        body: Container(
          decoration: BoxDecoration(
            image: DecorationImage(
              image: AssetImage("assets/images/bg.png"),
              fit: BoxFit.cover,
            ),
          ),
          child: SingleChildScrollView(child: Text('Test')),
        ),
      ),
    );
    Remove all other only use text   

 return new Scaffold(
          body: Container(
            decoration: BoxDecoration(
              image: DecorationImage(
                image: AssetImage("assets/images/bg.png"),
                fit: BoxFit.cover,
              ),
            ),
            child: new Text(
                     "your text",
                      maxLines: 3,
                      style: TextStyle(
                        fontWeight: FontWeight.bold,
                        fontSize: 18,
                      ),
                    ),;
          ),
        );

暂无
暂无

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

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