首先需要在pubspec.yaml的
assets 下要注册这些图片
https://www.jianshu.com/p/07d26525a0b5
https://blog.csdn.net/yuzhiqiang_1993/article/details/85258876
https://flutterchina.club/assets-and-images/
import 'package:flutter/material.dart';// import 'package:english_words/english_words.dart';void main() => runApp(new MyApp());class MyApp extends StatelessWidget {@overrideWidget build(BuildContext context) {return new MaterialApp(title: 'Welcome to Flutter',home: new Scaffold(appBar: new AppBar(title: new Text('Welcome to Flutter12'),),body: Column(children: <Widget>[Image.asset('static/pic/mg3414.jpg',width: 200,height: 300,),Image.asset('static/pic/162.jpg',width: 200,),Image.network('http://8.129.221.250:3000/uploads/fc3eace4355f22498f5d1008a942da30-NrJn4jqrY5Dd492d82806fe4d6b2a5707d806722350c.png')],),),);}}
图标
https://www.jianshu.com/p/af2df7325e4e
https://blog.csdn.net/ding139725/article/details/104843005
先在 pubspec.yaml 的 fonts 下注册 从 iconfont (阿里巴巴字体图标库)下载到的ttf格式的文件
然后 fonts 下的 family 字段代表的我们自定义的图标的名称
自定义图标的文件 family 字段 为 MyIcon
然后在页面中通过 import 引入这个文件
使用:
Icon(MyIcon.huawei)Icon(MyIcon.xiaomi)Icon(MyIcon.oppo)

import 'package:flutter/material.dart';// import 'package:english_words/english_words.dart';void main() => runApp(new MyApp());class MyApp extends StatelessWidget {@overrideWidget build(BuildContext context) {return new MaterialApp(title: 'Welcome to Flutter',home: new Scaffold(appBar: new AppBar(title: new Text('Welcome to Flutter12'),),body: Column(children: <Widget>[Image.asset('static/pic/mg3414.jpg',width: 200,height: 300,),Image.asset('static/pic/162.jpg',width: 200,),Image.network('http://8.129.221.250:3000/uploads/fc3eace4355f22498f5d1008a942da30-NrJn4jqrY5Dd492d82806fe4d6b2a5707d806722350c.png'),Icon(Icons.zoom_out_sharp)]),),);}}
