Skip to content

Commit e3d1fcf

Browse files
authored
fix: provide theme to SvgAssetLoader instead of SvgPicture (#532)
## 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)
1 parent dbc01db commit e3d1fcf

File tree

9 files changed

+9
-18
lines changed

9 files changed

+9
-18
lines changed

examples/example/lib/gen/assets.gen.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ class SvgGenImage {
318318
? AssetBytesLoader(_assetName,
319319
assetBundle: bundle, packageName: package)
320320
: SvgAssetLoader(_assetName,
321-
assetBundle: bundle, packageName: package),
321+
assetBundle: bundle, packageName: package, theme: theme),
322322
key: key,
323323
matchTextDirection: matchTextDirection,
324324
width: width,
@@ -329,7 +329,6 @@ class SvgGenImage {
329329
placeholderBuilder: placeholderBuilder,
330330
semanticsLabel: semanticsLabel,
331331
excludeFromSemantics: excludeFromSemantics,
332-
theme: theme,
333332
colorFilter: colorFilter ??
334333
(color == null ? null : ColorFilter.mode(color, colorBlendMode)),
335334
clipBehavior: clipBehavior,

examples/example_resources/lib/gen/assets.gen.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ class SvgGenImage {
186186
? AssetBytesLoader(_assetName,
187187
assetBundle: bundle, packageName: package)
188188
: SvgAssetLoader(_assetName,
189-
assetBundle: bundle, packageName: package),
189+
assetBundle: bundle, packageName: package, theme: theme),
190190
key: key,
191191
matchTextDirection: matchTextDirection,
192192
width: width,
@@ -197,7 +197,6 @@ class SvgGenImage {
197197
placeholderBuilder: placeholderBuilder,
198198
semanticsLabel: semanticsLabel,
199199
excludeFromSemantics: excludeFromSemantics,
200-
theme: theme,
201200
colorFilter: colorFilter ??
202201
(color == null ? null : ColorFilter.mode(color, colorBlendMode)),
203202
clipBehavior: clipBehavior,

packages/core/lib/generators/integrations/svg_integration.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ ${isPackage ? "\n static const String package = '$packageName';" : ''}
6262
return SvgPicture(
6363
_isVecFormat ?
6464
AssetBytesLoader(_assetName, assetBundle: bundle, packageName: package) :
65-
SvgAssetLoader(_assetName, assetBundle: bundle, packageName: package),
65+
SvgAssetLoader(_assetName, assetBundle: bundle, packageName: package, theme: theme),
6666
key: key,
6767
matchTextDirection: matchTextDirection,
6868
width: width,
@@ -73,7 +73,6 @@ ${isPackage ? "\n static const String package = '$packageName';" : ''}
7373
placeholderBuilder: placeholderBuilder,
7474
semanticsLabel: semanticsLabel,
7575
excludeFromSemantics: excludeFromSemantics,
76-
theme: theme,
7776
colorFilter: colorFilter ?? (color == null ? null : ColorFilter.mode(color, colorBlendMode)),
7877
clipBehavior: clipBehavior,
7978
cacheColorFilter: cacheColorFilter,

packages/core/test_resources/actual_data/assets.gen.dart

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/core/test_resources/actual_data/assets_directory_path.gen.dart

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/core/test_resources/actual_data/assets_package_parameter.gen.dart

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/core/test_resources/actual_data/assets_parse_metadata.gen.dart

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/core/test_resources/actual_data/assets_svg_integrations.gen.dart

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/runner/example/lib/gen/assets.gen.dart

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)