pin_code_fields icon indicating copy to clipboard operation
pin_code_fields copied to clipboard

A color with a non-1.0 opacity appears differently for a fill color vs color

Open aamirki opened this issue 1 year ago • 0 comments

Consider a PinCodeTextField with a color which has an opacity value of 1.0:

final inactiveColor = Colors.red;
return PinCodeTextField(
  controller: controller,
  appContext: context,
  length: 4,
  autoFocus: true,
  enableActiveFill: true,
  pinTheme: PinTheme(
    shape: PinCodeFieldShape.box,
    fieldHeight: 48,
    fieldWidth: 32,
    inactiveColor: inactiveColor,
    inactiveFillColor: inactiveColor,
  ),
);

This will appear as: Screenshot 2024-04-08 at 5 03 06 PM

However, if you change the opacity on inactiveColor to contain a non-1.0 opacity:

final inactiveColor = Colors.red.withOpacity(0.5);

This will appear as: Screenshot 2024-04-08 at 5 03 36 PM

The expected behavior, I believe, would be here that since inactiveColor and inactiveFillColor are both the exact same color value, the border and fill color should appear identical. However, it seems like some manipulation is done when the opacity is a value besides 1.0

aamirki avatar Apr 08 '24 21:04 aamirki