问题:Flutter 图标没有出现在我的应用程序上? (仅在我的电脑上)

Problem: Flutter icons do not appear on my application? (only on my PC)

我想知道为什么我的应用程序在编译时没有出现图标?

我浏览了 ,但没有在那里找到我的答案。 但是那里的解决方案对我没有帮助。

注意:代码在我同事的电脑上编译并运行良好,但在我下面。

我的代码如下所示:

    Positioned(
    top: _top,
    left: 30,
    right: 30,
    child:
      Row(mainAxisAlignment: MainAxisAlignment.center, children: <
          Widget>[
    Container(
        width: _btn1w,
        height: _btn1h,
        child: Column(
          children: <Widget>[
            RawMaterialButton(
              onPressed: () async {
                
              },
              child: new Icon(
                Icons.person_add,
                color: Colors.blue,
                size: 85.0,
              ),
              shape: new CircleBorder(),
              elevation: 2.0,
              fillColor: Colors.grey[200],
              padding: const EdgeInsets.all(15.0),
            ),
            Container(
              margin: EdgeInsets.only(top: 10),
              child: Text(
                'Register',
                style: TextStyle(
                  fontSize: 17,
                  color: Colors.blueAccent,
                  fontWeight: FontWeight.bold,
                ),
              ),
            ),
          ],
        )),
    Container(
      width: _btn2w,
      height: _btn2h,
      margin: EdgeInsets.only(left: _margin),
      child: Column(
        children: <Widget>[
          RawMaterialButton(
            onPressed: () async {
              //
              _margin = 0;
              
            },
            child: new Icon(
              Icons.vpn_key,
              color: Colors.blue,
              size: 85.0,
            ),
            shape: new CircleBorder(),
            elevation: 2.0,
            fillColor: Colors.grey[200],
            padding: const EdgeInsets.all(15.0),
          ),
          Container(
            margin: EdgeInsets.only(top: 10),
            child: Text(
              'Login',
              style: TextStyle(
                fontSize: 17,
                color: Colors.blueAccent,
                fontWeight: FontWeight.bold,
              ),
            ),
          ),
        ],
      ),
    ),),

您提到 colleague 您可以检查 pubspec.yaml 中添加的资产并检查 pubspec.yaml 中包含的所有文件是否存在于您的 PC 上。可能 he/she 忘记将它们添加到版本控制器。

例如:

  assets:
    - assets/img/logo.png

已添加,但您在 img 文件夹中找不到 logo.png。 在这种情况下 Flutter 编译您的项目,但 icons 将会丢失。

我们也有同样的问题。