Reputation: 1553
I'm currently working on a side project and when I have included a font-awesome icon inside my app, it does not show up and instead, a blank box with two lines intersecting with each other like the letter x, how to fix this?
class ImageHoldingComponent extends StatefulWidget {
@override
_ImageHoldingComponentState createState() =>
_ImageHoldingComponentState();
}
class _ImageHoldingComponentState extends State<ImageHoldingComponent> {
@override
Widget build(BuildContext context) {
return Container(
child: Icon(FontAwesomeIcons.python)
);
}
}
Upvotes: 12
Views: 25565
Reputation: 53
Add font_awesome_flutter: ^10.3.0 package in pubspec.yaml file. Then use like this
FaIcon(
Icons.access_alarm,
color: whatsappColor,
size: 30,
),
Upvotes: 0
Reputation: 5
Just save the from pupspec.yaml file under dependices and say pub get, don't forget to import it
Upvotes: 0
Reputation: 768
If your app is running on the emulator or device just stop it and relaunch it again it solves your problem
Upvotes: 3
Reputation: 805
This happens when you start using the older version of font_awesome_flutter and because the virtual device cache is stored when you build the Flutter app, so every time you change the icon you have to stop the emulator and rebuild it.
My experience is:
Stop main.dart
(Android Emulator)
In pubspec.yaml
add (font_awesome_flutter) new version
font_awesome_flutter: ^8.8.1
dependencies:
flutter:
sdk: flutter
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.2
font_awesome_flutter: ^8.8.1 //new verison
And Then click
"Pub get"
at the top of Flutter commands
Upvotes: 6
Reputation: 7889
The author of font_awesome_flutter
package suggests the following steps for anyone who has icons not showing problem:
Also make sure to set uses-material-design
to true
in pubspec.yaml file.
Upvotes: 43