Compare commits

...

3 Commits

Author SHA1 Message Date
0e7499d82e Allow AlignmentGeometry for alignment (#228)
Thanks for the contribution
2022-08-03 11:52:58 +02:00
4cd9ec759a Update publish-on-pub action 2022-07-27 11:15:31 +02:00
d8f5b872ef [feat] support image layer quality setting (#214) 2022-07-27 11:11:26 +02:00
28 changed files with 159 additions and 107 deletions

View File

@ -8,9 +8,9 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- uses: subosito/flutter-action@v1 - uses: subosito/flutter-action@v2
with: with:
channel: 'beta' channel: 'stable'
- run: flutter pub get - run: flutter pub get
- run: flutter pub run tool/publish/comment_dependency_overrides.dart - run: flutter pub run tool/publish/comment_dependency_overrides.dart
- run: flutter pub get - run: flutter pub get

View File

@ -1,3 +1,9 @@
## [1.4.1]
- Allow `AlignmentGeometry` for `alignment`.
## [1.4.0]
- Added `filterQuality` property to control the performance vs quality trade-off to use when drawing images
## [1.3.0] ## [1.3.0]
- Added support for rounded corners on shapes and rects - Added support for rounded corners on shapes and rects
- Add support for text in dynamic properties (`ValueDelegate`) - Add support for text in dynamic properties (`ValueDelegate`)

View File

@ -64,7 +64,7 @@ class MyApp extends StatefulWidget {
const MyApp({Key? key}) : super(key: key); const MyApp({Key? key}) : super(key: key);
@override @override
_MyAppState createState() => _MyAppState(); State<MyApp> createState() => _MyAppState();
} }
class _MyAppState extends State<MyApp> with TickerProviderStateMixin { class _MyAppState extends State<MyApp> with TickerProviderStateMixin {
@ -139,7 +139,7 @@ class MyWidget extends StatefulWidget {
const MyWidget({Key? key}) : super(key: key); const MyWidget({Key? key}) : super(key: key);
@override @override
_MyWidgetState createState() => _MyWidgetState(); State<MyWidget> createState() => _MyWidgetState();
} }
class _MyWidgetState extends State<MyWidget> { class _MyWidgetState extends State<MyWidget> {

View File

@ -25,7 +25,7 @@ class __PageState extends State<_Page> {
void initState() { void initState() {
super.initState(); super.initState();
SchedulerBinding.instance!.addPostFrameCallback((_) => _showLoader()); SchedulerBinding.instance.addPostFrameCallback((_) => _showLoader());
} }
void _showLoader() { void _showLoader() {

View File

@ -7,7 +7,7 @@ class MyApp extends StatefulWidget {
const MyApp({Key? key}) : super(key: key); const MyApp({Key? key}) : super(key: key);
@override @override
_MyAppState createState() => _MyAppState(); State<MyApp> createState() => _MyAppState();
} }
class _MyAppState extends State<MyApp> with TickerProviderStateMixin { class _MyAppState extends State<MyApp> with TickerProviderStateMixin {

View File

@ -15,7 +15,7 @@ class MyApp extends StatefulWidget {
const MyApp({Key? key}) : super(key: key); const MyApp({Key? key}) : super(key: key);
@override @override
_MyAppState createState() => _MyAppState(); State<MyApp> createState() => _MyAppState();
} }
class _MyAppState extends State<MyApp> with TickerProviderStateMixin { class _MyAppState extends State<MyApp> with TickerProviderStateMixin {

View File

@ -21,7 +21,7 @@ class MyWidget extends StatefulWidget {
const MyWidget({Key? key}) : super(key: key); const MyWidget({Key? key}) : super(key: key);
@override @override
_MyWidgetState createState() => _MyWidgetState(); State<MyWidget> createState() => _MyWidgetState();
} }
class _MyWidgetState extends State<MyWidget> { class _MyWidgetState extends State<MyWidget> {

View File

@ -22,7 +22,7 @@ class MyWidget extends StatefulWidget {
const MyWidget({Key? key}) : super(key: key); const MyWidget({Key? key}) : super(key: key);
@override @override
_MyWidgetState createState() => _MyWidgetState(); State<MyWidget> createState() => _MyWidgetState();
} }
class _MyWidgetState extends State<MyWidget> { class _MyWidgetState extends State<MyWidget> {

View File

@ -10,7 +10,7 @@ class App extends StatefulWidget {
const App({Key? key}) : super(key: key); const App({Key? key}) : super(key: key);
@override @override
_AppState createState() => _AppState(); State<App> createState() => _AppState();
} }
class _AppState extends State<App> with TickerProviderStateMixin { class _AppState extends State<App> with TickerProviderStateMixin {

View File

@ -10,7 +10,7 @@ class App extends StatefulWidget {
const App({Key? key}) : super(key: key); const App({Key? key}) : super(key: key);
@override @override
_AppState createState() => _AppState(); State<App> createState() => _AppState();
} }
class _AppState extends State<App> with TickerProviderStateMixin { class _AppState extends State<App> with TickerProviderStateMixin {

View File

@ -9,7 +9,7 @@ class App extends StatefulWidget {
const App({Key? key}) : super(key: key); const App({Key? key}) : super(key: key);
@override @override
_AppState createState() => _AppState(); State<App> createState() => _AppState();
} }
class _AppState extends State<App> with TickerProviderStateMixin { class _AppState extends State<App> with TickerProviderStateMixin {

View File

@ -12,7 +12,7 @@ class App extends StatefulWidget {
const App({Key? key}) : super(key: key); const App({Key? key}) : super(key: key);
@override @override
_AppState createState() => _AppState(); State<App> createState() => _AppState();
} }
class _AppState extends State<App> with TickerProviderStateMixin { class _AppState extends State<App> with TickerProviderStateMixin {

View File

@ -7,7 +7,7 @@ class MyApp extends StatefulWidget {
const MyApp({Key? key}) : super(key: key); const MyApp({Key? key}) : super(key: key);
@override @override
_MyAppState createState() => _MyAppState(); State<MyApp> createState() => _MyAppState();
} }
class _MyAppState extends State<MyApp> with TickerProviderStateMixin { class _MyAppState extends State<MyApp> with TickerProviderStateMixin {

View File

@ -15,7 +15,7 @@ class App extends StatefulWidget {
const App({Key? key}) : super(key: key); const App({Key? key}) : super(key: key);
@override @override
_AppState createState() => _AppState(); State<App> createState() => _AppState();
} }
class _AppState extends State<App> with TickerProviderStateMixin { class _AppState extends State<App> with TickerProviderStateMixin {

View File

@ -13,7 +13,7 @@ class MyApp extends StatefulWidget {
const MyApp({Key? key}) : super(key: key); const MyApp({Key? key}) : super(key: key);
@override @override
_MyAppState createState() => _MyAppState(); State<MyApp> createState() => _MyAppState();
} }
class _MyAppState extends State<MyApp> { class _MyAppState extends State<MyApp> {

View File

@ -92,7 +92,7 @@ class Detail extends StatefulWidget {
const Detail(this.assetName, {Key? key}) : super(key: key); const Detail(this.assetName, {Key? key}) : super(key: key);
@override @override
_DetailState createState() => _DetailState(); State<Detail> createState() => _DetailState();
} }
class _DetailState extends State<Detail> with TickerProviderStateMixin { class _DetailState extends State<Detail> with TickerProviderStateMixin {

View File

@ -15,8 +15,8 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS: SPEC CHECKSUMS:
FlutterMacOS: 57701585bf7de1b3fc2bb61f6378d73bbdea8424 FlutterMacOS: 57701585bf7de1b3fc2bb61f6378d73bbdea8424
path_provider_macos: a0a3fd666cb7cd0448e936fb4abad4052961002b path_provider_macos: 160cab0d5461f0c0e02995469a98f24bdb9a3f1f
PODFILE CHECKSUM: 6eac6b3292e5142cfc23bdeb71848a40ec51c14c PODFILE CHECKSUM: 6eac6b3292e5142cfc23bdeb71848a40ec51c14c
COCOAPODS: 1.10.1 COCOAPODS: 1.11.3

View File

@ -7,7 +7,7 @@ packages:
name: archive name: archive
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.3.0" version: "3.3.1"
async: async:
dependency: transitive dependency: transitive
description: description:
@ -49,28 +49,28 @@ packages:
name: collection name: collection
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.15.0" version: "1.16.0"
crypto: crypto:
dependency: transitive dependency: transitive
description: description:
name: crypto name: crypto
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.0.1" version: "3.0.2"
fake_async: fake_async:
dependency: transitive dependency: transitive
description: description:
name: fake_async name: fake_async
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.2.0" version: "1.3.0"
ffi: ffi:
dependency: transitive dependency: transitive
description: description:
name: ffi name: ffi
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.2" version: "2.0.1"
file: file:
dependency: transitive dependency: transitive
description: description:
@ -96,7 +96,7 @@ packages:
name: flutter_lints name: flutter_lints
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.0.4" version: "2.0.1"
flutter_test: flutter_test:
dependency: "direct dev" dependency: "direct dev"
description: flutter description: flutter
@ -122,14 +122,14 @@ packages:
name: http_parser name: http_parser
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "4.0.0" version: "4.0.1"
lints: lints:
dependency: transitive dependency: transitive
description: description:
name: lints name: lints
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.0.1" version: "2.0.0"
logging: logging:
dependency: "direct main" dependency: "direct main"
description: description:
@ -143,7 +143,7 @@ packages:
path: ".." path: ".."
relative: true relative: true
source: path source: path
version: "1.3.0" version: "1.4.0"
matcher: matcher:
dependency: transitive dependency: transitive
description: description:
@ -157,7 +157,7 @@ packages:
name: material_color_utilities name: material_color_utilities
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.1.3" version: "0.1.4"
meta: meta:
dependency: transitive dependency: transitive
description: description:
@ -166,61 +166,61 @@ packages:
source: hosted source: hosted
version: "1.7.0" version: "1.7.0"
path: path:
dependency: transitive dependency: "direct main"
description: description:
name: path name: path
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.8.0" version: "1.8.1"
path_provider: path_provider:
dependency: "direct main" dependency: "direct main"
description: description:
name: path_provider name: path_provider
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.9" version: "2.0.11"
path_provider_android: path_provider_android:
dependency: transitive dependency: transitive
description: description:
name: path_provider_android name: path_provider_android
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.12" version: "2.0.16"
path_provider_ios: path_provider_ios:
dependency: transitive dependency: transitive
description: description:
name: path_provider_ios name: path_provider_ios
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.8" version: "2.0.10"
path_provider_linux: path_provider_linux:
dependency: transitive dependency: transitive
description: description:
name: path_provider_linux name: path_provider_linux
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.5" version: "2.1.7"
path_provider_macos: path_provider_macos:
dependency: transitive dependency: transitive
description: description:
name: path_provider_macos name: path_provider_macos
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.5" version: "2.0.6"
path_provider_platform_interface: path_provider_platform_interface:
dependency: transitive dependency: transitive
description: description:
name: path_provider_platform_interface name: path_provider_platform_interface
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.3" version: "2.0.4"
path_provider_windows: path_provider_windows:
dependency: transitive dependency: transitive
description: description:
name: path_provider_windows name: path_provider_windows
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.5" version: "2.1.0"
platform: platform:
dependency: transitive dependency: transitive
description: description:
@ -253,7 +253,7 @@ packages:
name: source_span name: source_span
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.8.1" version: "1.8.2"
stack_trace: stack_trace:
dependency: transitive dependency: transitive
description: description:
@ -288,28 +288,28 @@ packages:
name: test_api name: test_api
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.4.8" version: "0.4.9"
typed_data: typed_data:
dependency: transitive dependency: transitive
description: description:
name: typed_data name: typed_data
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.3.0" version: "1.3.1"
vector_math: vector_math:
dependency: transitive dependency: transitive
description: description:
name: vector_math name: vector_math
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.1" version: "2.1.2"
win32: win32:
dependency: transitive dependency: transitive
description: description:
name: win32 name: win32
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.5.1" version: "2.7.0"
xdg_directories: xdg_directories:
dependency: transitive dependency: transitive
description: description:
@ -318,5 +318,5 @@ packages:
source: hosted source: hosted
version: "0.2.0+1" version: "0.2.0+1"
sdks: sdks:
dart: ">=2.15.0 <3.0.0" dart: ">=2.17.0 <3.0.0"
flutter: ">=2.10.0" flutter: ">=3.0.0"

View File

@ -13,6 +13,7 @@ dependencies:
logging: logging:
lottie: lottie:
path: ../ path: ../
path:
path_provider: path_provider:
dev_dependencies: dev_dependencies:

View File

@ -26,6 +26,7 @@ class Lottie extends StatefulWidget {
this.delegates, this.delegates,
this.options, this.options,
bool? addRepaintBoundary, bool? addRepaintBoundary,
this.filterQuality,
}) : animate = animate ?? true, }) : animate = animate ?? true,
reverse = reverse ?? false, reverse = reverse ?? false,
repeat = repeat ?? true, repeat = repeat ?? true,
@ -51,9 +52,10 @@ class Lottie extends StatefulWidget {
double? width, double? width,
double? height, double? height,
BoxFit? fit, BoxFit? fit,
Alignment? alignment, AlignmentGeometry? alignment,
String? package, String? package,
bool? addRepaintBoundary, bool? addRepaintBoundary,
FilterQuality? filterQuality,
WarningCallback? onWarning, WarningCallback? onWarning,
}) => }) =>
LottieBuilder.asset( LottieBuilder.asset(
@ -77,6 +79,7 @@ class Lottie extends StatefulWidget {
alignment: alignment, alignment: alignment,
package: package, package: package,
addRepaintBoundary: addRepaintBoundary, addRepaintBoundary: addRepaintBoundary,
filterQuality: filterQuality,
onWarning: onWarning, onWarning: onWarning,
); );
@ -98,8 +101,9 @@ class Lottie extends StatefulWidget {
double? width, double? width,
double? height, double? height,
BoxFit? fit, BoxFit? fit,
Alignment? alignment, AlignmentGeometry? alignment,
bool? addRepaintBoundary, bool? addRepaintBoundary,
FilterQuality? filterQuality,
WarningCallback? onWarning, WarningCallback? onWarning,
}) => }) =>
LottieBuilder.file( LottieBuilder.file(
@ -121,6 +125,7 @@ class Lottie extends StatefulWidget {
fit: fit, fit: fit,
alignment: alignment, alignment: alignment,
addRepaintBoundary: addRepaintBoundary, addRepaintBoundary: addRepaintBoundary,
filterQuality: filterQuality,
onWarning: onWarning, onWarning: onWarning,
); );
@ -142,8 +147,9 @@ class Lottie extends StatefulWidget {
double? width, double? width,
double? height, double? height,
BoxFit? fit, BoxFit? fit,
Alignment? alignment, AlignmentGeometry? alignment,
bool? addRepaintBoundary, bool? addRepaintBoundary,
FilterQuality? filterQuality,
WarningCallback? onWarning, WarningCallback? onWarning,
}) => }) =>
LottieBuilder.memory( LottieBuilder.memory(
@ -165,6 +171,7 @@ class Lottie extends StatefulWidget {
fit: fit, fit: fit,
alignment: alignment, alignment: alignment,
addRepaintBoundary: addRepaintBoundary, addRepaintBoundary: addRepaintBoundary,
filterQuality: filterQuality,
onWarning: onWarning, onWarning: onWarning,
); );
@ -186,8 +193,9 @@ class Lottie extends StatefulWidget {
double? width, double? width,
double? height, double? height,
BoxFit? fit, BoxFit? fit,
Alignment? alignment, AlignmentGeometry? alignment,
bool? addRepaintBoundary, bool? addRepaintBoundary,
FilterQuality? filterQuality,
WarningCallback? onWarning, WarningCallback? onWarning,
}) => }) =>
LottieBuilder.network( LottieBuilder.network(
@ -209,6 +217,7 @@ class Lottie extends StatefulWidget {
fit: fit, fit: fit,
alignment: alignment, alignment: alignment,
addRepaintBoundary: addRepaintBoundary, addRepaintBoundary: addRepaintBoundary,
filterQuality: filterQuality,
onWarning: onWarning, onWarning: onWarning,
); );
@ -299,13 +308,19 @@ class Lottie extends StatefulWidget {
/// This property is `true` by default. /// This property is `true` by default.
final bool addRepaintBoundary; final bool addRepaintBoundary;
/// The quality of the image layer. See [FilterQuality]
/// [FilterQuality.high] is highest quality but slowest.
///
/// Defaults to [FilterQuality.none]
final FilterQuality? filterQuality;
static bool get traceEnabled => L.traceEnabled; static bool get traceEnabled => L.traceEnabled;
static set traceEnabled(bool enabled) { static set traceEnabled(bool enabled) {
L.traceEnabled = enabled; L.traceEnabled = enabled;
} }
@override @override
_LottieState createState() => _LottieState(); State<Lottie> createState() => _LottieState();
} }
class _LottieState extends State<Lottie> with TickerProviderStateMixin { class _LottieState extends State<Lottie> with TickerProviderStateMixin {
@ -366,6 +381,7 @@ class _LottieState extends State<Lottie> with TickerProviderStateMixin {
height: widget.height, height: widget.height,
fit: widget.fit, fit: widget.fit,
alignment: widget.alignment, alignment: widget.alignment,
filterQuality: widget.filterQuality,
); );
}, },
); );

View File

@ -59,6 +59,7 @@ class LottieBuilder extends StatefulWidget {
this.fit, this.fit,
this.alignment, this.alignment,
this.addRepaintBoundary, this.addRepaintBoundary,
this.filterQuality,
this.onWarning, this.onWarning,
}) : super(key: key); }) : super(key: key);
@ -83,6 +84,7 @@ class LottieBuilder extends StatefulWidget {
this.fit, this.fit,
this.alignment, this.alignment,
this.addRepaintBoundary, this.addRepaintBoundary,
this.filterQuality,
this.onWarning, this.onWarning,
}) : lottie = NetworkLottie(src, }) : lottie = NetworkLottie(src,
headers: headers, imageProviderFactory: imageProviderFactory), headers: headers, imageProviderFactory: imageProviderFactory),
@ -117,6 +119,7 @@ class LottieBuilder extends StatefulWidget {
this.fit, this.fit,
this.alignment, this.alignment,
this.addRepaintBoundary, this.addRepaintBoundary,
this.filterQuality,
this.onWarning, this.onWarning,
}) : lottie = FileLottie(file, imageProviderFactory: imageProviderFactory), }) : lottie = FileLottie(file, imageProviderFactory: imageProviderFactory),
super(key: key); super(key: key);
@ -143,6 +146,7 @@ class LottieBuilder extends StatefulWidget {
this.alignment, this.alignment,
String? package, String? package,
this.addRepaintBoundary, this.addRepaintBoundary,
this.filterQuality,
this.onWarning, this.onWarning,
}) : lottie = AssetLottie(name, }) : lottie = AssetLottie(name,
bundle: bundle, bundle: bundle,
@ -170,6 +174,7 @@ class LottieBuilder extends StatefulWidget {
this.fit, this.fit,
this.alignment, this.alignment,
this.addRepaintBoundary, this.addRepaintBoundary,
this.filterQuality,
this.onWarning, this.onWarning,
}) : lottie = }) : lottie =
MemoryLottie(bytes, imageProviderFactory: imageProviderFactory), MemoryLottie(bytes, imageProviderFactory: imageProviderFactory),
@ -361,6 +366,12 @@ class LottieBuilder extends StatefulWidget {
/// This property is `true` by default. /// This property is `true` by default.
final bool? addRepaintBoundary; final bool? addRepaintBoundary;
/// The quality of the image layer. See [FilterQuality]
/// [FilterQuality.high] is highest quality but slowest.
///
/// Defaults to [FilterQuality.none]
final FilterQuality? filterQuality;
/// A callback called when there is a warning during the loading or painting /// A callback called when there is a warning during the loading or painting
/// of the animation. /// of the animation.
final WarningCallback? onWarning; final WarningCallback? onWarning;
@ -398,7 +409,7 @@ class LottieBuilder extends StatefulWidget {
final ImageErrorWidgetBuilder? errorBuilder; final ImageErrorWidgetBuilder? errorBuilder;
@override @override
_LottieBuilderState createState() => _LottieBuilderState(); State<LottieBuilder> createState() => _LottieBuilderState();
@override @override
void debugFillProperties(DiagnosticPropertiesBuilder properties) { void debugFillProperties(DiagnosticPropertiesBuilder properties) {
@ -482,6 +493,7 @@ class _LottieBuilderState extends State<LottieBuilder> {
fit: widget.fit, fit: widget.fit,
alignment: widget.alignment, alignment: widget.alignment,
addRepaintBoundary: widget.addRepaintBoundary, addRepaintBoundary: widget.addRepaintBoundary,
filterQuality: widget.filterQuality,
); );
if (widget.frameBuilder != null) { if (widget.frameBuilder != null) {

View File

@ -16,16 +16,15 @@ class LottieDrawable {
final Size size; final Size size;
LottieDelegates? _delegates; LottieDelegates? _delegates;
bool _isDirty = true; bool _isDirty = true;
final bool enableMergePaths; bool enableMergePaths = false;
FilterQuality? filterQuality;
/// Gives a suggestion whether to paint with anti-aliasing, or not. Default is true. /// Gives a suggestion whether to paint with anti-aliasing, or not. Default is true.
bool antiAliasingSuggested = true; bool antiAliasingSuggested = true;
LottieDrawable(this.composition, LottieDrawable(this.composition, {LottieDelegates? delegates})
{LottieDelegates? delegates, bool? enableMergePaths})
: size = Size(composition.bounds.width.toDouble(), : size = Size(composition.bounds.width.toDouble(),
composition.bounds.height.toDouble()), composition.bounds.height.toDouble()) {
enableMergePaths = enableMergePaths ?? false {
this.delegates = delegates; this.delegates = delegates;
_compositionLayer = CompositionLayer( _compositionLayer = CompositionLayer(
this, LayerParser.parse(composition), composition.layers, composition); this, LayerParser.parse(composition), composition.layers, composition);

View File

@ -25,6 +25,7 @@ class ImageLayer extends BaseLayer {
} }
var density = window.devicePixelRatio; var density = window.devicePixelRatio;
paint.filterQuality = lottieDrawable.filterQuality ?? FilterQuality.none;
paint.setAlpha(parentAlpha); paint.setAlpha(parentAlpha);
if (_colorFilterAnimation != null) { if (_colorFilterAnimation != null) {
paint.colorFilter = _colorFilterAnimation!.value; paint.colorFilter = _colorFilterAnimation!.value;

View File

@ -23,6 +23,7 @@ class RawLottie extends LeafRenderObjectWidget {
this.height, this.height,
this.fit, this.fit,
AlignmentGeometry? alignment, AlignmentGeometry? alignment,
this.filterQuality,
}) : progress = progress ?? 0.0, }) : progress = progress ?? 0.0,
alignment = alignment ?? Alignment.center, alignment = alignment ?? Alignment.center,
super(key: key); super(key: key);
@ -78,6 +79,8 @@ class RawLottie extends LeafRenderObjectWidget {
/// relative to text direction. /// relative to text direction.
final AlignmentGeometry alignment; final AlignmentGeometry alignment;
final FilterQuality? filterQuality;
@override @override
RenderLottie createRenderObject(BuildContext context) { RenderLottie createRenderObject(BuildContext context) {
return RenderLottie( return RenderLottie(
@ -90,17 +93,21 @@ class RawLottie extends LeafRenderObjectWidget {
height: height, height: height,
fit: fit, fit: fit,
alignment: alignment, alignment: alignment,
filterQuality: filterQuality,
); );
} }
@override @override
void updateRenderObject(BuildContext context, RenderLottie renderObject) { void updateRenderObject(BuildContext context, RenderLottie renderObject) {
renderObject renderObject
..setComposition(composition, ..setComposition(
composition,
progress: progress, progress: progress,
frameRate: frameRate, frameRate: frameRate,
delegates: delegates, delegates: delegates,
enableMergePaths: options?.enableMergePaths) enableMergePaths: options?.enableMergePaths,
filterQuality: filterQuality,
)
..width = width ..width = width
..height = height ..height = height
..alignment = alignment ..alignment = alignment

View File

@ -19,11 +19,14 @@ class RenderLottie extends RenderBox {
double? height, double? height,
BoxFit? fit, BoxFit? fit,
AlignmentGeometry alignment = Alignment.center, AlignmentGeometry alignment = Alignment.center,
FilterQuality? filterQuality,
}) : assert(progress >= 0.0 && progress <= 1.0), }) : assert(progress >= 0.0 && progress <= 1.0),
_drawable = composition != null _drawable = composition != null
? (LottieDrawable(composition, enableMergePaths: enableMergePaths) ? (LottieDrawable(composition)
..setProgress(progress, frameRate: frameRate) ..setProgress(progress, frameRate: frameRate)
..delegates = delegates) ..delegates = delegates
..enableMergePaths = enableMergePaths ?? false
..filterQuality = filterQuality)
: null, : null,
_width = width, _width = width,
_height = height, _height = height,
@ -33,11 +36,13 @@ class RenderLottie extends RenderBox {
/// The lottie composition to display. /// The lottie composition to display.
LottieComposition? get composition => _drawable?.composition; LottieComposition? get composition => _drawable?.composition;
LottieDrawable? _drawable; LottieDrawable? _drawable;
void setComposition(LottieComposition? composition, void setComposition(LottieComposition? composition,
{required double progress, {required double progress,
required FrameRate? frameRate, required FrameRate? frameRate,
required LottieDelegates? delegates, required LottieDelegates? delegates,
bool? enableMergePaths}) { bool? enableMergePaths,
FilterQuality? filterQuality}) {
var drawable = _drawable; var drawable = _drawable;
enableMergePaths ??= false; enableMergePaths ??= false;
@ -50,11 +55,8 @@ class RenderLottie extends RenderBox {
needsLayout = true; needsLayout = true;
} }
} else { } else {
if (drawable == null || if (drawable == null || drawable.composition != composition) {
drawable.composition != composition || drawable = _drawable = LottieDrawable(composition);
drawable.enableMergePaths != enableMergePaths) {
drawable = _drawable =
LottieDrawable(composition, enableMergePaths: enableMergePaths);
needsLayout = true; needsLayout = true;
needsPaint = true; needsPaint = true;
} }
@ -65,6 +67,14 @@ class RenderLottie extends RenderBox {
drawable.delegates = delegates; drawable.delegates = delegates;
needsPaint = true; needsPaint = true;
} }
if (enableMergePaths != drawable.enableMergePaths) {
drawable.enableMergePaths = enableMergePaths;
needsPaint = true;
}
if (filterQuality != drawable.filterQuality) {
drawable.filterQuality = filterQuality;
needsPaint = true;
}
} }
if (needsPaint) { if (needsPaint) {

View File

@ -7,28 +7,28 @@ packages:
name: _fe_analyzer_shared name: _fe_analyzer_shared
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "38.0.0" version: "43.0.0"
analyzer: analyzer:
dependency: "direct dev" dependency: "direct dev"
description: description:
name: analyzer name: analyzer
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.4.1" version: "4.3.1"
archive: archive:
dependency: "direct main" dependency: "direct main"
description: description:
name: archive name: archive
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.3.0" version: "3.3.1"
args: args:
dependency: transitive dependency: transitive
description: description:
name: args name: args
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.3.0" version: "2.3.1"
async: async:
dependency: transitive dependency: transitive
description: description:
@ -49,35 +49,35 @@ packages:
name: build name: build
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.2.2" version: "2.3.0"
build_config: build_config:
dependency: transitive dependency: transitive
description: description:
name: build_config name: build_config
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.0.0" version: "1.1.0"
build_daemon: build_daemon:
dependency: transitive dependency: transitive
description: description:
name: build_daemon name: build_daemon
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.0.1" version: "3.1.0"
build_resolvers: build_resolvers:
dependency: transitive dependency: transitive
description: description:
name: build_resolvers name: build_resolvers
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.7" version: "2.0.9"
build_runner: build_runner:
dependency: "direct dev" dependency: "direct dev"
description: description:
name: build_runner name: build_runner
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.8" version: "2.2.0"
build_runner_core: build_runner_core:
dependency: transitive dependency: transitive
description: description:
@ -98,7 +98,7 @@ packages:
name: built_value name: built_value
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "8.1.4" version: "8.4.0"
characters: characters:
dependency: transitive dependency: transitive
description: description:
@ -140,35 +140,35 @@ packages:
name: collection name: collection
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.15.0" version: "1.16.0"
convert: convert:
dependency: transitive dependency: transitive
description: description:
name: convert name: convert
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.0.1" version: "3.0.2"
crypto: crypto:
dependency: transitive dependency: transitive
description: description:
name: crypto name: crypto
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.0.1" version: "3.0.2"
dart_style: dart_style:
dependency: "direct dev" dependency: "direct dev"
description: description:
name: dart_style name: dart_style
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.2.2" version: "2.2.3"
fake_async: fake_async:
dependency: transitive dependency: transitive
description: description:
name: fake_async name: fake_async
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.2.0" version: "1.3.0"
file: file:
dependency: transitive dependency: transitive
description: description:
@ -182,7 +182,7 @@ packages:
name: fixnum name: fixnum
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.0.0" version: "1.0.1"
flutter: flutter:
dependency: "direct main" dependency: "direct main"
description: flutter description: flutter
@ -194,7 +194,7 @@ packages:
name: flutter_lints name: flutter_lints
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.0.4" version: "2.0.1"
flutter_test: flutter_test:
dependency: "direct dev" dependency: "direct dev"
description: flutter description: flutter
@ -206,14 +206,14 @@ packages:
name: frontend_server_client name: frontend_server_client
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.2" version: "2.1.3"
glob: glob:
dependency: transitive dependency: transitive
description: description:
name: glob name: glob
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.2" version: "2.1.0"
graphs: graphs:
dependency: transitive dependency: transitive
description: description:
@ -227,14 +227,14 @@ packages:
name: http_multi_server name: http_multi_server
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.2.0" version: "3.2.1"
http_parser: http_parser:
dependency: transitive dependency: transitive
description: description:
name: http_parser name: http_parser
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "4.0.0" version: "4.0.1"
io: io:
dependency: transitive dependency: transitive
description: description:
@ -255,14 +255,14 @@ packages:
name: json_annotation name: json_annotation
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "4.4.0" version: "4.6.0"
lints: lints:
dependency: transitive dependency: transitive
description: description:
name: lints name: lints
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.0.1" version: "2.0.0"
logging: logging:
dependency: transitive dependency: transitive
description: description:
@ -283,7 +283,7 @@ packages:
name: material_color_utilities name: material_color_utilities
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.1.3" version: "0.1.4"
meta: meta:
dependency: transitive dependency: transitive
description: description:
@ -297,28 +297,28 @@ packages:
name: mime name: mime
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.0.1" version: "1.0.2"
package_config: package_config:
dependency: transitive dependency: transitive
description: description:
name: package_config name: package_config
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.2" version: "2.1.0"
path: path:
dependency: "direct main" dependency: "direct main"
description: description:
name: path name: path
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.8.0" version: "1.8.1"
pool: pool:
dependency: transitive dependency: transitive
description: description:
name: pool name: pool
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.5.0" version: "1.5.1"
pub_semver: pub_semver:
dependency: "direct dev" dependency: "direct dev"
description: description:
@ -339,14 +339,14 @@ packages:
name: shelf name: shelf
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.3.0" version: "1.3.1"
shelf_web_socket: shelf_web_socket:
dependency: transitive dependency: transitive
description: description:
name: shelf_web_socket name: shelf_web_socket
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.0.1" version: "1.0.2"
sky_engine: sky_engine:
dependency: transitive dependency: transitive
description: flutter description: flutter
@ -358,7 +358,7 @@ packages:
name: source_span name: source_span
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.8.1" version: "1.8.2"
stack_trace: stack_trace:
dependency: transitive dependency: transitive
description: description:
@ -400,7 +400,7 @@ packages:
name: test_api name: test_api
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.4.8" version: "0.4.9"
timing: timing:
dependency: transitive dependency: transitive
description: description:
@ -414,14 +414,14 @@ packages:
name: typed_data name: typed_data
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.3.0" version: "1.3.1"
vector_math: vector_math:
dependency: "direct main" dependency: "direct main"
description: description:
name: vector_math name: vector_math
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.1" version: "2.1.2"
watcher: watcher:
dependency: transitive dependency: transitive
description: description:
@ -435,14 +435,14 @@ packages:
name: web_socket_channel name: web_socket_channel
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.0" version: "2.2.0"
yaml: yaml:
dependency: "direct dev" dependency: "direct dev"
description: description:
name: yaml name: yaml
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.1.0" version: "3.1.1"
sdks: sdks:
dart: ">=2.16.0 <3.0.0" dart: ">=2.17.0 <3.0.0"
flutter: ">=2.10.0" flutter: ">=2.10.0"

View File

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 36 KiB