How to fix Material Icons for Flutter Web (Hummingbird)
Target Audience: Beginner
Recipe: Material Icons for Flutter Web (Hummingbird).
Focus Widget: Material Icons
Goal: Fix MaterialIcon rendering for Flutter WebApps.
[Before] Default Material Icons rendering in Flutter WebApp:
[After] Fixed Material Icons rendering for Flutter WebApp:
Checkout the companion video tutorial
Lets's go!
pubspec.yaml
Step #1. Add material icon dependency in pubspec.yaml
:
flutter: uses-material-design: true
Step #2. Download Material Icons font
Download MaterialIcons fonts from here. Copy MaterialIcons-Regular.ttf
file under web/assets/fonts
directory.
FontManifest.json
Step #3. Add FontManifest.json
in web/assets
directory.
[
{
"fonts": [
{
"asset": "fonts/MaterialIcons-Regular.ttf"
}
],
"family": "MaterialIcons"
}
]
Note: I've removed debug banner to be able to show Settings vertical dots. All you need to do is to set debugShowCheckedModeBanner
flag to false in MaterialApp
like below:
return new MaterialApp(
debugShowCheckedModeBanner: false,
...
);
Source code repo: Source code is here
References:
Happy cooking with Flutter
Liked the article ? Couldn't find a topic of your interest ? Please leave comments or email me about topics you would like me to write
Follow me at twitter