1.下載阿里圖標
2.解壓
將解壓文件放入到 lib/style/font/ 文件下(路徑可自定義):
只有 iconfont.ttf 有用,別的都可刪除,建議留着,方便查看圖標
3. 配置pubspec.yaml文件
fonts: - family: iconfont # 引入圖標的別名,自定義 fonts: - asset: lib/style/font/iconfont.ttf
4. 頁面內使用
方法一:text使用
Text("\ue8d1", style: TextStyle(fontFamily: 'iconfont', color: Colors.white)),
此處fontFamily值為pubspec.yaml文件下的fonts/family 值
方法二:icon使用
Icon(IconData(0xe8b9, fontFamily: 'iconfont'), color: Colors.grey)
參考鏈接:https://blog.csdn.net/qq_41614928/article/details/106794675