I'm trying to add custom icon (Font Awesome Light). I already tried the package who did it but only for free icons.
I followed this tutorial : https://medium.com/flutterpub/how-to-use-custom-icons-in-flutter-834a079d977
The icon is here but are not centered in my BottomNavigationBar, screen bellow.
It works with default icon, I don't know what to try now. I will be thankfull for any help or ideas.
main.dart
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: _widgetOptions.elementAt(_selectedIndex),
),
bottomNavigationBar: BottomNavigationBar(
items: const <BottomNavigationBarItem>[
...
BottomNavigationBarItem(
icon: Icon(WuliIcons.dumbbell),
title: Text('School'),
backgroundColor: Colors.red
),
BottomNavigationBarItem(
icon: Icon(Icons.school),
title: Text('School'),
backgroundColor: Colors.red
),
],
currentIndex: _selectedIndex,
onTap: _onItemTapped,
),
);
}
where i define my icon class :
import 'package:flutter/widgets.dart';
class WuliIcons {
WuliIcons._();
static const _kFontFam = 'FontAwesomeLight';
static const IconData dumbbell = const IconData(0xf44b, fontFamily: _kFontFam);
}
pubspec.yml
flutter:
fonts:
- family: FontAwesomeLight
fonts:
- asset: fonts/fa-light-300.ttf