Fix LinearProgressIndicator track painting.#173108
Fix LinearProgressIndicator track painting.#173108auto-submit[bot] merged 9 commits intoflutter:masterfrom
Conversation
There was a problem hiding this comment.
Code Review
This pull request fixes an issue where the LinearProgressIndicator track was painting outside of its bounds when a trackGap was specified. The fix involves clamping the track's rectangle coordinates and adding a check for track width before drawing. A regression golden test has also been added.
|
Golden file changes have been found for this pull request. Click here to view and triage (e.g. because this is an intentional change). If you are still iterating on this change and are not ready to resolve the images on the Flutter Gold dashboard, consider marking this PR as a draft pull request above. You will still be able to view image results on the dashboard, commenting will be silenced, and the check will not try to resolve itself until marked ready for review. For more guidance, visit Writing a golden file test for Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
|
This pull request has been changed to a draft. The currently pending flutter-gold status will not be able to resolve until a new commit is pushed or the change is marked ready for review again. For more guidance, visit Writing a golden file test for Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
|
Golden file changes are available for triage from new commit, Click here to view. For more guidance, visit Writing a golden file test for Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
QuncCccccc
left a comment
There was a problem hiding this comment.
I haven't finished my review but thank you so much for your contribution. Overall it looks good! Will take another look! The golden tests look great!
|
Hi @QuncCccccc, thanks a lot for your review and suggestions! I added a number of comments to help understand the code. Could you please take a look again when you have time? |
|
@QuncCccccc, I noticed that the Android Below is the comparison of the two approaches with a track_gaps.movThe code for the new approach: double getEffectiveTrackGapFraction(double currentValue, double trackGapFraction) {
// If the progress is less than 1%, the gap will be proportional to the
// progress. So that, it draws a full track at 0%.
const double kGapRampDownThreshold = 0.01;
return trackGapFraction *
clampDouble(currentValue, 0, kGapRampDownThreshold) /
kGapRampDownThreshold;
}Given this difference in the effective |
|
I think both are fine. We can use the current algorithm as is because I think usually the gap is small and we can barely detect the difference during animation. Update: I just talked with @TahaTesser who implemented the updated LinearProgressIndicator. Since overall the Android material-components repo are more reliable and usually have faster updates from newer Material specs, keeping the original calculation (material-components) would be a better option. |
There was a problem hiding this comment.
LGTM. Thank for your fix:) Add this comment here again in case it's missed:) #173108 (comment)
|
@QuncCccccc, sorry for the spam, I messed up a bit with git. I updated the effective |
|
Golden file changes are available for triage from new commit, Click here to view. For more guidance, visit Writing a golden file test for Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
|
Golden file changes are available for triage from new commit, Click here to view. For more guidance, visit Writing a golden file test for Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
|
@QuncCccccc thanks a lot for your review and suggestions! |
|
@QuncCccccc I don't see |
|
Oh thank for letting me know! For this kind of change, we probably should only submit it after Google testing has passed next time.
Yeah, the google testing sometimes just don't start testing. Might need to try to re-trigger it by rebasing with master. |
Fixes #164538
Fixes #173096
Fixes #173153
Description
trackGapin indeterminateLinearProgressIndicatorLinearProgressIndicatorbounds whentrackGapis greater than zeroLinearProgressIndicatortrack gap painting whenvalueis 0androidx.compose.material3 and material-components-android implementations were used as a reference.
trackGap: 20)trackGap: 20)Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.