Closed kirill-21 closed 1 year ago
By the way they do not fade away completely and are shown back when you rebuild whole widget tree(not just the widget where icon is used), but only for a second.
And if you try to render this same icon(that disappeared) somewhere else in the app without restarting it - almost all icons that are rendered in the same widget with this icon instantly fade away
After some research i started using such blank where i provide both color and SvgTheme with currentColor.
SVGs still disappear, but this helps with restoring icons back by switching app's theme/rebuilding the widget with setState. My suggestion is that SvgPicture widget loses color properties at some time and start's using default SvgTheme's color which is set to transparent even though custom theme is provided. Have no idea why this happens.
I also tried rolling back package version one by one down to 1.1.1 and it seems that issue appeared somewhere between 1.1.1 and 1.1.2.
I have the same problem, but it's super intermittent. Not found a way to reproduce.
So you stopped having this problem by 1.1.1
?
So you stopped having this problem by
1.1.1
?
Yes
i also have same problem
Having same problem on both Android and iOS. I tried version 1.1.1+1, 1.1.0, doesn't work. It seems comes with flutter version 3.3. before upgrading to flutter 3.3, I never met this problem.
So you stopped having this problem by
1.1.1
?Yes
Update: Not for us. Still a problem.
So you stopped having this problem by
1.1.1
?Yes
Update: Not for us. Still a problem.
Then maybe it's a flutter issue and we need more data to provide it to flutter's team.
@wizardlyc, @tusharch12 , @Dohmanlechx, can you share more info about when and how you recreate this issue?
@wizardlyc, @tusharch12 , @Dohmanlechx, can you share more info about when and how you recreate this issue?
Once I find a reproducible scenario, I promise to write it here.
@wizardlyc, @tusharch12 , @Dohmanlechx, can you share more info about when and how you recreate this issue?
Once I find a reproducible scenario, I promise to write it here.
I believe it might take a while, maybe comparing of our actions (what we did right before this issue occured) might help
I believe it might take a while, maybe comparing of our actions (what we did right before this issue occured) might help
When it happened today, I had the simulator running the app for a while, and I came back after some minutes. I didn't put it into the background or so. I believe some kind of setState caused that.
@dnfield might it be related to the svg package or maybe you have any ideas where is the core of this problem?
I need a reproduction. There's also about to be a new major release of this package
Are you sure it disappears? Because for me it becomes the square with the color of SVG, don't know how to reproduce either
Are you sure it disappears? Because for me it becomes the square with the color of SVG, don't know how to reproduce either
Actually, I had problem with disappearing SVGs until I downgraded to 1.1.1
, and then I got white squared SVGs.
Are you sure it disappears? Because for me it becomes the square with the color of SVG, don't know how to reproduce either
I do had the same with old package versions
I need a reproduction. There's also about to be a new major release of this package
Try launching the app in background for 10 minutes, then return and hover your SVG widget to call setstate(wrap the widget with mouseregion onEnter callback before the test start), seems that issue happens after this actions
I have the same issue on the latest version
Are you sure it disappears? Because for me it becomes the square with the color of SVG, don't know how to reproduce either
Having these even on the latesst version
And new flutter 3.3.10 has this issue :c
I don't know how to reproduce it but I know how to fix it in the runtime. If you swipe down notification bar (in the top left corner) of your iPhone several times, SVG will comeback to normal.
I don't know how to reproduce it but I know how to fix it in the runtime. If you swipe down notification bar (in the top left corner) of your iPhone several times, SVG will comeback to normal.
Theme brightness switch also works
FWIW, I am also having this issue and cannot reliably reproduce it. I am on Flutter 3.3 using Flutter SVG 1.1.6.
Following, I have this issue, but I'm loading it locally only happing on iOS
my code
Center(
child: SvgPicture.asset(
'assets/svg/team/${team.icon}.svg',
color: CustomColors.primary,
),
),
Lastest package version
Error
══╡ EXCEPTION CAUGHT BY SVG ╞═══════════════════════════════════════════════════════════════════════
The following assertion was thrown resolving a single-frame picture stream:
Unable to load asset: assets/svg/team/general-team.svg
When the exception was thrown, this was the stack:
#0 PlatformAssetBundle.load (package:flutter/src/services/asset_bundle.dart:258:7)
<asynchronous suspension>
#1 AssetBundle.loadString (package:flutter/src/services/asset_bundle.dart:83:27)
<asynchronous suspension>
#2 AssetBundlePictureProvider._loadAsync (package:flutter_svg/src/picture_provider.dart:546:25)
<asynchronous suspension>
Picture provider: ExactAssetPicture(name: "assets/svg/team/general-team.svg", bundle: null,
colorFilter: null)
Picture key: AssetBundlePictureKey(bundle: PlatformAssetBundle#a27c5(), name:
"assets/svg/team/general-team.svg", colorFilter: null, theme: SvgTheme(currentColor:
Color(0xff000000), fontSize: 14.0, xHeight: 7.0))
════════════════════════════════════════════════════════════════════════════════════════════════════
Another exception was thrown: Unable to load asset: assets/svg/team/dog-ball.svg
Another exception was thrown: Unable to load asset: assets/svg/team/rescue-dog.svg
@isAlmogK this is unrelated issue, in our case there is no error thrown. In your case there are 3 errors thrown, the last two are likely just the wrong provided path to the asset. The first one can be malformed SVG or something, run it through online SVG checker. The first one can be related to the wrong path as well.
@eli1stark thanks you are correct had an issue in pub file
I've attempted to build a reproduction sample, and I'm not seeing the disappearing behaviour. Here's my understanding of the original code, but pulled out as a stand alone reproduction case. The SVG in question is the Ghostscript Tiger.
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
const String assetName = 'assets/Ghostscript_Tiger.svg';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(primarySwatch: Colors.blue),
home: Scaffold(
body: Center(
child: SizedBox(
width: 512,
height: 512,
child: SvgPicture.asset(
assetName,
semanticsLabel: 'Ghostscript Tiger',
color: Colors.amber,
),
),
),
),
);
}
}
Please modify this minimal repro until the disappearing SVG is reproduced.
@domesticmouse, @dnfield
The code in the the video is from another project, it's just a replay of the moment when issue was recreated in a test project, recorded with amd alternative of ShadowPlay.
Steps to reproduce:
flutter_weather_bg_null_safety: ^1.0.0
flutter_svg: ^1.1.6
flutter_weather_bg_null_safety pacakge is used for constant rendering of elements (with this the issue replecates faster)
I've also added an image to this test to ensure that it's just svg error.
I also have this problem, iOS simulator, flutter 3.3.10, flutter_svg: 1.1.6. I have no idea how to reproduce it, it seems very random.
Not a repro scenario, but I locked the computer (Macbook) and went for lunch. Came back 1 hour later, unlocked the computer and the SVG icons had disappeared in the app that was running on a simulator. Tried locking the computer again and unlocked it immediately but the icons were still there. Hope this helps in some way.
@kirill-21 - your issue looks different, it doesn't look like the SVGs are disappearing but changing...?
Can anyone who has this try to use the latest code on the master branch in this repo? There are significant changes that may have obsoleted this bug.
It's the same issue, this bug is just random and sometimes they disappear, sometimes become a cube, sometimes change to a strange shape
@dnfield I'll try, are those changes production ready?
@dnfield I have not been able to repro it from the master branch, but I would wait for someone else to confirm because I don't have a 100% repro path (it just happens sometimes)
@dnfield Do you know when there maybe a production build for v2?
I will publish something soon. I was working on validating it in Google's monorepo before I had to take some time away - I have validated it (although it will be difficult to roll into Google because of a large number of small golden changes).
Ah, I still am going to keep it as a dev version because the new version requires features currently only available in the Flutter beta. Once the new Flutter stable is released I'll publish a non-dev version.
Is this still happening on latest stable/preview version of flutter_svg?
@dnfield I haven't encountered it since adopting the version with vector graphics.
Is this still happening on latest stable/preview version of flutter_svg?
Why new version loads icons very slow? 4-5 seconds after widget is rendered on the screen
@kirill-21 what platform is that on?
And are those network or asset SVGs?
@kirill-21 what platform is that on?
Windows, the 3.7.0 flutter update. These are asset and memory svgs
Can you share a timeline recording?
Can you share a timeline recording?
How do i do that?
https://docs.flutter.dev/development/tools/devtools/performance#timeline-events-chart - from there you should also be able to export the file in JSON format so we can view it.
Or, you can do it from the observatory on the timeline page if you're more familiar with the observatory than devtools.
please attach that as a zipped file so we don't ahve to try to copy that. Also, a timeline capture on the old version of flutter_svg would be idea so we can compare / contrast
please attach that as a zipped file so we don't ahve to try to copy that. Also, a timeline capture on the old version of flutter_svg would be idea so we can compare / contrast
dart_devtools_2023-01-27_00_06_22.116.zip
P.S. Updated to the clear timeline from first app launch to the same position as on the video
And here is a timeline from stable package version dart_devtools_2023-01-27_00_11_48.361.zip
https://github.com/dnfield/flutter_svg/issues/760
In this issue SVGs disappear on IOS, i have the same problem on Windows. No errors are printed to FlutterError.onError callback. I have no idea how to repeat it, they just disappear after some time.
Sometimes it happens after changing theme brightness, sometimes after minimizing->maximizing the app, sometimes after using setState. I just leave app launched in background while doing something else and when i return and do something inside the app svgs fade away. (This happens both in Debug and Release mode)
Issue appeared somewhere in latest updates of package/flutter version.