-
Notifications
You must be signed in to change notification settings - Fork 207
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
Cannot get size in LinearPercentIndicator's initState #174
Comments
are you sure you are using the latest version? can you check the pubspec.lock file ? |
@diegoveloper Yes, I checked the |
hmm I can't reproduce the issue :/ |
maybe related #175 this is cause by complex widget tree which I haven't be able to track the root cause but the patch works for me. I think this is bug in the flutter SDK itself since |
I'm also getting this "cannot get size in initState", the stack trace is pretty bad because it comes from Flutter for Web but it's like this:
I have a table of data and one cell contains a LinearPercentIndicator. I do not get this all the time but it happens within 5 minutes if I filter and sort the data so that the listview have to rebuild the cells containing LinearPercentIndicator. Before it crashes the percent indicator works really nicely but when I filter the list (add/remove items) - sometimes it crashes with this error. I will try to change I'm using percent_indicator 4.2.2 and Flutter 3.3.3 (stable). EDIT: None of the fixes (animate: false or shrinkWrap: true on the listview) helped. Still getting the error. But my use case is very simple (a horizontal linear progress) so I'll just build it myself. |
I'm also experiencing this issue. It's occurring very sporadically, but easily often enough to be noticeable. I couldn't reproduce it with a simple toy example today as it only seems to occur in more complex widget trees. In my case, the LinearPercentIndicator is wrapped in a column together with other, more complex content. Multiple of those columns then make up an animated list view in my app which sometimes, on refresh, will cause this error. I'll try to produce a minimal (non-)working example by occasion. So far, no changes to the LinearPercentIndicator helped. |
yeah please, try to reproduce it in a minimal sample code in order to fix that , thank you |
Try this:
The issue is very difficult to reproduce, but with the above App, I could reproduce it on all devices I've tested (macOS + Web + Android). Also, it only seems to occur when some of the widgets are off-screen. I hope this helps. I swear the above example is the simplest I could do, took me some painstaking 2 hours. Using Flutter 3.10.2 and percent_indicator 4.2.3, though I don't think this matters. Edit: Formatted code properly, added version numbers |
@diegoveloper Have you been able to fix this issue? Getting the same on our end |
The problem is it.. flutter tries to draw the component before the render is finished, and to wait for this we can use the LayoutBuilder. With this, it seems that the error is fixed. Please replace line 247 of the class linear_percent_indicator.dart with this. Either way, I've already sent a PR
|
@diegoveloper Can you please review and merge the PR? It'll help us avoid using a forked repository |
Umar, you don't need to fork, just point the package to his github url and
branch name (in pubspec.yml) , try and see if the bug still exists.
Thanks
…On Thu, Oct 5, 2023, 1:31 AM Umar Salim ***@***.***> wrote:
@diegoveloper <https://github.com/diegoveloper> Can you please review and
merge the PR? It'll help us avoid using a forked repository
—
Reply to this email directly, view it on GitHub
<#174 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABFL3UEZR7LUQGGXO7VQZO3X5ZV4XAVCNFSM56YBMJG2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCNZUHAZTOMRRGUZA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
@diegoveloper The PR from @victormanuelfrancodev seems to fix the issue. Can you please merge it if everything else seems fine? |
@diegoveloper this issue is not fixed yet. Can you fix this one for us? |
We are using
flutter_percent_indicator
version4.2.2
, Flutter SDK version3.0.5
Here is our exception stack trace:
Sadly we cannot reproduce this on our local machine. I think this issue is similar to this so maybe this is a regression bug?
The text was updated successfully, but these errors were encountered: