Skip to content
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

Color should be part of SvgImageKey #42

Open
erickok opened this issue Jun 5, 2023 · 0 comments
Open

Color should be part of SvgImageKey #42

erickok opened this issue Jun 5, 2023 · 0 comments

Comments

@erickok
Copy link

erickok commented Jun 5, 2023

The same image is provided by the library when you change only the color property. This is because color is incorrectly not part of the == (equals) method of SvgImageKey.

return other is SvgImageKey &&

    return other is SvgImageKey &&
        other.path == path &&
        other.pixelWidth == pixelWidth &&
        other.pixelHeight == pixelHeight &&
        other.scale == scale &&
        other.source == source &&
        other.svgGetter == svgGetter;

This leads to bugs such as the provider not providing an updated image when your theme updates (such as when enabling dark/light mode) and your image only changes the svg's applied color. For example:

        image: DecorationImage(
          image: SvgProvider(
            "assets/somewhere/in/my/app/some_grpahic.svg",
            color: inDarkTheme ? Colors.grey.shade800 : Colors.grey.shade200,
          ),
        ),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant