首页 > 解决方案 > iconfont:如何让iconfont在flutter中工作

问题描述

我在flutter中使用iconfont,但是不能正常使用,</h1>

它看起来像这样的“X

我在 pubsepc.yaml 中定义:</p>

flutter:
  uses-material-design: true
  fonts:
    - family: iconfont
      fonts:
        - asset: assets/fonts/iconfont.ttf

这就是我使用它的方式:

MaterialApp(
     home: Scaffold(
       appBar: AppBar(title: Text('data'),),
       body: Center(
         child: Container(child: Icon(IconData(0xe60d,fontFamily: 'iconfont'),color: Colors.amber,size: 50.0,),)
       ),
     ),
   ),

“0xe60d”已在 iconfont.ttf 中定义,我尝试将其替换为另一个定义的图标,但这也没用

谁能帮我?真诚的感谢

标签: flutterfonts

解决方案


使用此工具生成您的图标字体:http: //fluttericon.com/


推荐阅读