-
Notifications
You must be signed in to change notification settings - Fork 29.1k
Allow Passing an AnimationController to CircularProgressIndicator (Fix #165741) #170380
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
base: master
Are you sure you want to change the base?
Conversation
Shit i merged into main, i will change it to master. 👍 Fixed ✅ |
@dkwingsmt The
This is not something I changed with my pull request. Does that mean this is not an issue for me, or what should I do to address it? |
If you click the detail link and see the full log (https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8712382049978374001/+/u/run_test.dart_for_analyze_shard_and_subshard_None/stdout?format=raw ) you'll find an error at ~45% of the file. I think it's just the eol space. Anyway, such errors can typically be solved by |
O thanks, don't know how you figured that out, from the logs. But thanks. When i have access to my pc i will update the pull req ✅ |
You were indeed right, I ran the command you provided and what happend.... 1 change... 🥳 ![]() |
@dkwingsmt Does this pull request fall into the category of pull requests that the team will not merge until they have figured the Material and Cupertino styling out? I heard that something like that was going on at the moment. Otherwise, I will close this pull request, and reopen it in a couple of months. Thanks. 😃 |
Hi! I don't think so. Although I'm currently on vacation and will review your PR when I'm back next week. Also if there were such cases we would definitely tell the author right away instead of having you suspecting. :) |
I'm sorry thanks, Have a nice vacation ☀️🌊 |
# Conflicts: # packages/flutter/lib/src/material/progress_indicator.dart
Yep I've tested that adding disposal statements resolve the failure. 7a7da01 |
Thanks a lot for the feedback; I'll get those code comments adjusted. Thanks 👍 |
Fix 165741
Added docs
@@ -567,6 +567,80 @@ void main() { | |||
expect(tester.binding.transientCallbackCount, 0); | |||
}); | |||
|
|||
testWidgets('LinearProgressIndicator reflects controller value', (WidgetTester tester) async { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see the point of both tests. The controller's value is passed into the progress indicator directly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR is adding a new property that increases the API surface. Tests should check that that property is respected (for both progress indicators and ProgressIndicatorThemeData
as well.).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In what way should I check that its respected ?
Like check if the hashcode is the same or ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see the point of both tests. The controller's value is passed into the progress indicator directly?
Any idea's on how you would tackle this, differently ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dkwingsmt What do you think about this ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One example I can think of is passing the same animation controller into multiple progress indicators on the same page and verifying at certain points they all have the same value?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can't be done because everything is private in the class.
And there is no way to access private proprties, not even in tests...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can't be done because everything is private in the class.
Testing in the framework focuses on observable behavior, not implementation details.
In progress_indicator_test.dart
, there are tests that check what is painted by the progress indicators. A good test could have multiple progress indicators aligned in a Column, inserted at different times. Then some of them can have the same controller, and the ones with the same controller can be observed to have the same progress (i.e by the same paint extent, indicating a synchronized animation) while the others have a different paint extent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @Sten435, did you run into problems adding a test that fit the description in https://github.com/flutter/flutter/pull/170380/files#r2214098382?
@@ -567,6 +567,80 @@ void main() { | |||
expect(tester.binding.transientCallbackCount, 0); | |||
}); | |||
|
|||
testWidgets('LinearProgressIndicator reflects controller value', (WidgetTester tester) async { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can't be done because everything is private in the class.
Testing in the framework focuses on observable behavior, not implementation details.
In progress_indicator_test.dart
, there are tests that check what is painted by the progress indicators. A good test could have multiple progress indicators aligned in a Column, inserted at different times. Then some of them can have the same controller, and the ones with the same controller can be observed to have the same progress (i.e by the same paint extent, indicating a synchronized animation) while the others have a different paint extent.
Hi! @Sten435 Are you able to address the comments above so we can work together to get this landed? This is a great addition and I'm looking forward to it! |
👋 Yeah, I’ve tried a couple of things over the week, but none worked. I’m new to testing—definitely to animation testing—so I have to learn everything about widget testing. It’s taking some time, but I think I’ll get there. |
I got the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm beginning to wonder if this change is even needed. Why can't multiple progress indicators be supplied the same animation controller value directly in order to synchronize them? Do they need an entire AnimationController?
I think it's because it's a very common demand for progress indicators to stay in sync when multiple are present, so much that the widget is pretty much unusable if there isn't such a feature (i.e. all developers will have to build it by themselves.) The progress indicators are typically scattered across the widget tree and supplying values directly will cause the entire tree to be rebuilt every frame. |
I'm sorry for the delay. This will be done. But i'm verrry busy atm. |
No worries, take you time! Edit: If it makes you feel better, feel free to turn it into a draft or close it for now, and we can always come back to this. |
No, i rather not close it. |
@dkwingsmt I have added a test, but after several days of effort, I was unable to create one for the circular progress indicator. This task is beyond my current experience with Flutter widget testing. I invested considerable effort into the linear progress indicator test and managed to complete it, showing my commitment to delivering quality work. I have poured my heart and soul into this pull request. It may seem unusual, but I have learned a lot—and also suffered quite a bit—in the process. I don’t want to give up on this change, but I will not attempt a circular progress indicator test because I don’t want to drain myself further with Flutter widget tests. I genuinely believe this change brings value and hope it can be merged. If the lack of this specific test prevents that, I understand, but I want to assure you that I have given my best effort. Sometimes, progress means recognizing the limits of what can reasonably be achieved while still giving your full effort. It has been 148 days since I proposed this issue, and I have made my peace with the possibility that it may not be merged any time soon. If the test is really needed, I accept that this pull request will be closed and hopefully picked up by someone else in the future. Hopefully. |
Pull request for issue: #165741
I also added support, to use an inherited controller, using the controller prop in
progress_indicator_theme.dart
.fix.progress.indic.mp4
Pre-launch Checklist
///
).