Skip to content

Don't use Opacity for Duotone icon color #53

Description

@12people

Right now, the opacity of duotone icons uses the Opacity widget.

This can negatively impact performance, as this widget is relatively expensive. From Flutter's official performance best practices docs:

Instead of wrapping simple shapes or text in an Opacity widget, it's usually faster to just draw them with a semitransparent color.

Instead, it'd be preferable if either:

  • the duotoneSecondaryOpacity attribute was deprecated and the opacity was taken from the duotoneSecondaryColor only
  • OR the withValues(alpha: ...) value was used for the secondary icon color instead of the Opacity widget

I prefer the first option, as:

  • it's much simpler to send just one value than two values
  • it'd be consistent with the way the primary icon color works
  • it'd be consistent with the way Flutter's Icon widget works

It would require deprecation of the duotoneSecondaryOpacity attribute and a major release where the default opacity would be 1 instead of 0.2.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions