-
Notifications
You must be signed in to change notification settings - Fork 3
Home
PriyoMukul edited this page Jun 18, 2019
·
2 revisions
- Lets discuss how to use IcoFont as flutter package.
First of all we should add our package name with version ( icofont_flutter: ^1.0.0
) in pubspec.yaml file. And run flutter packages get
to load it in our project.
import 'package:icofont_flutter/icofont_flutter.dart';
After importing the package you have access to IcoFontIcons class which provides IcoFont icons as IconData, similar to Flutters built in Icons class.
class MyApp extends StatelessWidget {
Widget build(BuildContext context) {
return new IconButton(
// Use the IcoFontIcons class for the IconData
icon: new Icon(IcoFontIcons.brandIcofont),
onPressed: () { print('Hey, there'); }
);
}
}
Copyright @priyomukul