Skip to content

Commit 209aced

Browse files
authored
Add missing parameters in Lottie integration from lottie 3.0.0 (#656)
## What does this change? - This MR will add missing parameters in Lottie Integration from [lottie's release 3.0.0](https://github.com/xvrh/lottie-flutter/releases/tag/v3.0.0) - chore: I also updated actual test data after running test ## Type of change - [x] New feature (non-breaking change which adds functionality) functionality to not work as expected) - [x] This change requires a documentation update
1 parent 89e32fe commit 209aced

File tree

9 files changed

+92
-33
lines changed

9 files changed

+92
-33
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,8 @@ Widget build(BuildContext context) {
410410
| [rive](https://pub.dev/packages/rive) | .riv | `rive: true` | Assets.rive.vehicles.**rive()** |
411411
| [lottie](https://pub.dev/packages/lottie) | .json, .zip, .lottie | `lottie: true` | Assets.lottie.hamburgerArrow.**lottie()** |
412412

413+
**Note:** For [lottie](https://pub.dev/packages/lottie) integration with `.lottie` files, you must add a custom decoder via `decoder` parameter to select the correct .json file from a dotlottie (.lottie) archive, see [lottie's document](https://pub.dev/packages/lottie#telegram-stickers-tgs-and-dotlottie-lottie) for more information.
414+
413415
In other cases, the asset is generated as String class.
414416

415417
```dart

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ class $AssetsLottieWrongGen {
215215
}
216216

217217
class MyAssets {
218-
MyAssets._();
218+
const MyAssets._();
219219

220220
static const String readme = 'README.md';
221221
static const $AssetsFlareGen flare = $AssetsFlareGen();
@@ -465,6 +465,9 @@ class LottieGenImage {
465465
bool? addRepaintBoundary,
466466
FilterQuality? filterQuality,
467467
void Function(String)? onWarning,
468+
_lottie.LottieDecoder? decoder,
469+
_lottie.RenderCache? renderCache,
470+
bool? backgroundLoading,
468471
}) {
469472
return _lottie.Lottie.asset(
470473
_assetName,
@@ -489,6 +492,9 @@ class LottieGenImage {
489492
addRepaintBoundary: addRepaintBoundary,
490493
filterQuality: filterQuality,
491494
onWarning: onWarning,
495+
decoder: decoder,
496+
renderCache: renderCache,
497+
backgroundLoading: backgroundLoading,
492498
);
493499
}
494500

examples/example/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ dependencies:
1414
path: ../example_resources
1515

1616
flutter_svg: ^2.0.0
17-
lottie: ^2.0.0
17+
lottie: ^3.0.0
1818
rive: ^0.11.0
1919

2020
dev_dependencies:

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,9 @@ class LottieGenImage {
305305
bool? addRepaintBoundary,
306306
FilterQuality? filterQuality,
307307
void Function(String)? onWarning,
308+
_lottie.LottieDecoder? decoder,
309+
_lottie.RenderCache? renderCache,
310+
bool? backgroundLoading,
308311
}) {
309312
return _lottie.Lottie.asset(
310313
_assetName,
@@ -329,6 +332,9 @@ class LottieGenImage {
329332
addRepaintBoundary: addRepaintBoundary,
330333
filterQuality: filterQuality,
331334
onWarning: onWarning,
335+
decoder: decoder,
336+
renderCache: renderCache,
337+
backgroundLoading: backgroundLoading,
332338
);
333339
}
334340

examples/example_resources/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ dependencies:
1111
sdk: flutter
1212

1313
flutter_svg: ^2.0.0
14-
lottie: ^2.0.0
14+
lottie: ^3.0.0
1515
rive: ^0.11.0
1616

1717
dev_dependencies:

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ ${isPackage ? "\n static const String package = '$packageName';" : ''}
7474
bool? addRepaintBoundary,
7575
FilterQuality? filterQuality,
7676
void Function(String)? onWarning,
77+
_lottie.LottieDecoder? decoder,
78+
_lottie.RenderCache? renderCache,
79+
bool? backgroundLoading,
7780
}) {
7881
return _lottie.Lottie.asset(
7982
_assetName,
@@ -98,6 +101,9 @@ ${isPackage ? "\n static const String package = '$packageName';" : ''}
98101
addRepaintBoundary: addRepaintBoundary,
99102
filterQuality: filterQuality,
100103
onWarning: onWarning,
104+
decoder: decoder,
105+
renderCache: renderCache,
106+
backgroundLoading: backgroundLoading,
101107
);
102108
}
103109

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

Lines changed: 17 additions & 8 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_no_integrations.gen.dart

Lines changed: 16 additions & 10 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/build_assets.gen.dart

Lines changed: 36 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)