Refactor StrokeAlign to allow double values.#108339
Refactor StrokeAlign to allow double values.#108339auto-submit[bot] merged 26 commits intoflutter:masterfrom
Conversation
c762ffe to
862b931
Compare
|
This is great. It's not technically breaking if it doesn't break any tests in customer_testing or in Google internal tests. Since it's a new addition, it probably won't. |
862b931 to
9744387
Compare
|
I just made some (many) changes based on your comments. I love the double strokeAlign, but I'm still not sure I want to get rid of StrokeAlign. Can't we have a global |
|
I don't think And it seems like waaay overkill to have an entire class that effectively is a namespace for three doubles. It makes it more complicated to assign values to the BorderSide(strokeAlign: StrokeAlign(value));vs BorderSide(strokeAlign: value);Seems more complicated for no benefit. |
|
I simplified further, now: But yeah, I might be able to remove it :( but will hurt. |
|
One other thing to consider is that you might want to allow values outside of -1 and 1, so that you can animate the border with a bounce animation or other animation that goes slightly outside the bounds. The equations I gave you should mostly just work for that, although if people go too crazy, it'll result in some odd behavior (rects that get deflated to zero size, for instance). |
|
The math for -1, 0, 1 is very hard to understand, but I think I got it working. Need to test if getInnerPath is working correctly later. |
|
I thought about that. I think we should set loose the constraints and wait to see what shows up. Technically there isn't a difference from changing that to changing the But, if people want to have fun... committing. |
|
Hey, @bernaferrari this looked like so much fun, I started playing with your code, and made my own branch with some changes. There's also some example code you might want to grab. Here's my branch: https://github.com/gspencergoog/flutter/tree/stroke_align (and the diff if you'd rather look at that). The sample looks like this when it runs: ThrobWithBoundaries.movThrob.movNot intending it as a replacement for yours, just some ideas for you, feel free to appropriate any/all/none of it. Particularly useful, I think, were the new getters I added on |
Yes, perhaps it needs some more work. |
36ca9ef to
f82f51a
Compare
We use |
|
Ok, I'll fix our tests, but I feel you will need to patch Google. That will probably be our breaking change. BTW, how do we get the |
|
I don't know how to hash things, shouldn't the hash value be always the same? |
|
The Object hash includes a component for the base object instance's location in memory, and since the object has a new instance each time, it appears random. |
|
Is it possible to test that? Because there some tests that expect |
|
Yes, use |
|
Ahh. It won't. OK, that's annoying. Instead, just add this to @override
String toStringShort() => 'BorderSide'; |
Remove `width == 0.0` so it follows the same pattern as others.
9166b32 to
40f96e5
Compare
This reverts commit dd8573b.
|
FYI this broke many tests, I've uploaded a revert in #109591. @gspencergoog and @HansMuller can you help with the reland to prevent these breakages? |
|
How bad is it? Is it a golden, a bug from the code, the StrokeAlign or something else? |
|
This PR removed the StrokeAlign enum. That's a breaking change and it caused many internal test failures due to a StrokeAlign dependency (and see https://docs.flutter.dev/resources/compatibility). In this case a small G3Fix would probably enable this PR to land. Failures reported in Google-internal issue b/242668688 |
|
OK, I'll take care of re-landing it. |






Issue: #106362
This is radical, this is breaking, this is awesome. cc @gspencergoog
Edit: technically it is not breaking, I only break a single test (that is dumb and might or might not be fixed by another PR). But StrokeAlign change is really big.
Screen.Recording.2022-07-26.at.00.59.44.mov
Also, I made a completely new sample:
Click to see the sample code