flutter 网络图片加载不出(exception Invalid Image data

flutter作业x2

一点没学,但要写作业,记录报错

错误代码:



    final List<BottomNavigationBarItem> item = [
      BottomNavigationBarItem(
        icon: Icon(Icons.camera),
        label: 'Camera',
        backgroundColor: Colors.white70,
      ),
      BottomNavigationBarItem(
        icon: Icon(Icons.alarm),
        label: 'Alarm',
        backgroundColor: Colors.white70,
      ),
      BottomNavigationBarItem(
        icon: Icon(Icons.wifi),
        label: 'WIFI',
        backgroundColor: Colors.white70,
      ),
      BottomNavigationBarItem(
        icon: Icon(Icons.sms),
        label: 'SMS',
        backgroundColor: Colors.white70,
      ),
    ];

    return MaterialApp(

       home: Scaffold(
          appBar: AppBar(
            title: Text("Flutter Basic Widgets"),
                backgroundColor: Colors.orange,
                actions: <Widget>[
                  Icon(Icons.search),
                  IconButton(
                       tooltip: 'like',
                       icon: Icon(Icons.star),
                       onPressed: (){}),

                ],
          ),
         floatingActionButton: FloatingActionButton(
           onPressed: () {  },
           backgroundColor: Colors.deepOrange,
         ),
         bottomNavigationBar: BottomNavigationBar(
           items: item,
           type: BottomNavigationBarType.shifting,
           unselectedItemColor: Colors.black54,
           fixedColor: Colors.purple,
           showUnselectedLabels: true,
         ),
         body: Container(
           margin: const EdgeInsets.all(30.0),
           child: new Row(
             children: [
               new Image.network(
                 "https://cn.bing.com/images/search?view=detailV2&ccid=FezNllMB&id=27C24F0C45EDD81C4C1CB068B5D748EB90D6CA4F&thid=OIP.FezNllMBkUcWofhpHkKnPgHaNK&mediaurl=https%3A%2F%2Fimg.18183.cn%2Fuploads%2Fallimg%2F210326%2F112-2103261F411.jpg&exph=1920&expw=1080&q=%e5%8e%9f%e7%a5%9e&simid=608036325871869065&form=IRPRST&ck=10DDEAE782D4120715DCF5FAEA850DC8&selectedindex=2&ajaxhist=0&ajaxserp=0&vt=0&sim=11",
               width: 100,
               height: 200,
               ),
               new Text("I am Flutter Image"),
           ],),

         ),
       ),
    );
  }
  }

 

修改:

new Image.network(
                 "https://img.18183.cn/uploads/allimg/210326/112-2103261F411.jpg",
               width: 100,
               height: 200,
               ),

因为给的图片地址复制错了,右键复制图片连接

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值