dnfield / flutter_svg

SVG parsing, rendering, and widget library for Flutter
MIT License
1.64k stars 449 forks source link

Color not applied when using Color Filter and running on the web #1054

Open rocboronat opened 2 months ago

rocboronat commented 2 months ago

Sometimes, when targetting the web, when using a color filter to fill a white SVG, that color is not applied.

As I was not sure to what was it related, I made a clean project that only included this widget, and the issue persisted. The project is web-only right now, and I feel it won't happen on Android and iOS devices natively. As we only reproduced it on phone web browsers, I guess it's related to the Flutter renderer, which is html on phones by default.

Expected:

Screenshot 2024-04-04 at 11 24 42

Actual:

Screenshot 2024-04-04 at 11 25 08

This is the repo: https://github.com/rocboronat/svg-color-issue-example-flutter

This is the widget that triggers the issue (the only important class in the whole project btw): https://github.com/rocboronat/svg-color-issue-example-flutter/blob/master/lib/composed_icon.dart

And this is the deployed version of the project, so you can check it by yourself: https://svg-color-issue-example-flutter.codemagic.app/

We reproduced it only on iOS, by the way.

Doctor summary (to see all details, run flutter doctor -v):
[!] Flutter (Channel stable, 3.16.9, on macOS 13.3.1 22E772610a darwin-arm64, locale en-ES)
    ! Warning: `dart` on your path resolves to /opt/homebrew/Cellar/dart/2.18.7/libexec/bin/dart, which is not inside your current Flutter SDK checkout at /Users/roc/fvm/versions/3.16.9. Consider adding /Users/roc/fvm/versions/3.16.9/bin to the front of your path.
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
[✓] Xcode - develop for iOS and macOS (Xcode 14.3)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.3)
[✓] Android Studio (version 2022.3)
[✓] IntelliJ IDEA Community Edition (version 2022.2.3)
[✓] VS Code (version 1.85.2)
[✓] Connected device (2 available)
[✓] Network resources

Do you think it can be a Flutter issue? I can open the ticket there if you want me to.

Thanks a lot for the package!!! 🙇

mniiinm commented 2 months ago

https://github.com/dnfield/flutter_svg/issues/576