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

[FR]: Configure default image values #437

Open
2 tasks done
misha opened this issue Oct 19, 2023 · 1 comment
Open
2 tasks done

[FR]: Configure default image values #437

misha opened this issue Oct 19, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@misha
Copy link

misha commented Oct 19, 2023

Is there an existing issue for this?

  • I have searched the existing issues

Describe the problem

I'm working with pixel graphics that always require FilterQuality.none. Unfortunately, the image method on generated assets comes with a generated FilterQuality.low, so I have dozens of .image(filterQuality: FilterQuality.none) littering my code base.

Describe the solution

I would love to be able to configure FilterQuality, or really any other default parameters, for the generated functions. Ideally it would be added to the configuration file, ie. filterQuality: none would cause this to be set in the generated files.

Additional context

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@misha misha added the enhancement New feature or request label Oct 19, 2023
@bramp
Copy link
Contributor

bramp commented Oct 19, 2023

(not a maintainer) but the default value in Image.asset is also filterQuality = FilterQuality.low, so FlutterGen or not, you'd need to write Something(filterQuality = FilterQuality.none).

As a workaround you can extend the AssetGenImage class:

extension MyAssetGenImage on AssetGenImage {
  Image myimage() {
    return image(filterQuality: FilterQuality.none);
  }
}

Now you can call myimage(...) instead of image(...) and you'll get your default. You may also want to add more parameters to myimage and pass them to image.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants