Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add borderRadius to LinearProgressIndicator #123517

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

Merged
merged 10 commits into from
Apr 24, 2023

Conversation

bernaferrari
Copy link
Contributor

@bernaferrari bernaferrari commented Mar 27, 2023

Split from #122664 so it gets easier to review, as this is now unrelated to the preferRound. I'm one step from adding a width attribute, lol.

image

cc @Piinks

@flutter-dashboard flutter-dashboard bot added f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels. labels Mar 27, 2023
@bernaferrari bernaferrari force-pushed the LinearIndicator branch 6 times, most recently from 7e3eea8 to 6a2d29a Compare March 27, 2023 04:26
@bernaferrari bernaferrari marked this pull request as draft March 27, 2023 04:27
Copy link
Contributor

@Piinks Piinks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With shape, is border radius really necessary? Will they not conflict with one another?

@bernaferrari
Copy link
Contributor Author

bernaferrari commented Mar 30, 2023

Hey @Piinks. There are two things. The "indicator borderRadius" and the "everything else borderRadius" (yes, they could be the same, but I guess we want to give users flexibility). Out of better names, I thought shape would be the solution for the "widget borderRadius", because that's pretty standard across material. But I faced a sad bug (https://discord.com/channels/608014603317936148/608021234516754444/1090133714115239996) that is actually the "intended behavior", so I think it will be BorderRadius again (or RoundedRectangleBorder which would be kind of limiting but would allow border, since Samsung/Android does that in a few places).

What do you think? Which approach do you prefer? In the ideal world we wouldn't even use clipBehavior, but indeterminate asks for it :(

@Piinks
Copy link
Contributor

Piinks commented Apr 4, 2023

I think just the radius makes sense in this case.

While you can get into custom shapes, I don't know that is is very valuable to add a more complicated API when most folks will only use this particular part of it. Sometimes we have to recognize just because we can, does not mean we should. I can get carried away with the possibilities (with Flutter there are so many!) so I often remind myself - what is the user actually asking for here? :)

@bernaferrari
Copy link
Contributor Author

bernaferrari commented Apr 4, 2023

Thanks. Do you have naming suggestions for the "widget's borderRadius"? Perhaps borderRadius, shapeBorderRadius, outerBorderRadius or widgetBorderRadius? I think the name I chose before (backgroundBorderRadius) was a poor choice.

Remember there are two, the indicatorBorderRadius and the ___ radius.

@bernaferrari bernaferrari force-pushed the LinearIndicator branch 2 times, most recently from afa1f27 to d00960e Compare April 4, 2023 23:22
@bernaferrari
Copy link
Contributor Author

Ok, just commited with outerBorderRadius, feel free to review.

@bernaferrari bernaferrari force-pushed the LinearIndicator branch 2 times, most recently from 2c9b08d to e0636ed Compare April 4, 2023 23:29
@bernaferrari bernaferrari changed the title Add shape and indicatorBorderRadius to LinearProgressIndicator Add outerBorderRadius and indicatorBorderRadius to LinearProgressIndicator Apr 5, 2023
@bernaferrari bernaferrari marked this pull request as ready for review April 5, 2023 01:35
@bernaferrari bernaferrari force-pushed the LinearIndicator branch 5 times, most recently from 4a1911a to 62a82e9 Compare April 12, 2023 01:49
@bernaferrari
Copy link
Contributor Author

The only possible point of conflict in this PR is that I'm making BorderRadius.topLeft/bottomLeft squared, so it always works well for users.

@Piinks Piinks added the c: new feature Nothing broken; request for a new capability label Apr 13, 2023
@bernaferrari bernaferrari force-pushed the LinearIndicator branch 2 times, most recently from 743bd0f to 65dc15a Compare April 15, 2023 14:50

/// The border radius of the indicator.
///
/// When TextDirection is set to [TextDirection.ltr], [BorderRadius.topLeft]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why override the radius? There will always be a text direction.

Copy link
Contributor Author

