bigbadbob2003 / flutter_tabler_icons

The Tabler Icons (https://github.com/tabler/tabler-icons) pack available as a set of Flutter Icons.
MIT License
20 stars 9 forks source link

Unable to import font in pubspec.yaml #6

Open wyrmmm opened 1 year ago

wyrmmm commented 1 year ago

When I'm writing golden tests, I need to import the tabler-icons.ttf font into my tests through the following code:

const _tablerIconsPath = [
  'packages/flutter_tabler_icons/assets/fonts/tabler-icons.ttf'
];

// I will call _loadFonts() in my tests
Future<void> _loadFonts() async {
  final tablerIconsFontLoader =
      FontLoader('packages/flutter_tabler_icons/TablerIcons');
  for (final path in _tablerIconsPath) {
    tablerIconsFontLoader.addFont(rootBundle.load(path));
  }
  await tablerIconsFontLoader.load();
}

If I don't do this, the Tabler icons are not loaded into the screen and they show up as squares in my golden tests.

However, I'm unable to access the assets/fonts/tabler-icons.ttf because it's not within a lib folder. The Flutter docs state that the files need to be within the lib folder.

Is it possible to shift the tabler-icons.ttf into lib/fonts/ so that I can access them in my golden tests?

Thanks!