-
Notifications
You must be signed in to change notification settings - Fork 458
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[iOS] Pixelated svg icons #975
Comments
Hi,
Demo code
Widget _buildContentForDemo(BuildContext context, String assetName, String package) {
const List<double> sizes = [16, 20, 24, 30, 40, 50, 60, 80, 100, 120];
const colorFilter = ColorFilter.mode(Colors.green, BlendMode.srcIn);
return SafeArea(
child: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.all(24),
child: Column(
children: sizes.map((size) {
return Padding(
padding: const EdgeInsets.only(bottom: 24),
child: Row(
children: [
SizedBox(width: 50, child: Text('$size')),
SvgPicture.asset(
assetName,
package: package,
colorFilter: null, // without color
width: size,
height: size,
),
const SizedBox(width: 24),
SvgPicture.asset(
assetName,
package: package,
colorFilter: colorFilter, // with color
width: size,
height: size,
),
],
),
);
}).toList(),
),
),
),
);
} Flutter doctor
Also I think this issue is very similar to #927 Please take a look |
CAn you try this on the beta of Flutter? This is a bug in impeller that I think exists on stable but not beta. |
@dnfield thank you for response I've checked on beta and even on master channel and the problem still exists. doctor on beta
doctor on master
|
@dnfield thank you for response, sorry for the delay. |
Hi, |
Any progress with this one? |
I don't have a good reproduction case for this. I need one htat I can reproduce locally to be able to work on this. |
Hi. |
Having the same issue. When adding icon to a CupertinoButton and it's pressed down, icon renders correctly. When it's released, it goes back to jagged state. |
Are there any updates on this? Im having the same problems and not yet found a solution... |
Facing the same issue with flutter 3.13.9. |
Flutter 3.13.8 with Impeller, all color-filtered SVGs look jagged Using jovial_svg as an alternative for now, it allows coloring by substituting svg file text content |
I've found a temporary fix. Wrapping
|
Not sure about this solution. After some hours of debugging this issue, I noticed that the issue could be in the Wrapping the icon with the |
Same issue here |
Same issue here using 3.16.2 version, with this fix: flutter/flutter#138598. |
It looks like related issue psk907/fluttermoji#35 |
Facing the same issue with flutter 3.16.5. I had tried lots of solution but not worked, please let me know if anyone get solution. I had already post issue in stackoverflow too at below link |
I got the same issue |
This issue occurs on my iOS simulator. I temporarily fixed it by disabling impeller rendering in iOS debug mode. I added the following lines to
For more information, please refer to: https://docs.flutter.dev/perf/impeller#ios |
Any updates on this? |
This was clearly an issue with Flutter itself. Just run the test with |
I can confirm. It is gone. The flutter version I tested with is |
I can confirm, in latest Flutter versions (3.19.x) this issue isn't present. I think also that this issue can be closed.
|
And how fix this issue in 2024? flutter_svg: ^1.1.6 In my case help not use
|
The issue is back in the Flutter version |
I can also confirm that the issue is back in later Flutter versions. |
Fortunately, the patch is still working.
|
Still present with Flutter 3.22.0 |
Still present with Flutter 3.22.1 |
Hey guys, I see that @dnfield has been inactive on GitHub for a while now. So, I don't think he's seen the latest on this issue. Another person I see who collaborates on the package and is very close to the Flutter team is @jonahwilliams, who could possibly give us some guidance on what to do here - or check what might have caused the error to happen again. @Primo85, please reopen the issue so that this can be given some priority. |
Hello, I can also confirm that the issue is present in Flutter 3.22.1 |
I reproduced that issue with flutter_svg 2.0.10+1 and flutter 3.22.2 |
This workaround works for me in debug mode but not in release mode. Does it work for you all in release mode? |
Play with transform, for me 1.02 scale worked fine 👍🏻👍🏻 |
I tried 0.99, 1.01 and 1.02 but all of them still look pixelated. |
Same issue with flutter 3.22.2 Even values for the size (height:24, width: 24) : issue is not visible |
Same issue. I solved it removing colorFilter parameter and specifying the color directly in svg code. |
I encountered an issue where icons appeared pixelated when using the Here's my Flutter details: Flutter 3.22.2 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 761747bfc5 (8 weeks ago) • 2024-06-05 22:15:13 +0200
Engine • revision edd8546116
Tools • Dart 3.4.3 • DevTools 2.34.3 Here’s my codebase: class IconView extends StatelessWidget {
final IconAssetData? asset;
final double? size;
final Color? color;
const IconView({
super.key,
this.asset,
this.color,
this.size = 24,
});
@override
Widget build(BuildContext context) {
if (asset == null) {
return SizedBox(width: size, height: size);
}
final iconColor = color ?? context.theme.colorScheme.onSurface;
if (Platform.isAndroid) {
return _renderSVG(iconColor);
}
return Transform.scale(
filterQuality: FilterQuality.low,
scale: 0.9999,
child: _renderSVG(iconColor),
);
}
Widget _renderSVG(Color iconColor) {
return SvgPicture.asset(
asset!.path,
width: size,
height: size,
colorFilter: ColorFilter.mode(iconColor, BlendMode.srcIn),
);
}
} Previews: |
it's still present in the package :( |
The issue is still present. Even the workaround is not working for some reason. Workaround I tried:
|
Since we are using 'color' parameter there is a problem with svg rendering on iOS (on android it works fine).
The problem is in tab bar only if there are 2 items there. For 3 and more elements it works fine.
Tested on iPhone 7 iOS 15.7, iPhone 8 iOS 16.3.0 and iPhone 8 iOS 16.3.1.
Expected results/Screenshot
Actual results/Screenshot
main.dart
home.svg
Doctor output
The text was updated successfully, but these errors were encountered: