LunaGao / flag_flutter

flag icons
https://pub.dev/packages/flag
BSD 2-Clause "Simplified" License
63 stars 60 forks source link

Bug fix for using CanvasKit on web pages. #51

Closed dg76 closed 3 years ago

dg76 commented 3 years ago

The flags are not displayed if Flutter uses "CanvasKit" in web mode. There are two renderers that can be used in web mode:

https://flutter.dev/docs/development/tools/web-renderers

Image.network works only in "html" mode to display an SVG file. In "CanvasKit" mode SVG files have to be displayed in the same way as on Android and iOS.

To check if "CanvasKit" is used the solution that is described here was used:

https://stackoverflow.com/questions/63207658/how-to-detect-flutter-web-canvaskit-or-html-renderer

With these changes the flags are now correctly displayed in "CanvasKit" web mode.

Thank you very much for creating this project! I hope my contribution will be useful! :-)