Compare commits

..

1 Commits

Author SHA1 Message Date
ef06d63040 Disable merge paths by default (#72) 2020-06-01 16:41:10 +02:00
69 changed files with 119176 additions and 10 deletions

View File

@ -1,3 +1,16 @@
## [0.4.0]
- Disable "Merge paths" by default and provide an option to enable them.
This is the same behavior as in Lottie-android.
Merge paths currently don't work if the the operand shape is entirely contained within the
first shape. If you need to cut out one shape from another shape, use an even-odd fill type
instead of using merge paths.
Merge paths can be enabled with:
```dart
Lottie.asset('file.json', options: LottieOptions(enableMergePaths: true));
```
## [0.3.6]
- Export the `Marker` class

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,833 @@
{
"v": "5.6.9",
"fr": 25,
"ip": 0,
"op": 75,
"w": 1200,
"h": 1200,
"nm": "Character-side v1",
"ddd": 0,
"assets": [
{
"id": "image_0",
"w": 1200,
"h": 1200,
"u": "images/",
"p": "img_0.png",
"e": 0
},
{
"id": "image_1",
"w": 1200,
"h": 1200,
"u": "images/",
"p": "img_1.png",
"e": 0
},
{
"id": "image_2",
"w": 1200,
"h": 1200,
"u": "images/",
"p": "img_2.png",
"e": 0
},
{
"id": "image_3",
"w": 1200,
"h": 1200,
"u": "images/",
"p": "img_3.png",
"e": 0
},
{
"id": "image_4",
"w": 1200,
"h": 1200,
"u": "images/",
"p": "img_4.png",
"e": 0
},
{
"id": "image_5",
"w": 1200,
"h": 1200,
"u": "images/",
"p": "img_5.png",
"e": 0
},
{
"id": "image_6",
"w": 1200,
"h": 1200,
"u": "images/",
"p": "img_6.png",
"e": 0
},
{
"id": "image_7",
"w": 1200,
"h": 1200,
"u": "images/",
"p": "img_7.png",
"e": 0
},
{
"id": "image_8",
"w": 1200,
"h": 1200,
"u": "images/",
"p": "img_8.png",
"e": 0
},
{
"id": "image_9",
"w": 1200,
"h": 1200,
"u": "images/",
"p": "img_9.png",
"e": 0
}
],
"layers": [
{
"ddd": 0,
"ind": 2,
"ty": 2,
"nm": "F ARM Up",
"parent": 8,
"refId": "image_0",
"sr": 1,
"ks": {
"o": {
"a": 0,
"k": 100,
"ix": 11
},
"r": {
"a": 1,
"k": [
{
"i": {
"x": [
0.333
],
"y": [
1
]
},
"o": {
"x": [
0.667
],
"y": [
0
]
},
"t": 0,
"s": [
0
]
},
{
"i": {
"x": [
0.333
],
"y": [
1
]
},
"o": {
"x": [
0.667
],
"y": [
0
]
},
"t": 25,
"s": [
67
]
},
{
"t": 50,
"s": [
0
]
}
],
"ix": 10
},
"p": {
"a": 0,
"k": [
623.019,
296.734,
0
],
"ix": 2
},
"a": {
"a": 0,
"k": [
623.019,
296.734,
0
],
"ix": 1
},
"s": {
"a": 0,
"k": [
100,
100,
100
],
"ix": 6
}
},
"ao": 0,
"ip": 0,
"op": 250,
"st": 0,
"bm": 0
},
{
"ddd": 0,
"ind": 3,
"ty": 2,
"nm": "F ARM Low",
"parent": 2,
"refId": "image_1",
"sr": 1,
"ks": {
"o": {
"a": 0,
"k": 100,
"ix": 11
},
"r": {
"a": 1,
"k": [
{
"i": {
"x": [
0.333
],
"y": [
1
]
},
"o": {
"x": [
0.667
],
"y": [
0
]
},
"t": 0,
"s": [
43
]
},
{
"i": {
"x": [
0.333
],
"y": [
1
]
},
"o": {
"x": [
0.667
],
"y": [
0
]
},
"t": 25,
"s": [
0
]
},
{
"t": 50,
"s": [
43
]
}
],
"ix": 10
},
"p": {
"a": 0,
"k": [
623.019,
439.113,
0
],
"ix": 2
},
"a": {
"a": 0,
"k": [
623.019,
439.113,
0
],
"ix": 1
},
"s": {
"a": 0,
"k": [
100,
100,
100
],
"ix": 6
}
},
"ao": 0,
"ip": 0,
"op": 250,
"st": 0,
"bm": 0
},
{
"ddd": 0,
"ind": 4,
"ty": 2,
"nm": "F Hand",
"parent": 3,
"refId": "image_2",
"sr": 1,
"ks": {
"o": {
"a": 0,
"k": 100,
"ix": 11
},
"r": {
"a": 1,
"k": [
{
"i": {
"x": [
0.333
],
"y": [
1
]
},
"o": {
"x": [
0.667
],
"y": [
0
]
},
"t": 0,
"s": [
41
]
},
{
"i": {
"x": [
0.333
],
"y": [
1
]
},
"o": {
"x": [
0.667
],
"y": [
0
]
},
"t": 25,
"s": [
0
]
},
{
"t": 50,
"s": [
41
]
}
],
"ix": 10
},
"p": {
"a": 0,
"k": [
623.019,
584.501,
0
],
"ix": 2
},
"a": {
"a": 0,
"k": [
623.019,
584.501,
0
],
"ix": 1
},
"s": {
"a": 0,
"k": [
100,
100,
100
],
"ix": 6
}
},
"ao": 0,
"ip": 0,
"op": 250,
"st": 0,
"bm": 0
},
{
"ddd": 0,
"ind": 5,
"ty": 2,
"nm": "F LEG Up",
"refId": "image_3",
"sr": 1,
"ks": {
"o": {
"a": 0,
"k": 100,
"ix": 11
},
"r": {
"a": 0,
"k": 90,
"ix": 10
},
"p": {
"a": 0,
"k": [
604.854,
589.662,
0
],
"ix": 2
},
"a": {
"a": 0,
"k": [
604.854,
589.662,
0
],
"ix": 1
},
"s": {
"a": 0,
"k": [
100,
100,
100
],
"ix": 6
}
},
"ao": 0,
"ip": 0,
"op": 250,
"st": 0,
"bm": 0
},
{
"ddd": 0,
"ind": 6,
"ty": 2,
"nm": "F LEG Low",
"parent": 5,
"refId": "image_4",
"sr": 1,
"ks": {
"o": {
"a": 0,
"k": 100,
"ix": 11
},
"r": {
"a": 0,
"k": -90,
"ix": 10
},
"p": {
"a": 0,
"k": [
608.016,
829.202,
0
],
"ix": 2
},
"a": {
"a": 0,
"k": [
608.016,
829.202,
0
],
"ix": 1
},
"s": {
"a": 0,
"k": [
100,
100,
100
],
"ix": 6
}
},
"ao": 0,
"ip": 0,
"op": 250,
"st": 0,
"bm": 0
},
{
"ddd": 0,
"ind": 7,
"ty": 2,
"nm": "F Foot",
"parent": 6,
"refId": "image_5",
"sr": 1,
"ks": {
"o": {
"a": 0,
"k": 100,
"ix": 11
},
"r": {
"a": 0,
"k": 0,
"ix": 10
},
"p": {
"a": 0,
"k": [
608.863,
1058.742,
0
],
"ix": 2
},
"a": {
"a": 0,
"k": [
608.863,
1058.742,
0
],
"ix": 1
},
"s": {
"a": 0,
"k": [
100,
100,
100
],
"ix": 6
}
},
"ao": 0,
"ip": 0,
"op": 250,
"st": 0,
"bm": 0
},
{
"ddd": 0,
"ind": 8,
"ty": 2,
"nm": "Body",
"parent": 11,
"refId": "image_6",
"sr": 1,
"ks": {
"o": {
"a": 0,
"k": 100,
"ix": 11
},
"r": {
"a": 0,
"k": 0,
"ix": 10
},
"p": {
"a": 0,
"k": [
605.434,
468.468,
0
],
"ix": 2
},
"a": {
"a": 0,
"k": [
605.434,
468.468,
0
],
"ix": 1
},
"s": {
"a": 0,
"k": [
100,
100,
100
],
"ix": 6
}
},
"ao": 0,
"ip": 0,
"op": 250,
"st": 0,
"bm": 0
},
{
"ddd": 0,
"ind": 9,
"ty": 2,
"nm": "Head",
"parent": 8,
"refId": "image_7",
"sr": 1,
"ks": {
"o": {
"a": 0,
"k": 100,
"ix": 11
},
"r": {
"a": 0,
"k": 0,
"ix": 10
},
"p": {
"a": 0,
"k": [
623.019,
263.511,
0
],
"ix": 2
},
"a": {
"a": 0,
"k": [
623.019,
263.511,
0
],
"ix": 1
},
"s": {
"a": 0,
"k": [
100,
100,
100
],
"ix": 6
}
},
"ao": 0,
"ip": 0,
"op": 250,
"st": 0,
"bm": 0
},
{
"ddd": 0,
"ind": 10,
"ty": 2,
"nm": "Hair",
"parent": 9,
"refId": "image_8",
"sr": 1,
"ks": {
"o": {
"a": 0,
"k": 100,
"ix": 11
},
"r": {
"a": 0,
"k": 0,
"ix": 10
},
"p": {
"a": 0,
"k": [
600,
600,
0
],
"ix": 2
},
"a": {
"a": 0,
"k": [
600,
600,
0
],
"ix": 1
},
"s": {
"a": 0,
"k": [
100,
100,
100
],
"ix": 6
}
},
"ao": 0,
"ip": 0,
"op": 250,
"st": 0,
"bm": 0
},
{
"ddd": 0,
"ind": 11,
"ty": 2,
"nm": "Waist",
"refId": "image_9",
"sr": 1,
"ks": {
"o": {
"a": 0,
"k": 100,
"ix": 11
},
"r": {
"a": 1,
"k": [
{
"i": {
"x": [
0.333
],
"y": [
1
]
},
"o": {
"x": [
0.667
],
"y": [
0
]
},
"t": 0,
"s": [
0
]
},
{
"i": {
"x": [
0.333
],
"y": [
1
]
},
"o": {
"x": [
0.667
],
"y": [
0
]
},
"t": 25,
"s": [
-70
]
},
{
"t": 50,
"s": [
0
]
}
],
"ix": 10
},
"p": {
"a": 0,
"k": [
604.854,
589.662,
0
],
"ix": 2
},
"a": {
"a": 0,
"k": [
604.854,
589.662,
0
],
"ix": 1
},
"s": {
"a": 0,
"k": [
100,
100,
100
],
"ix": 6
}
},
"ao": 0,
"ip": 0,
"op": 250,
"st": 0,
"bm": 0
}
],
"markers": [
{
"tm": 25,
"cm": "9",
"dr": 0
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 24.1.2, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 1200 1200" style="enable-background:new 0 0 1200 1200;" xml:space="preserve">
<style type="text/css">
.st0{fill:#FFA913;}
</style>
<path class="st0" d="M641.59,439.11l7.69-142.38c0-14.5-11.76-26.26-26.26-26.26c-14.5,0-26.26,11.76-26.26,26.26l7.69,142.38
c0,10.26,8.31,18.57,18.57,18.57C633.28,457.68,641.59,449.37,641.59,439.11z"/>
</svg>

After

Width:  |  Height:  |  Size: 616 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

118232
example/assets/playing.json Normal file

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,7 @@
// Generated from tool/generate_file_list.dart
final files = [
'assets/14595-thumbs-up.json',
'assets/17297-fireworks.json',
'assets/AndroidWave.json',
'assets/DynamicGradient.json',
'assets/HamburgerArrow.json',
@ -106,6 +107,10 @@ final files = [
'assets/Tests/dalek_converted.json',
'assets/Tests/hd.json',
'assets/Tests/map.zip',
'assets/TwitterHeartButton.json',
'assets/_loading_indicator.json',
'assets/bluetoothscanning.json',
'assets/example_with_images/data.json',
'assets/lf20_w2Afea.json',
'assets/lottiefiles/100_percent.json',
'assets/lottiefiles/Plane.json',
@ -340,4 +345,11 @@ final files = [
'assets/lottiefiles/xuanwheel_logo.json',
'assets/lottiefiles/yoga_carpet.json',
'assets/lottiefiles/youtube_icon_reveal.json',
'assets/playing.json',
'assets/weather/_hurricane.json',
'assets/weather/fog.json',
'assets/weather/hurricane.json',
'assets/weather/thunder-storm.json',
'assets/weather/tornado.json',
'assets/weather/windy.json',
];

View File

@ -129,7 +129,7 @@ packages:
path: ".."
relative: true
source: path
version: "0.3.6"
version: "0.4.0"
matcher:
dependency: transitive
description:

View File

@ -35,6 +35,8 @@ flutter:
- assets/Images/
- assets/Images/WeAccept/
- assets/Weather/
- assets/example_with_images/
- assets/example_with_images/images/
fonts:
- family: Comic Neue

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 884 B

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 87 KiB

After

Width:  |  Height:  |  Size: 91 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 53 KiB

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.1 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 884 B

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 52 KiB

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 138 KiB

After

Width:  |  Height:  |  Size: 139 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

View File

@ -5,6 +5,7 @@ export 'src/lottie_delegates.dart' show LottieDelegates;
export 'src/lottie_drawable.dart' show LottieDrawable, LottieFontStyle;
export 'src/lottie_image_asset.dart' show LottieImageAsset;
export 'src/model/marker.dart' show Marker;
export 'src/options.dart' show LottieOptions;
export 'src/providers/asset_provider.dart' show AssetLottie;
export 'src/providers/file_provider.dart' show FileLottie;
export 'src/providers/lottie_provider.dart' show LottieProvider;

View File

@ -5,6 +5,7 @@ import 'package:flutter/widgets.dart';
import '../lottie.dart';
import 'l.dart';
import 'lottie_builder.dart';
import 'options.dart';
import 'providers/load_image.dart';
/// A widget to display a loaded [LottieComposition].
@ -25,6 +26,7 @@ class Lottie extends StatefulWidget {
bool repeat,
bool reverse,
this.delegates,
this.options,
}) : animate = animate ?? true,
reverse = reverse ?? false,
repeat = repeat ?? true,
@ -37,6 +39,7 @@ class Lottie extends StatefulWidget {
bool repeat,
bool reverse,
LottieDelegates delegates,
LottieOptions options,
void Function(LottieComposition) onLoaded,
LottieImageProviderFactory imageProviderFactory,
Key key,
@ -54,6 +57,7 @@ class Lottie extends StatefulWidget {
repeat: repeat,
reverse: reverse,
delegates: delegates,
options: options,
imageProviderFactory: imageProviderFactory,
onLoaded: onLoaded,
key: key,
@ -74,6 +78,7 @@ class Lottie extends StatefulWidget {
bool repeat,
bool reverse,
LottieDelegates delegates,
LottieOptions options,
LottieImageProviderFactory imageProviderFactory,
void Function(LottieComposition) onLoaded,
Key key,
@ -90,6 +95,7 @@ class Lottie extends StatefulWidget {
repeat: repeat,
reverse: reverse,
delegates: delegates,
options: options,
imageProviderFactory: imageProviderFactory,
onLoaded: onLoaded,
key: key,
@ -108,6 +114,7 @@ class Lottie extends StatefulWidget {
bool repeat,
bool reverse,
LottieDelegates delegates,
LottieOptions options,
LottieImageProviderFactory imageProviderFactory,
void Function(LottieComposition) onLoaded,
Key key,
@ -124,6 +131,7 @@ class Lottie extends StatefulWidget {
repeat: repeat,
reverse: reverse,
delegates: delegates,
options: options,
imageProviderFactory: imageProviderFactory,
onLoaded: onLoaded,
key: key,
@ -142,6 +150,7 @@ class Lottie extends StatefulWidget {
bool repeat,
bool reverse,
LottieDelegates delegates,
LottieOptions options,
LottieImageProviderFactory imageProviderFactory,
void Function(LottieComposition) onLoaded,
Key key,
@ -158,6 +167,7 @@ class Lottie extends StatefulWidget {
repeat: repeat,
reverse: reverse,
delegates: delegates,
options: options,
imageProviderFactory: imageProviderFactory,
onLoaded: onLoaded,
key: key,
@ -229,13 +239,17 @@ class Lottie extends StatefulWidget {
/// relative to text direction.
final AlignmentGeometry alignment;
/// A group of options to further customize the lottie animation.
/// A group of callbacks to further customize the lottie animation.
/// - A [text] delegate to dynamically change some text displayed in the animation
/// - A value callback to change the properties of the animation at runtime.
/// - A text style factory to map between a font family specified in the animation
/// and the font family in your assets.
final LottieDelegates delegates;
/// Some options to enable/disable some feature of Lottie
/// - enableMergePaths: Enable merge path support
final LottieOptions options;
static bool get traceEnabled => L.traceEnabled;
static set traceEnabled(bool enabled) {
L.traceEnabled = enabled;
@ -295,6 +309,7 @@ class _LottieState extends State<Lottie> with TickerProviderStateMixin {
builder: (context, _) => RawLottie(
composition: widget.composition,
delegates: widget.delegates,
options: widget.options,
progress: _progressAnimation.value,
width: widget.width,
height: widget.height,

View File

@ -40,6 +40,7 @@ class LottieBuilder extends StatefulWidget {
this.reverse,
this.repeat,
this.delegates,
this.options,
this.onLoaded,
this.frameBuilder,
this.width,
@ -58,6 +59,7 @@ class LottieBuilder extends StatefulWidget {
this.reverse,
this.repeat,
this.delegates,
this.options,
LottieImageProviderFactory imageProviderFactory,
this.onLoaded,
Key key,
@ -87,6 +89,7 @@ class LottieBuilder extends StatefulWidget {
this.reverse,
this.repeat,
this.delegates,
this.options,
LottieImageProviderFactory imageProviderFactory,
this.onLoaded,
Key key,
@ -106,6 +109,7 @@ class LottieBuilder extends StatefulWidget {
this.reverse,
this.repeat,
this.delegates,
this.options,
LottieImageProviderFactory imageProviderFactory,
this.onLoaded,
Key key,
@ -130,6 +134,7 @@ class LottieBuilder extends StatefulWidget {
this.reverse,
this.repeat,
this.delegates,
this.options,
LottieImageProviderFactory imageProviderFactory,
this.onLoaded,
Key key,
@ -180,6 +185,10 @@ class LottieBuilder extends StatefulWidget {
/// and the font family in your assets.
final LottieDelegates delegates;
/// Some options to enable/disable some feature of Lottie
/// - enableMergePaths: Enable merge path support
final LottieOptions options;
/// A builder function responsible for creating the widget that represents
/// this lottie animation.
///
@ -379,6 +388,7 @@ class _LottieBuilderState extends State<LottieBuilder> {
reverse: widget.reverse,
repeat: widget.repeat,
delegates: widget.delegates,
options: widget.options,
width: widget.width,
height: widget.height,
fit: widget.fit,

View File

@ -15,10 +15,13 @@ class LottieDrawable {
final Size size;
LottieDelegates _delegates;
bool _isDirty = true;
final bool enableMergePaths;
LottieDrawable(this.composition, {LottieDelegates delegates})
LottieDrawable(this.composition,
{LottieDelegates delegates, bool enableMergePaths})
: size = Size(composition.bounds.width.toDouble(),
composition.bounds.height.toDouble()) {
composition.bounds.height.toDouble()),
enableMergePaths = enableMergePaths ?? false {
this.delegates = delegates;
_compositionLayer = CompositionLayer(
this, LayerParser.parse(composition), composition.layers, composition);

View File

@ -1,5 +1,6 @@
import '../../animation/content/content.dart';
import '../../animation/content/merge_paths_content.dart';
import '../../logger.dart';
import '../../lottie_drawable.dart';
import '../layer/base_layer.dart';
import 'content_model.dart';
@ -15,6 +16,10 @@ class MergePaths implements ContentModel {
@override
Content /*?*/ toContent(LottieDrawable drawable, BaseLayer layer) {
if (!drawable.enableMergePaths) {
logger.warning('Animation contains merge paths but they are disabled.');
return null;
}
return MergePathsContent(this);
}

11
lib/src/options.dart Normal file
View File

@ -0,0 +1,11 @@
class LottieOptions {
/// Enable merge path support.
///
/// Merge paths currently don't work if the the operand shape is entirely contained within the
/// first shape. If you need to cut out one shape from another shape, use an even-odd fill type
/// instead of using merge paths.
final bool enableMergePaths;
LottieOptions({bool enableMergePaths})
: enableMergePaths = enableMergePaths ?? false;
}

View File

@ -85,6 +85,8 @@ class ContentModelParser {
break;
case 'mm':
model = MergePathsParser.parse(reader);
composition.addWarning('Animation contains merge paths. '
'Merge paths must be manually enabled by settings enableMergePaths.');
break;
case 'rp':
model = RepeaterParser.parse(reader, composition);

View File

@ -122,6 +122,7 @@ class LayerParser {
if (layerTypeInt < LayerType.unknown.index) {
layerType = LayerType.values[layerTypeInt];
} else {
print('Unknown $layerTypeInt');
layerType = LayerType.unknown;
}
break;

View File

@ -13,6 +13,7 @@ class RawLottie extends LeafRenderObjectWidget {
Key key,
this.composition,
this.delegates,
this.options,
double progress,
this.width,
this.height,
@ -28,6 +29,8 @@ class RawLottie extends LeafRenderObjectWidget {
/// Allows to modify the Lottie animation at runtime
final LottieDelegates delegates;
final LottieOptions options;
/// The progress of the Lottie animation (between 0.0 and 1.0).
final double progress;
@ -71,6 +74,7 @@ class RawLottie extends LeafRenderObjectWidget {
return RenderLottie(
composition: composition,
delegates: delegates,
enableMergePaths: options?.enableMergePaths,
progress: progress,
width: width,
height: height,
@ -82,7 +86,10 @@ class RawLottie extends LeafRenderObjectWidget {
@override
void updateRenderObject(BuildContext context, RenderLottie renderObject) {
renderObject
..setComposition(composition, progress: progress, delegates: delegates)
..setComposition(composition,
progress: progress,
delegates: delegates,
enableMergePaths: options?.enableMergePaths)
..width = width
..height = height
..alignment = alignment

View File

@ -11,6 +11,7 @@ class RenderLottie extends RenderBox {
RenderLottie({
LottieComposition composition,
LottieDelegates delegates,
bool enableMergePaths,
double progress = 0.0,
double width,
double height,
@ -19,7 +20,7 @@ class RenderLottie extends RenderBox {
}) : assert(alignment != null),
assert(progress != null && progress >= 0.0 && progress <= 1.0),
_drawable = composition != null
? (LottieDrawable(composition)
? (LottieDrawable(composition, enableMergePaths: enableMergePaths)
..setProgress(progress)
..delegates = delegates)
: null,
@ -32,7 +33,11 @@ class RenderLottie extends RenderBox {
LottieComposition get composition => _drawable?.composition;
LottieDrawable _drawable;
void setComposition(LottieComposition composition,
{@required double progress, @required LottieDelegates delegates}) {
{@required double progress,
@required LottieDelegates delegates,
bool enableMergePaths}) {
enableMergePaths ??= false;
var needsLayout = false;
var needsPaint = false;
if (composition == null) {
@ -40,8 +45,11 @@ class RenderLottie extends RenderBox {
needsPaint = true;
needsLayout = true;
} else {
if (_drawable?.composition != composition) {
_drawable = LottieDrawable(composition);
if (_drawable == null ||
_drawable.composition != composition ||
_drawable.enableMergePaths != enableMergePaths) {
_drawable =
LottieDrawable(composition, enableMergePaths: enableMergePaths);
needsLayout = true;
needsPaint = true;
}

View File

@ -1,6 +1,6 @@
name: lottie
description: Render After Effects animations natively on Flutter. This package is a pure Dart implementation of a Lottie player.
version: 0.3.6
version: 0.4.0
homepage: https://github.com/xvrh/lottie-flutter
environment: