You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Colors with alpha in android show inconsistent behavior between update and create.
For creation colors follow must follow rgba(r, g, b, a) or #rgb while #argb is not supported.
If a fill gets updated, the color must follow them pattern #argb or #rgb while rgba(r, g, b, a) is not supported.
Analysis
The reason for this is that for fill#add the FillBuilder is used while for fill#updateFillController is used.
Only the Fill Controller calls Color.praseColor: fill.setFillColor(Color.parseColor(fillColor));
while the FillBuilder directly uses the passed color string. fillOptions.withFillColor(fillColor);
Proposal
The Proposal how to address this is two fold: Firstly have both FillBuilder FillController use Color.parseColor. Existing implementations that don't rely on alpha will not be broken.
Secondly change FillOptions, CircleOptions, and LineOptions to use Flutter Colors. Deprecate the old string colors.
Dealing with Strings in Flutter is pretty weird, especially because color toString does not provide an a string that can be used.
The suggest interface for FillOptions would look like so:
The other geometry types should be changed similarly as well. Opacity could be deprecated as well as this can easily be controlled with the standard color tools everybody is used to such as color.withAlpha(value).
The text was updated successfully, but these errors were encountered:
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Summary
Colors with alpha in android show inconsistent behavior between update and create.
For creation colors follow must follow
rgba(r, g, b, a)
or#rgb
while#argb
is not supported.If a fill gets updated, the color must follow them pattern
#argb
or#rgb
whilergba(r, g, b, a)
is not supported.Analysis
The reason for this is that for
fill#add
theFillBuilder
is used while forfill#update
FillController
is used.Only the Fill Controller calls Color.praseColor:
fill.setFillColor(Color.parseColor(fillColor));
while the FillBuilder directly uses the passed color string.
fillOptions.withFillColor(fillColor);
Proposal
The Proposal how to address this is two fold: Firstly have both FillBuilder FillController use Color.parseColor. Existing implementations that don't rely on alpha will not be broken.
Secondly change FillOptions, CircleOptions, and LineOptions to use Flutter Colors. Deprecate the old string colors.
Dealing with Strings in Flutter is pretty weird, especially because color toString does not provide an a string that can be used.
The suggest interface for FillOptions would look like so:
The other geometry types should be changed similarly as well. Opacity could be deprecated as well as this can easily be controlled with the standard color tools everybody is used to such as
color.withAlpha(value)
.The text was updated successfully, but these errors were encountered: