Skip to content

Add missing parameters in Lottie integration from lottie 3.0.0 #656

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

Merged
merged 4 commits into from
Feb 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,8 @@ Widget build(BuildContext context) {
| [rive](https://pub.dev/packages/rive) | .riv | `rive: true` | Assets.rive.vehicles.**rive()** |
| [lottie](https://pub.dev/packages/lottie) | .json, .zip, .lottie | `lottie: true` | Assets.lottie.hamburgerArrow.**lottie()** |

**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.

In other cases, the asset is generated as String class.

```dart
Expand Down
8 changes: 7 additions & 1 deletion examples/example/lib/gen/assets.gen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ class $AssetsLottieWrongGen {
}

class MyAssets {
MyAssets._();
const MyAssets._();

static const String readme = 'README.md';
static const $AssetsFlareGen flare = $AssetsFlareGen();
Expand Down Expand Up @@ -465,6 +465,9 @@ class LottieGenImage {
bool? addRepaintBoundary,
FilterQuality? filterQuality,
void Function(String)? onWarning,
_lottie.LottieDecoder? decoder,
_lottie.RenderCache? renderCache,
bool? backgroundLoading,
}) {
return _lottie.Lottie.asset(
_assetName,
Expand All @@ -489,6 +492,9 @@ class LottieGenImage {
addRepaintBoundary: addRepaintBoundary,
filterQuality: filterQuality,
onWarning: onWarning,
decoder: decoder,
renderCache: renderCache,
backgroundLoading: backgroundLoading,
);
}

Expand Down
2 changes: 1 addition & 1 deletion examples/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ dependencies:
path: ../example_resources

flutter_svg: ^2.0.0
lottie: ^2.0.0
lottie: ^3.0.0
rive: ^0.11.0

dev_dependencies:
Expand Down
6 changes: 6 additions & 0 deletions examples/example_resources/lib/gen/assets.gen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,9 @@ class LottieGenImage {
bool? addRepaintBoundary,
FilterQuality? filterQuality,
void Function(String)? onWarning,
_lottie.LottieDecoder? decoder,
_lottie.RenderCache? renderCache,
bool? backgroundLoading,
}) {
return _lottie.Lottie.asset(
_assetName,
Expand All @@ -329,6 +332,9 @@ class LottieGenImage {
addRepaintBoundary: addRepaintBoundary,
filterQuality: filterQuality,
onWarning: onWarning,
decoder: decoder,
renderCache: renderCache,
backgroundLoading: backgroundLoading,
);
}

Expand Down
2 changes: 1 addition & 1 deletion examples/example_resources/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ dependencies:
sdk: flutter

flutter_svg: ^2.0.0
lottie: ^2.0.0
lottie: ^3.0.0
rive: ^0.11.0

dev_dependencies:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ ${isPackage ? "\n static const String package = '$packageName';" : ''}
bool? addRepaintBoundary,
FilterQuality? filterQuality,
void Function(String)? onWarning,
_lottie.LottieDecoder? decoder,
_lottie.RenderCache? renderCache,
bool? backgroundLoading,
}) {
return _lottie.Lottie.asset(
_assetName,
Expand All @@ -98,6 +101,9 @@ ${isPackage ? "\n static const String package = '$packageName';" : ''}
addRepaintBoundary: addRepaintBoundary,
filterQuality: filterQuality,
onWarning: onWarning,
decoder: decoder,
renderCache: renderCache,
backgroundLoading: backgroundLoading,
);
}

Expand Down

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.

48 changes: 36 additions & 12 deletions packages/core/test_resources/actual_data/build_assets.gen.dart

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