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

Fixes flutter_svg latest version requiring a non null clipBehavior field. #369

Merged
merged 4 commits into from
Apr 17, 2023

Conversation

jetpeter
Copy link
Contributor

What does this change?

Fixes flutter_svg latest version requiring a non null clipBehavior field.

Fixes #368

Type of change

Please delete options that are not relevant.

  • [X ] Bug fix (non-breaking change which fixes an issue)

Checklist:

Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • [X ] Make sure to open a GitHub issue as a bug/feature request before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
    • Ensure the tests (melos run unit:test)
    • Ensure the analyzer and formatter pass (melos run format to automatically apply formatting)
  • Appropriate docs were updated (if necessary)

SvgPicture.asset expects a non null type for clipBehavior.  This creates a default value that matches SvgPicture default clipBehavior.
@jetpeter
Copy link
Contributor Author

Tests are broken for this because they expect updated files in the tests_resources/actual_data file. Is there a command that generated all of those test files, with all the different parameters? I will update this with the correct test data, but I assume it does not need to be manually done.

@wasabeef
Copy link
Member

@jetpeter
Thank you, I'll check this PR.

@jfacoustic
Copy link
Contributor

I tested your commit, but it doesn't seem to be generating the code with the nonNullable clip behavior. Any ideas what might be going on?

Added it to my pubspec like so:

  flutter_gen_runner:
    git:
      url: https://github.com/jetpeter/flutter_gen
      path: packages/runner
      ref: 785161759cf07319c59d5ecc9de4ef66662bcd95

@noga-dev
Copy link

I tested your commit, but it doesn't seem to be generating the code with the nonNullable clip behavior. Any ideas what might be going on?

Added it to my pubspec like so:

  flutter_gen_runner:
    git:
      url: https://github.com/jetpeter/flutter_gen
      path: packages/runner
      ref: 785161759cf07319c59d5ecc9de4ef66662bcd95

Can confirm. I basically had to delete the line clipBehavior: clipBehavior, from SvgGenImage.svg in assets.gen.dart

@jetpeter
Copy link
Contributor Author

jetpeter commented Mar 31, 2023

I tested your commit, but it doesn't seem to be generating the code with the nonNullable clip behavior. Any ideas what might be going on?

Added it to my pubspec like so:

  flutter_gen_runner:
    git:
      url: https://github.com/jetpeter/flutter_gen
      path: packages/runner
      ref: 785161759cf07319c59d5ecc9de4ef66662bcd95

Change was not made to flutter_gen_runner. It was made to flutter_gen_core. To get the fix you need to add

dependency_overrides:
  flutter_gen_core:
    git:
      url: https://github.com/jetpeter/flutter_gen
      path: packages/core
      ref: 785161759cf07319c59d5ecc9de4ef66662bcd95

below your dev_dependencies: block.
You don't actually need to override flutter_gen_runner since there are not changes to it.

@jetpeter jetpeter marked this pull request as ready for review March 31, 2023 18:42
@jetpeter jetpeter requested a review from wasabeef as a code owner March 31, 2023 18:42
@jetpeter
Copy link
Contributor Author

I updated the test files to reflect the changes in flutter_svg. This should be good to go now.

@noga-dev
Copy link

I tested your commit, but it doesn't seem to be generating the code with the nonNullable clip behavior. Any ideas what might be going on?
Added it to my pubspec like so:

  flutter_gen_runner:
    git:
      url: https://github.com/jetpeter/flutter_gen
      path: packages/runner
      ref: 785161759cf07319c59d5ecc9de4ef66662bcd95

Change was not made to flutter_gen_runner. It was made to flutter_gen_core. To get the fix you need to add

dependency_overrides:
  flutter_gen_core:
    git:
      url: https://github.com/jetpeter/flutter_gen
      path: packages/core
      ref: 785161759cf07319c59d5ecc9de4ef66662bcd95

below your dev_dependencies: block. You don't actually need to override flutter_gen_runner since there are not changes to it.

Oops, didn't notice the changes we're in the core package. Thanks. LGTM.

@wasabeef
Copy link
Member

@jetpeter @szelemeh @jetpeter @noga-dev

Thank you, I will release a new version today.

@codecov
Copy link

codecov bot commented Apr 17, 2023

Codecov Report

Merging #369 (9522955) into main (ef79ae8) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##             main     #369   +/-   ##
=======================================
  Coverage   98.26%   98.26%           
=======================================
  Files          20       20           
  Lines         693      693           
=======================================
  Hits          681      681           
  Misses         12       12           
Impacted Files Coverage Δ
...e/lib/generators/integrations/svg_integration.dart 100.00% <ø> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@wasabeef wasabeef merged commit ef7ba1f into FlutterGen:main Apr 17, 2023
@wasabeef wasabeef mentioned this pull request Apr 18, 2023
@wasabeef wasabeef added this to the 5.3.0 milestone Apr 18, 2023
@wasabeef
Copy link
Member

@jetpeter @jfacoustic @noga-dev @szelemeh

I just released v5.3.0. Sorry I kept you waiting.

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

Successfully merging this pull request may close these issues.

[BUG]: SvgPicture.asset generated code not compatible with latest flutter_svg
5 participants