Compare commits
1 Commits
v0.7.0
...
error_buil
Author | SHA1 | Date | |
---|---|---|---|
27b2ec471f |
2
.github/workflows/analyze-and-test.yaml
vendored
@ -10,7 +10,7 @@ jobs:
|
||||
name: Flutter analyze
|
||||
strategy:
|
||||
matrix:
|
||||
flutter: ['stable']
|
||||
flutter: ['stable', 'dev']
|
||||
runs-on: macos-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
@ -1,6 +1,3 @@
|
||||
## [0.7.0]
|
||||
- Performance improvement for complex animations.
|
||||
|
||||
## [0.6.0]
|
||||
- Runs the animation at the frame rate specified in the json file (ie. An animation encoded with a 20 FPS will only
|
||||
be paint 20 times per seconds even though the AnimationController will invalidate the widget 60 times per seconds).
|
||||
|
@ -21,42 +21,42 @@ packages:
|
||||
name: async
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.5.0-nullsafety.1"
|
||||
version: "2.4.2"
|
||||
boolean_selector:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: boolean_selector
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.0-nullsafety.1"
|
||||
version: "2.0.0"
|
||||
characters:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: characters
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.1.0-nullsafety.3"
|
||||
version: "1.0.0"
|
||||
charcode:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: charcode
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.2.0-nullsafety.1"
|
||||
version: "1.1.3"
|
||||
clock:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: clock
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.1.0-nullsafety.1"
|
||||
version: "1.0.1"
|
||||
collection:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: collection
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.15.0-nullsafety.3"
|
||||
version: "1.14.13"
|
||||
convert:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -77,14 +77,7 @@ packages:
|
||||
name: fake_async
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.2.0-nullsafety.1"
|
||||
ffi:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: ffi
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.1.3"
|
||||
version: "1.1.0"
|
||||
file:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -150,35 +143,35 @@ packages:
|
||||
path: ".."
|
||||
relative: true
|
||||
source: path
|
||||
version: "0.7.0"
|
||||
version: "0.6.0"
|
||||
matcher:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: matcher
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.12.10-nullsafety.1"
|
||||
version: "0.12.8"
|
||||
meta:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: meta
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.3.0-nullsafety.3"
|
||||
version: "1.1.8"
|
||||
path:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.8.0-nullsafety.1"
|
||||
version: "1.7.0"
|
||||
path_provider:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: path_provider
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.6.21"
|
||||
version: "1.6.14"
|
||||
path_provider_linux:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -192,7 +185,7 @@ packages:
|
||||
name: path_provider_macos
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.0.4+4"
|
||||
version: "0.0.4+3"
|
||||
path_provider_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -200,20 +193,13 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.3"
|
||||
path_provider_windows:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path_provider_windows
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.0.4+1"
|
||||
pedantic:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: pedantic
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.9.2"
|
||||
version: "1.9.0"
|
||||
platform:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -227,7 +213,7 @@ packages:
|
||||
name: plugin_platform_interface
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.3"
|
||||
version: "1.0.2"
|
||||
process:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -246,70 +232,63 @@ packages:
|
||||
name: source_span
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.8.0-nullsafety.2"
|
||||
version: "1.7.0"
|
||||
stack_trace:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: stack_trace
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.10.0-nullsafety.1"
|
||||
version: "1.9.5"
|
||||
stream_channel:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: stream_channel
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.0-nullsafety.1"
|
||||
version: "2.0.0"
|
||||
string_scanner:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: string_scanner
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.1.0-nullsafety.1"
|
||||
version: "1.0.5"
|
||||
term_glyph:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: term_glyph
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.2.0-nullsafety.1"
|
||||
version: "1.1.0"
|
||||
test_api:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: test_api
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.2.19-nullsafety.2"
|
||||
version: "0.2.17"
|
||||
typed_data:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: typed_data
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.3.0-nullsafety.3"
|
||||
version: "1.2.0"
|
||||
vector_math:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: vector_math
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.0-nullsafety.3"
|
||||
win32:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: win32
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.7.3"
|
||||
version: "2.0.8"
|
||||
xdg_directories:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: xdg_directories
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.1.2"
|
||||
version: "0.1.0"
|
||||
sdks:
|
||||
dart: ">=2.10.0-110 <2.11.0"
|
||||
dart: ">=2.9.0-14.0.dev <3.0.0"
|
||||
flutter: ">=1.12.13+hotfix.5 <2.0.0"
|
||||
|
@ -8,11 +8,11 @@ environment:
|
||||
dependencies:
|
||||
flutter:
|
||||
sdk: flutter
|
||||
flutter_colorpicker:
|
||||
http:
|
||||
lottie:
|
||||
path: ../
|
||||
flutter_colorpicker:
|
||||
path_provider:
|
||||
http:
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
Before Width: | Height: | Size: 9.5 KiB After Width: | Height: | Size: 9.5 KiB |
Before Width: | Height: | Size: 5.7 KiB After Width: | Height: | Size: 5.7 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 14 KiB |
@ -50,6 +50,7 @@ class Lottie extends StatefulWidget {
|
||||
Key key,
|
||||
AssetBundle bundle,
|
||||
LottieFrameBuilder frameBuilder,
|
||||
LottieErrorWidgetBuilder errorBuilder,
|
||||
double width,
|
||||
double height,
|
||||
BoxFit fit,
|
||||
@ -71,6 +72,7 @@ class Lottie extends StatefulWidget {
|
||||
key: key,
|
||||
bundle: bundle,
|
||||
frameBuilder: frameBuilder,
|
||||
errorBuilder: errorBuilder,
|
||||
width: width,
|
||||
height: height,
|
||||
fit: fit,
|
||||
@ -93,6 +95,7 @@ class Lottie extends StatefulWidget {
|
||||
void Function(LottieComposition) onLoaded,
|
||||
Key key,
|
||||
LottieFrameBuilder frameBuilder,
|
||||
LottieErrorWidgetBuilder errorBuilder,
|
||||
double width,
|
||||
double height,
|
||||
BoxFit fit,
|
||||
@ -112,6 +115,7 @@ class Lottie extends StatefulWidget {
|
||||
onLoaded: onLoaded,
|
||||
key: key,
|
||||
frameBuilder: frameBuilder,
|
||||
errorBuilder: errorBuilder,
|
||||
width: width,
|
||||
height: height,
|
||||
fit: fit,
|
||||
@ -133,6 +137,7 @@ class Lottie extends StatefulWidget {
|
||||
void Function(LottieComposition) onLoaded,
|
||||
Key key,
|
||||
LottieFrameBuilder frameBuilder,
|
||||
LottieErrorWidgetBuilder errorBuilder,
|
||||
double width,
|
||||
double height,
|
||||
BoxFit fit,
|
||||
@ -152,6 +157,7 @@ class Lottie extends StatefulWidget {
|
||||
onLoaded: onLoaded,
|
||||
key: key,
|
||||
frameBuilder: frameBuilder,
|
||||
errorBuilder: errorBuilder,
|
||||
width: width,
|
||||
height: height,
|
||||
fit: fit,
|
||||
@ -173,6 +179,7 @@ class Lottie extends StatefulWidget {
|
||||
void Function(LottieComposition) onLoaded,
|
||||
Key key,
|
||||
LottieFrameBuilder frameBuilder,
|
||||
LottieErrorWidgetBuilder errorBuilder,
|
||||
double width,
|
||||
double height,
|
||||
BoxFit fit,
|
||||
@ -192,6 +199,7 @@ class Lottie extends StatefulWidget {
|
||||
onLoaded: onLoaded,
|
||||
key: key,
|
||||
frameBuilder: frameBuilder,
|
||||
errorBuilder: errorBuilder,
|
||||
width: width,
|
||||
height: height,
|
||||
fit: fit,
|
||||
|
@ -44,6 +44,7 @@ class LottieBuilder extends StatefulWidget {
|
||||
this.options,
|
||||
this.onLoaded,
|
||||
this.frameBuilder,
|
||||
this.errorBuilder,
|
||||
this.width,
|
||||
this.height,
|
||||
this.fit,
|
||||
@ -67,6 +68,7 @@ class LottieBuilder extends StatefulWidget {
|
||||
this.onLoaded,
|
||||
Key key,
|
||||
this.frameBuilder,
|
||||
this.errorBuilder,
|
||||
this.width,
|
||||
this.height,
|
||||
this.fit,
|
||||
@ -99,6 +101,7 @@ class LottieBuilder extends StatefulWidget {
|
||||
this.onLoaded,
|
||||
Key key,
|
||||
this.frameBuilder,
|
||||
this.errorBuilder,
|
||||
this.width,
|
||||
this.height,
|
||||
this.fit,
|
||||
@ -122,6 +125,7 @@ class LottieBuilder extends StatefulWidget {
|
||||
Key key,
|
||||
AssetBundle bundle,
|
||||
this.frameBuilder,
|
||||
this.errorBuilder,
|
||||
this.width,
|
||||
this.height,
|
||||
this.fit,
|
||||
@ -148,6 +152,7 @@ class LottieBuilder extends StatefulWidget {
|
||||
this.onLoaded,
|
||||
Key key,
|
||||
this.frameBuilder,
|
||||
this.errorBuilder,
|
||||
this.width,
|
||||
this.height,
|
||||
this.fit,
|
||||
@ -279,6 +284,12 @@ class LottieBuilder extends StatefulWidget {
|
||||
///
|
||||
final LottieFrameBuilder frameBuilder;
|
||||
|
||||
/// A builder function that is called if an error occurs during animation loading.
|
||||
///
|
||||
/// If this builder is not provided, it will use the `ErrorWidget` in debug mode
|
||||
/// and an empty box in release mode.
|
||||
final LottieErrorWidgetBuilder errorBuilder;
|
||||
|
||||
/// If non-null, require the lottie animation to have this width.
|
||||
///
|
||||
/// If null, the lottie animation will pick a size that best preserves its intrinsic
|
||||
@ -351,6 +362,7 @@ class LottieBuilder extends StatefulWidget {
|
||||
super.debugFillProperties(properties);
|
||||
properties.add(DiagnosticsProperty<LottieProvider>('lottie', lottie));
|
||||
properties.add(DiagnosticsProperty<Function>('frameBuilder', frameBuilder));
|
||||
properties.add(DiagnosticsProperty<Function>('errorBuilder', errorBuilder));
|
||||
properties.add(DoubleProperty('width', width, defaultValue: null));
|
||||
properties.add(DoubleProperty('height', height, defaultValue: null));
|
||||
properties.add(EnumProperty<BoxFit>('fit', fit, defaultValue: null));
|
||||
@ -396,7 +408,9 @@ class _LottieBuilderState extends State<LottieBuilder> {
|
||||
future: _loadingFuture,
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.hasError) {
|
||||
if (kDebugMode) {
|
||||
if (widget.errorBuilder != null) {
|
||||
return widget.errorBuilder(context, snapshot.error);
|
||||
} else if (kDebugMode) {
|
||||
return ErrorWidget(snapshot.error);
|
||||
}
|
||||
}
|
||||
@ -435,3 +449,10 @@ class _LottieBuilderState extends State<LottieBuilder> {
|
||||
'loadingFuture', _loadingFuture));
|
||||
}
|
||||
}
|
||||
|
||||
/// Signature used by [Lottie.errorBuilder] to create a replacement widget to
|
||||
/// render instead of the Lottie animation.
|
||||
typedef LottieErrorWidgetBuilder = Widget Function(
|
||||
BuildContext context,
|
||||
Object error,
|
||||
);
|
||||
|
75
pubspec.lock
@ -7,14 +7,14 @@ packages:
|
||||
name: _fe_analyzer_shared
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "11.0.0"
|
||||
version: "6.0.0"
|
||||
analyzer:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
name: analyzer
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.40.4"
|
||||
version: "0.39.14"
|
||||
archive:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@ -43,27 +43,6 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.0-nullsafety.1"
|
||||
build:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: build
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.5.0"
|
||||
built_collection:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: built_collection
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "4.3.2"
|
||||
built_value:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: built_value
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "7.1.0"
|
||||
characters:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@ -84,7 +63,7 @@ packages:
|
||||
name: cli_util
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.2.0"
|
||||
version: "0.1.4"
|
||||
clock:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -92,13 +71,6 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.1.0-nullsafety.1"
|
||||
code_builder:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: code_builder
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "3.5.0"
|
||||
collection:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@ -120,13 +92,20 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.5"
|
||||
csslib:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: csslib
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.16.2"
|
||||
dart_style:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
name: dart_style
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.3.8"
|
||||
version: "1.3.6"
|
||||
fake_async:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -134,13 +113,6 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.2.0-nullsafety.1"
|
||||
fixnum:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: fixnum
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.10.11"
|
||||
flutter:
|
||||
dependency: "direct main"
|
||||
description: flutter
|
||||
@ -158,6 +130,13 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.2.0"
|
||||
html:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: html
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.14.0+3"
|
||||
js:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -192,7 +171,7 @@ packages:
|
||||
name: mockito
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "4.1.3"
|
||||
version: "4.1.1"
|
||||
node_interop:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -227,7 +206,7 @@ packages:
|
||||
name: pedantic
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.9.2"
|
||||
version: "1.9.0"
|
||||
pub_semver:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -235,25 +214,11 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.4.4"
|
||||
quiver:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: quiver
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.3"
|
||||
sky_engine:
|
||||
dependency: transitive
|
||||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.99"
|
||||
source_gen:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: source_gen
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.9.7+1"
|
||||
source_span:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
12
pubspec.yaml
@ -1,27 +1,27 @@
|
||||
name: lottie
|
||||
description: Render After Effects animations natively on Flutter. This package is a pure Dart implementation of a Lottie player.
|
||||
version: 0.7.0
|
||||
version: 0.6.0
|
||||
homepage: https://github.com/xvrh/lottie-flutter
|
||||
|
||||
environment:
|
||||
sdk: ">=2.7.0 <3.0.0"
|
||||
|
||||
dependencies:
|
||||
flutter:
|
||||
sdk: flutter
|
||||
archive: ^2.0.0
|
||||
characters: '>=0.5.0 <2.0.0'
|
||||
charcode: ^1.0.0
|
||||
collection: ^1.14.0
|
||||
flutter:
|
||||
sdk: flutter
|
||||
logging: ^0.11.0
|
||||
meta: ^1.1.8
|
||||
path: ^1.6.0
|
||||
vector_math: ^2.0.0
|
||||
|
||||
dev_dependencies:
|
||||
analyzer:
|
||||
dart_style:
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
mockito:
|
||||
analyzer: 0.39.14
|
||||
dart_style: 1.3.6
|
||||
mockito: ^4.0.0
|
||||
yaml:
|
||||
|