Skip to content

Commit

Permalink
fix: provide theme to SvgAssetLoader instead of SvgPicture (#532)
Browse files Browse the repository at this point in the history
## What does this change?

Since version 5.5.0+1, the `SvgTheme` no longer works. It doesn't work because flutter_svg has deprecated using the `theme` with the `SvgPicture` constructor, and suggests that you pass the theme to the bytes loader instead.

Fixes #531  🎯

## Type of change

- [x] Bug fix (non-breaking change which fixes an issue)
  • Loading branch information
Kirpal committed Jun 22, 2024
1 parent dbc01db commit e3d1fcf
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 18 deletions.
3 changes: 1 addition & 2 deletions examples/example/lib/gen/assets.gen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ class SvgGenImage {
? AssetBytesLoader(_assetName,
assetBundle: bundle, packageName: package)
: SvgAssetLoader(_assetName,
assetBundle: bundle, packageName: package),
assetBundle: bundle, packageName: package, theme: theme),
key: key,
matchTextDirection: matchTextDirection,
width: width,
Expand All @@ -329,7 +329,6 @@ class SvgGenImage {
placeholderBuilder: placeholderBuilder,
semanticsLabel: semanticsLabel,
excludeFromSemantics: excludeFromSemantics,
theme: theme,
colorFilter: colorFilter ??
(color == null ? null : ColorFilter.mode(color, colorBlendMode)),
clipBehavior: clipBehavior,
Expand Down
3 changes: 1 addition & 2 deletions examples/example_resources/lib/gen/assets.gen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ class SvgGenImage {
? AssetBytesLoader(_assetName,
assetBundle: bundle, packageName: package)
: SvgAssetLoader(_assetName,
assetBundle: bundle, packageName: package),
assetBundle: bundle, packageName: package, theme: theme),
key: key,
matchTextDirection: matchTextDirection,
width: width,
Expand All @@ -197,7 +197,6 @@ class SvgGenImage {
placeholderBuilder: placeholderBuilder,
semanticsLabel: semanticsLabel,
excludeFromSemantics: excludeFromSemantics,
theme: theme,
colorFilter: colorFilter ??
(color == null ? null : ColorFilter.mode(color, colorBlendMode)),
clipBehavior: clipBehavior,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ ${isPackage ? "\n static const String package = '$packageName';" : ''}
return SvgPicture(
_isVecFormat ?
AssetBytesLoader(_assetName, assetBundle: bundle, packageName: package) :
SvgAssetLoader(_assetName, assetBundle: bundle, packageName: package),
SvgAssetLoader(_assetName, assetBundle: bundle, packageName: package, theme: theme),
key: key,
matchTextDirection: matchTextDirection,
width: width,
Expand All @@ -73,7 +73,6 @@ ${isPackage ? "\n static const String package = '$packageName';" : ''}
placeholderBuilder: placeholderBuilder,
semanticsLabel: semanticsLabel,
excludeFromSemantics: excludeFromSemantics,
theme: theme,
colorFilter: colorFilter ?? (color == null ? null : ColorFilter.mode(color, colorBlendMode)),
clipBehavior: clipBehavior,
cacheColorFilter: cacheColorFilter,
Expand Down
3 changes: 1 addition & 2 deletions packages/core/test_resources/actual_data/assets.gen.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions packages/runner/example/lib/gen/assets.gen.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e3d1fcf

Please sign in to comment.