Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter Web not displaying Material Design Icons

I started Flutter web and i wanted to add Material icons to my Flutter web app but its displaying boxes instead.

enter image description here

Any help is appreciated. Thanks

like image 772
JideGuru Avatar asked May 09 '19 21:05

JideGuru


2 Answers

From flutter_web repository:

Note: a reference to MaterialIcons is intentionally omitted because the corresponding font is not included in this source.

If you add MaterialIcons-Extended.ttf to this directory, you can update FontManifest.json as follows:

[
  {
    "family": "MaterialIcons",
    "fonts": [
      {
        "asset": "MaterialIcons-Extended.ttf"
      }
    ]
  },
  {
    "family": "GoogleSans",
    "fonts": [
      {
        "asset": "GoogleSans-Regular.ttf"
      }
    ]
  },
  {
    "family": "GalleryIcons",
    "fonts": [
      {
        "asset": "GalleryIcons.ttf"
      }
    ]
  }
]

Solution/Workaround

Download MaterialIcons-Regular.ttf here, put it inside your assets folder and update your FontManifest.json accordingly.

like image 145
Zerocchi Avatar answered Nov 14 '22 07:11

Zerocchi


According to this you can directly add Material icons to FontManifest.json as shown below.

[
  {
    "family": "MaterialIcons",
    "fonts": [
      {
        "asset": "https://fonts.gstatic.com/s/materialicons/v42/flUhRq6tzZclQEJ-Vdg-IuiaDsNcIhQ8tQ.woff2"
      }
    ]
  }
]
like image 40
Jithin Jude Avatar answered Nov 14 '22 07:11

Jithin Jude