ilikerobots/polyicon

Custom FlutterIcon font is no longer showing icons, even in release mode.

Opened this issue · 4 comments

This is a problem that showed up for me a couple of weeks ago, and I'm having trouble tracking it down. The codebase in question is a design system, so the custom icons are in a package that someone adds to their application.

Recently, the icons all stopped working, and showing up in release mode. Even when they are bundled and built for web (see here: https://withaureus.org/#/), the icon placeholders still show.

I have touched nothing that imports / exports anything related to the icons. I'm not sure if this is related to the FlutterIcons themselves, or if this is something to do with Flutter.

Here's the asset file in the package: https://github.com/Astra-Labs/Aureus/blob/main/Package/lib/src/Objects/Components/Icons.dart

Implementation of using icons: https://github.com/Astra-Labs/Aureus/blob/main/Example%20App/lib/src/Supporting/FillerData.dart

Did a test with Material's icon library just to make sure it wasn't a fluke accident, but sure enough custom icons aren't rendering and Material ones are. I'll go through the process of deleting and re-adding my custom icons again, but I don't think that will solve the issue.

The icons were previously working, and I didn't move them in the file structure.

Screen Shot 2023-02-24 at 9 22 35 PM

Screen Shot 2023-02-24 at 9 22 46 PM

Thanks for the report. I'm sorry though, that there's likely not much chance I'm going to be able to look into this for about 2 weeks as I'm travelling. But I didn't want to say there hasn't been any releases that would affect this on the FlutterIcon side, so it is likely due to changes in Flutter or some other dep. If anyone can share some additional info, it would be appreciated.

No worries! That's what I was imagining, and I'm planning on making a bug report in the Flutter repo. Some other details that may be helpful:

  • The font is showing up in the FontManifest.json of the web build folder, so it is 'loading' properly (apparently not being in this .json file is a common reason for custom icons in web to not load)
  • The icons ARE showing up on release modes on iOS devices. so, they do load in some cases, and this problem is just linked to flutter web.

I had to follow this guide for it to work. Pretty much adding my font under fonts: instead of assets:

https://docs.flutter.dev/cookbook/design/fonts

flutter:
  fonts:
    - family: Raleway
      fonts:
        - asset: fonts/Raleway-Regular.ttf
        - asset: fonts/Raleway-Italic.ttf
          style: italic
    - family: RobotoMono
      fonts:
        - asset: fonts/RobotoMono-Regular.ttf
        - asset: fonts/RobotoMono-Bold.ttf
          weight: 700