@bernaferrari bernaferrari Apr 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is what I expect, so I tried to override the start corner to always be 0. What do you think? Else, BorderRadius.circular(32) will always output a weird unwanted value, which will force everybody to do BorderRadius(topLeft, topRight) which is a lot more verbose (even more if the person is considering accessibility / Directionality, which I'm already handling for them for free).

This only affects determinate. Indeterminate is the same.

expected

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Much like the circular PR, I think we should not try to assume how folks will and won't want to use this. Why expose it if we are going to override it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We want to expose the end-side, not the start-side. We could just expose Radius instead of BordeRadius, but could be slightly odd since all the rest of the framework uses BorderRadius. What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We want to expose the end-side, not the start-side

Why? Folks have the option to apply the radius to the track with this PR.

Copy link
Contributor Author

@bernaferrari bernaferrari Apr 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you provide a single example in any software where the linear indicator starts rounder than the end? I've never seen one. I think we should make it easy for people, not ask for 5 LOC when it could be 1. But I might be wrong. What if I took this to Reddit? Could I ask there for the feedback of the people what they prefer?
(I say this as let's collect feedback, not let's go to war, if you prefer keeping it here, I'll respect too)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you provide a single example in any software where the linear indicator starts rounder than the end? I've never seen one.

No. That is not the point.

What if I took this to Reddit?

You're welcome too. I don't feel that this kind of response is appropriate in the context of code review though. I am making a point about a clear API. I feel like it is unfortunate that we expose this and then ignore it.

I also do not think it is worth arguing over based purely on the fact that you personally do not see value in it like we did with the circular PR, and going back and forth over it like in that PR is an unfortunate waste of both our time.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we are discussing about introducing a feature that wouldn't be useful. That's part of the Yak Shaving in Flutter documentation "avoid implementing what you don't need". I don't think we need a start-radius indicator, and I think we could "crowd-source" to see how others feel.

But... just like the other, yes, I can ignore this and we can have the "weird" behavior by default on Flutter. It is just unfortunate for me, that everybody will need boilerplate to get what they want.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New proposal: single borderRadius for everything.

@@ -301,6 +327,27 @@ class LinearProgressIndicator extends ProgressIndicator {
/// {@endtemplate}
final double? minHeight;

/// The border radius of the widget.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the docs I am not sure what this value is for.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think?
image

Copy link
Contributor

@Piinks Piinks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flutter_LGTM

@Piinks Piinks added the autosubmit Merge PR when tree becomes green via auto submit App label Apr 24, 2023
@auto-submit auto-submit bot merged commit 9e9ac77 into flutter:master Apr 24, 2023
@bernaferrari bernaferrari deleted the LinearIndicator branch April 24, 2023 22:44
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Apr 25, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Apr 25, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Apr 25, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Apr 26, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Apr 26, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Apr 26, 2023
stuartmorgan-g pushed a commit to flutter/packages that referenced this pull request Apr 28, 2023
Roll Flutter from c9004ff to 66fa4c5 (68 revisions)

flutter/flutter@c9004ff...66fa4c5

2023-04-26 [email protected] Remove web compile
benchmarks that specify an attached device (flutter/flutter#125559)
2023-04-26 [email protected] Roll Flutter Engine from
f75908135e10 to f125a54f5a57 (1 revision) (flutter/flutter#125560)
2023-04-26 [email protected] Roll Flutter Engine from
c9db1587f207 to f75908135e10 (1 revision) (flutter/flutter#125558)
2023-04-26 [email protected] Roll Flutter Engine from
58a5a1e3f2c1 to c9db1587f207 (1 revision) (flutter/flutter#125555)
2023-04-26 [email protected] Roll Flutter Engine from
321f8015b9c2 to 58a5a1e3f2c1 (1 revision) (flutter/flutter#125552)
2023-04-26 [email protected] Roll Flutter Engine from
87f5f4e939cf to 321f8015b9c2 (1 revision) (flutter/flutter#125549)
2023-04-26 [email protected] Update prefer_final_parameters comment
(flutter/flutter#125465)
2023-04-26 [email protected] Roll Flutter Engine from
706c023df44b to 87f5f4e939cf (1 revision) (flutter/flutter#125539)
2023-04-26 [email protected] Roll Flutter Engine from
7b385abd18a2 to 706c023df44b (1 revision) (flutter/flutter#125536)
2023-04-26 [email protected] Roll Flutter Engine from
610c57781b47 to 7b385abd18a2 (1 revision) (flutter/flutter#125533)
2023-04-26 [email protected] Roll Flutter Engine from
b3cbf0678487 to 610c57781b47 (1 revision) (flutter/flutter#125531)
2023-04-26 [email protected] Add hostonly web compile
size benchmarks (flutter/flutter#125518)
2023-04-26 [email protected] Roll Flutter Engine from
34ece7a4abac to b3cbf0678487 (6 revisions) (flutter/flutter#125529)
2023-04-25 [email protected] Handle dollar signs
properly when generating localizations (flutter/flutter#125514)
2023-04-25 [email protected] Roll Flutter Engine from
6d798393a15a to 34ece7a4abac (1 revision) (flutter/flutter#125516)
2023-04-25 [email protected] Roll Flutter Engine from
469e5b409686 to 6d798393a15a (2 revisions) (flutter/flutter#125513)
2023-04-25 [email protected] Adds selected
semantics flag to radio button for Apple devices
(flutter/flutter#125499)
2023-04-25 [email protected] Roll Flutter Engine from
0e236982086b to 469e5b409686 (1 revision) (flutter/flutter#125510)
2023-04-25 [email protected] Relabel JSFunction
as JSExportedDartFunction (flutter/flutter#125453)
2023-04-25 [email protected] Roll Flutter Engine from
60c4e61416cd to 0e236982086b (2 revisions) (flutter/flutter#125504)
2023-04-25 [email protected] iOS TextField spell check style
(flutter/flutter#125432)
2023-04-25 [email protected] Roll Flutter Engine from
308bce499087 to 60c4e61416cd (1 revision) (flutter/flutter#125490)
2023-04-25 [email protected] Roll Flutter Engine from
54ddef68b124 to 308bce499087 (1 revision) (flutter/flutter#125485)
2023-04-25 [email protected] Roll Flutter Engine from
307416f43b5a to 54ddef68b124 (1 revision) (flutter/flutter#125481)
2023-04-25 [email protected] Roll Flutter Engine from
232810b36671 to 307416f43b5a (1 revision) (flutter/flutter#125475)
2023-04-25 [email protected] Roll Flutter Engine from
1c4b6c0cb862 to 232810b36671 (2 revisions) (flutter/flutter#125472)
2023-04-25 [email protected] Roll Flutter Engine from
a26a479e86b3 to 1c4b6c0cb862 (1 revision) (flutter/flutter#125463)
2023-04-25 [email protected] Fix `SliverAppBar.medium` &
`SliverAppBar.large` text scale (flutter/flutter#125038)
2023-04-25 [email protected] Roll Flutter Engine from
3f4116c225e8 to a26a479e86b3 (1 revision) (flutter/flutter#125459)
2023-04-25 [email protected] Roll Flutter Engine from
64882f4b7371 to 3f4116c225e8 (2 revisions) (flutter/flutter#125458)
2023-04-25 [email protected] Roll Flutter Engine from
8fe8e94c02fc to 64882f4b7371 (1 revision) (flutter/flutter#125454)
2023-04-25 [email protected] Roll Flutter Engine from
5fbde6c0fc57 to 8fe8e94c02fc (10 revisions) (flutter/flutter#125452)
2023-04-24 [email protected] Add Sliders to `macrobenchmarks`
(flutter/flutter#125296)
2023-04-24 [email protected] [date_picker] [date_range_picker] add
properties to change switch-to icons (flutter/flutter#124881)
2023-04-24 [email protected] Sliver Constrained Cross
Axis (flutter/flutter#125239)
2023-04-24 [email protected] tool: Move cdKey to
CustomDimensionsEnum (flutter/flutter#125335)
2023-04-24 [email protected] Add `borderRadius` to
LinearProgressIndicator (flutter/flutter#123517)
2023-04-24 [email protected] Fix JS types in
_test_http_request.dart (flutter/flutter#125220)
2023-04-24 [email protected] Fix `OutlinedButton`, `TextButton`, and
`IconButton` throw exception when passing only one cursor to `styleFrom`
(flutter/flutter#125204)
2023-04-24 [email protected] Swap some iOS TESTOWNERS
(flutter/flutter#125340)
2023-04-24 [email protected] Fix iOS touch drag behavior
(flutter/flutter#125169)
2023-04-24 [email protected] Mark
module_test_ios flaky (flutter/flutter#125426)
2023-04-24 [email protected] Implement url
support for RouteInformation and didPushRouteInformation
(flutter/flutter#119968)
2023-04-24 [email protected] [tool,web] Include more info
URI on Wasm init failure (flutter/flutter#125312)
2023-04-24 [email protected] Do not run
`windows_home_scroll_perf__timeline_summary` benchmark in presubmit
(flutter/flutter#125343)
2023-04-24 [email protected] Tiny fix doc
pointing to incorrect widget confusing the readers
(flutter/flutter#125394)
...
nploi pushed a commit to nploi/packages that referenced this pull request Jul 16, 2023
Roll Flutter from c9004ff to 66fa4c5 (68 revisions)

flutter/flutter@c9004ff...66fa4c5

2023-04-26 [email protected] Remove web compile
benchmarks that specify an attached device (flutter/flutter#125559)
2023-04-26 [email protected] Roll Flutter Engine from
f75908135e10 to f125a54f5a57 (1 revision) (flutter/flutter#125560)
2023-04-26 [email protected] Roll Flutter Engine from
c9db1587f207 to f75908135e10 (1 revision) (flutter/flutter#125558)
2023-04-26 [email protected] Roll Flutter Engine from
58a5a1e3f2c1 to c9db1587f207 (1 revision) (flutter/flutter#125555)
2023-04-26 [email protected] Roll Flutter Engine from
321f8015b9c2 to 58a5a1e3f2c1 (1 revision) (flutter/flutter#125552)
2023-04-26 [email protected] Roll Flutter Engine from
87f5f4e939cf to 321f8015b9c2 (1 revision) (flutter/flutter#125549)
2023-04-26 [email protected] Update prefer_final_parameters comment
(flutter/flutter#125465)
2023-04-26 [email protected] Roll Flutter Engine from
706c023df44b to 87f5f4e939cf (1 revision) (flutter/flutter#125539)
2023-04-26 [email protected] Roll Flutter Engine from
7b385abd18a2 to 706c023df44b (1 revision) (flutter/flutter#125536)
2023-04-26 [email protected] Roll Flutter Engine from
610c57781b47 to 7b385abd18a2 (1 revision) (flutter/flutter#125533)
2023-04-26 [email protected] Roll Flutter Engine from
b3cbf0678487 to 610c57781b47 (1 revision) (flutter/flutter#125531)
2023-04-26 [email protected] Add hostonly web compile
size benchmarks (flutter/flutter#125518)
2023-04-26 [email protected] Roll Flutter Engine from
34ece7a4abac to b3cbf0678487 (6 revisions) (flutter/flutter#125529)
2023-04-25 [email protected] Handle dollar signs
properly when generating localizations (flutter/flutter#125514)
2023-04-25 [email protected] Roll Flutter Engine from
6d798393a15a to 34ece7a4abac (1 revision) (flutter/flutter#125516)
2023-04-25 [email protected] Roll Flutter Engine from
469e5b409686 to 6d798393a15a (2 revisions) (flutter/flutter#125513)
2023-04-25 [email protected] Adds selected
semantics flag to radio button for Apple devices
(flutter/flutter#125499)
2023-04-25 [email protected] Roll Flutter Engine from
0e236982086b to 469e5b409686 (1 revision) (flutter/flutter#125510)
2023-04-25 [email protected] Relabel JSFunction
as JSExportedDartFunction (flutter/flutter#125453)
2023-04-25 [email protected] Roll Flutter Engine from
60c4e61416cd to 0e236982086b (2 revisions) (flutter/flutter#125504)
2023-04-25 [email protected] iOS TextField spell check style
(flutter/flutter#125432)
2023-04-25 [email protected] Roll Flutter Engine from
308bce499087 to 60c4e61416cd (1 revision) (flutter/flutter#125490)
2023-04-25 [email protected] Roll Flutter Engine from
54ddef68b124 to 308bce499087 (1 revision) (flutter/flutter#125485)
2023-04-25 [email protected] Roll Flutter Engine from
307416f43b5a to 54ddef68b124 (1 revision) (flutter/flutter#125481)
2023-04-25 [email protected] Roll Flutter Engine from
232810b36671 to 307416f43b5a (1 revision) (flutter/flutter#125475)
2023-04-25 [email protected] Roll Flutter Engine from
1c4b6c0cb862 to 232810b36671 (2 revisions) (flutter/flutter#125472)
2023-04-25 [email protected] Roll Flutter Engine from
a26a479e86b3 to 1c4b6c0cb862 (1 revision) (flutter/flutter#125463)
2023-04-25 [email protected] Fix `SliverAppBar.medium` &
`SliverAppBar.large` text scale (flutter/flutter#125038)
2023-04-25 [email protected] Roll Flutter Engine from
3f4116c225e8 to a26a479e86b3 (1 revision) (flutter/flutter#125459)
2023-04-25 [email protected] Roll Flutter Engine from
64882f4b7371 to 3f4116c225e8 (2 revisions) (flutter/flutter#125458)
2023-04-25 [email protected] Roll Flutter Engine from
8fe8e94c02fc to 64882f4b7371 (1 revision) (flutter/flutter#125454)
2023-04-25 [email protected] Roll Flutter Engine from
5fbde6c0fc57 to 8fe8e94c02fc (10 revisions) (flutter/flutter#125452)
2023-04-24 [email protected] Add Sliders to `macrobenchmarks`
(flutter/flutter#125296)
2023-04-24 [email protected] [date_picker] [date_range_picker] add
properties to change switch-to icons (flutter/flutter#124881)
2023-04-24 [email protected] Sliver Constrained Cross
Axis (flutter/flutter#125239)
2023-04-24 [email protected] tool: Move cdKey to
CustomDimensionsEnum (flutter/flutter#125335)
2023-04-24 [email protected] Add `borderRadius` to
LinearProgressIndicator (flutter/flutter#123517)
2023-04-24 [email protected] Fix JS types in
_test_http_request.dart (flutter/flutter#125220)
2023-04-24 [email protected] Fix `OutlinedButton`, `TextButton`, and
`IconButton` throw exception when passing only one cursor to `styleFrom`
(flutter/flutter#125204)
2023-04-24 [email protected] Swap some iOS TESTOWNERS
(flutter/flutter#125340)
2023-04-24 [email protected] Fix iOS touch drag behavior
(flutter/flutter#125169)
2023-04-24 [email protected] Mark
module_test_ios flaky (flutter/flutter#125426)
2023-04-24 [email protected] Implement url
support for RouteInformation and didPushRouteInformation
(flutter/flutter#119968)
2023-04-24 [email protected] [tool,web] Include more info
URI on Wasm init failure (flutter/flutter#125312)
2023-04-24 [email protected] Do not run
`windows_home_scroll_perf__timeline_summary` benchmark in presubmit
(flutter/flutter#125343)
2023-04-24 [email protected] Tiny fix doc
pointing to incorrect widget confusing the readers
(flutter/flutter#125394)
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autosubmit Merge PR when tree becomes green via auto submit App c: new feature Nothing broken; request for a new capability f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants