Compare commits

...

2 Commits

Author SHA1 Message Date
a0b9572315 docker 2021-05-05 13:39:29 +02:00
9471029b0a Move all tests to the root test folder (#147) 2021-05-05 13:17:13 +02:00
448 changed files with 191 additions and 146 deletions

View File

@ -6,11 +6,11 @@ on:
- master - master
jobs: jobs:
analyze_and_test: analyze:
name: Flutter analyze name: Flutter analyze
strategy: strategy:
matrix: matrix:
flutter: ['beta'] flutter: ['stable', 'beta']
runs-on: macos-latest runs-on: macos-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
@ -22,9 +22,6 @@ jobs:
- run: flutter pub get - run: flutter pub get
working-directory: example working-directory: example
- run: flutter analyze - run: flutter analyze
- run: flutter test test # https://github.com/flutter/flutter/issues/20907
- run: flutter test test
working-directory: example
- run: flutter pub run tool/prepare_submit.dart - run: flutter pub run tool/prepare_submit.dart
- name: "check for uncommitted changes" - name: "check for uncommitted changes"
run: | run: |
@ -33,6 +30,15 @@ jobs:
"and check in all changes" \ "and check in all changes" \
&& exit 1) && exit 1)
shell: bash shell: bash
test:
name: Run all tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run tests
uses: docker://cirrusci/flutter:2.0.6
with:
args: sh run_tests.sh
build_web_version: build_web_version:
name: Check that the web version compile name: Check that the web version compile
runs-on: ubuntu-latest runs-on: ubuntu-latest

7
CONTRIBUTING.md Normal file
View File

@ -0,0 +1,7 @@
## Run the Golden tests
Run and update the golden tests requires Docker installed.
```shell script
sh update_goldens.sh
```

View File

@ -1,16 +1,17 @@
include: package:pedantic/analysis_options.yaml include: package:pedantic/analysis_options.yaml
analyzer: analyzer:
errors:
strong-mode: strong-mode:
implicit-casts: false implicit-casts: false
implicit-dynamic: false implicit-dynamic: false
linter: linter:
rules: rules:
avoid_dynamic_calls: true
avoid_renaming_method_parameters: true avoid_renaming_method_parameters: true
avoid_returning_null_for_future: true avoid_returning_null_for_future: true
avoid_returning_null_for_void: true avoid_returning_null_for_void: true
avoid_returning_this: true avoid_returning_this: true
avoid_setters_without_getters: true avoid_setters_without_getters: true
avoid_web_libraries_in_flutter: true
await_only_futures: true await_only_futures: true
camel_case_types: true camel_case_types: true
cancel_subscriptions: true cancel_subscriptions: true
@ -26,6 +27,7 @@ linter:
overridden_fields: true overridden_fields: true
prefer_inlined_adds: true prefer_inlined_adds: true
prefer_interpolation_to_compose_strings: true prefer_interpolation_to_compose_strings: true
prefer_null_aware_method_calls: true
prefer_null_aware_operators: true prefer_null_aware_operators: true
prefer_relative_imports: true prefer_relative_imports: true
prefer_typing_uninitialized_variables: true prefer_typing_uninitialized_variables: true
@ -33,7 +35,9 @@ linter:
test_types_in_equals: true test_types_in_equals: true
unnecessary_brace_in_string_interps: true unnecessary_brace_in_string_interps: true
unnecessary_getters_setters: true unnecessary_getters_setters: true
unnecessary_null_checks: true
unnecessary_parenthesis: true unnecessary_parenthesis: true
unnecessary_statements: true unnecessary_statements: true
use_function_type_syntax_for_parameters: true use_function_type_syntax_for_parameters: true
use_if_null_to_convert_nulls_to_bools: true
void_checks: true void_checks: true

View File

@ -87,7 +87,6 @@ class _MyAppState extends State<MyApp> with TickerProviderStateMixin {
), ),
const SizedBox(height: 30), const SizedBox(height: 30),
ElevatedButton( ElevatedButton(
child: Text('Loop between frames'),
onPressed: () { onPressed: () {
// Loop between 2 specifics frames // Loop between 2 specifics frames
@ -100,6 +99,7 @@ class _MyAppState extends State<MyApp> with TickerProviderStateMixin {
period: _controller.duration! * (stop - start), period: _controller.duration! * (stop - start),
); );
}, },
child: Text('Loop between frames'),
), ),
], ],
), ),

View File

@ -88,16 +88,16 @@ class _LottieDetailsState extends State<_LottieDetails>
trailing: Text(widget.composition.durationFrames.toStringAsFixed(1)), trailing: Text(widget.composition.durationFrames.toStringAsFixed(1)),
), ),
ElevatedButton( ElevatedButton(
child: Text('touchDownEnd - touchUpCancel'),
onPressed: () => _playBetween('touchDownEnd', 'touchUpCancel'), onPressed: () => _playBetween('touchDownEnd', 'touchUpCancel'),
child: Text('touchDownEnd - touchUpCancel'),
), ),
ElevatedButton( ElevatedButton(
child: Text('touchDownStart - touchDownEnd'),
onPressed: () => _playBetween('touchDownStart', 'touchDownEnd'), onPressed: () => _playBetween('touchDownStart', 'touchDownEnd'),
child: Text('touchDownStart - touchDownEnd'),
), ),
ElevatedButton( ElevatedButton(
child: Text('touchDownEnd - touchUpEnd'),
onPressed: () => _playBetween('touchDownEnd', 'touchUpEnd'), onPressed: () => _playBetween('touchDownEnd', 'touchUpEnd'),
child: Text('touchDownEnd - touchUpEnd'),
), ),
for (var marker in widget.composition.markers) for (var marker in widget.composition.markers)
ListTile( ListTile(

View File

@ -29,8 +29,8 @@ class _MyAppState extends State<MyApp> {
crossAxisAlignment: CrossAxisAlignment.stretch, crossAxisAlignment: CrossAxisAlignment.stretch,
children: [ children: [
ElevatedButton( ElevatedButton(
child: Text('Export all frames'),
onPressed: _export, onPressed: _export,
child: Text('Export all frames'),
), ),
if (_frames != null) if (_frames != null)
Expanded( Expanded(

View File

@ -29,25 +29,25 @@ class App extends StatelessWidget {
itemBuilder: (context, index) { itemBuilder: (context, index) {
var assetName = files[index]; var assetName = files[index];
return GestureDetector( return GestureDetector(
child: _Item(
child: Lottie.asset(
assetName,
frameBuilder: (context, child, composition) {
return AnimatedOpacity(
child: child,
opacity: composition == null ? 0 : 1,
duration: const Duration(seconds: 1),
curve: Curves.easeOut,
);
},
),
),
onTap: () { onTap: () {
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute<void>( MaterialPageRoute<void>(
builder: (context) => Detail(assetName))); builder: (context) => Detail(assetName)));
}, },
child: _Item(
child: Lottie.asset(
assetName,
frameBuilder: (context, child, composition) {
return AnimatedOpacity(
opacity: composition == null ? 0 : 1,
duration: const Duration(seconds: 1),
curve: Curves.easeOut,
child: child,
);
},
),
),
); );
}, },
), ),

View File

@ -108,14 +108,17 @@ final files = [
'assets/Tests/hd.json', 'assets/Tests/hd.json',
'assets/Tests/map.zip', 'assets/Tests/map.zip',
'assets/TwitterHeartButton.json', 'assets/TwitterHeartButton.json',
'assets/_loading_indicator.json', 'assets/battery_optimizations.json',
'assets/bluetoothscanning.json', 'assets/bluetoothscanning.json',
'assets/camera_change.json',
'assets/envelope.json',
'assets/example_with_images/data.json', 'assets/example_with_images/data.json',
'assets/lf20_w2Afea.json', 'assets/lf20_w2Afea.json',
'assets/lottiefiles/100_percent.json', 'assets/lottiefiles/100_percent.json',
'assets/lottiefiles/28861-connection-style-2.json',
'assets/lottiefiles/45668-arrow-with-light-passing-through.json',
'assets/lottiefiles/Plane.json', 'assets/lottiefiles/Plane.json',
'assets/lottiefiles/StreetByMorning.json', 'assets/lottiefiles/StreetByMorning.json',
'assets/lottiefiles/___.json',
'assets/lottiefiles/a_mountain.json', 'assets/lottiefiles/a_mountain.json',
'assets/lottiefiles/accept_arrows.json', 'assets/lottiefiles/accept_arrows.json',
'assets/lottiefiles/airbnb.json', 'assets/lottiefiles/airbnb.json',
@ -346,7 +349,9 @@ final files = [
'assets/lottiefiles/yoga_carpet.json', 'assets/lottiefiles/yoga_carpet.json',
'assets/lottiefiles/youtube_icon_reveal.json', 'assets/lottiefiles/youtube_icon_reveal.json',
'assets/playing.json', 'assets/playing.json',
'assets/weather/_hurricane.json', 'assets/spinning_carrousel.zip',
'assets/sticker.json',
'assets/tent.json',
'assets/weather/fog.json', 'assets/weather/fog.json',
'assets/weather/hurricane.json', 'assets/weather/hurricane.json',
'assets/weather/thunder-storm.json', 'assets/weather/thunder-storm.json',

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.0.0" version: "3.1.2"
async: async:
dependency: transitive dependency: transitive
description: description:
@ -56,7 +56,7 @@ packages:
name: crypto name: crypto
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.0.0" version: "3.0.1"
fake_async: fake_async:
dependency: transitive dependency: transitive
description: description:
@ -70,14 +70,14 @@ packages:
name: ffi name: ffi
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.1.3" version: "1.0.0"
file: file:
dependency: transitive dependency: transitive
description: description:
name: file name: file
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "5.2.1" version: "6.1.0"
flutter: flutter:
dependency: "direct main" dependency: "direct main"
description: flutter description: flutter
@ -89,47 +89,33 @@ packages:
name: flutter_colorpicker name: flutter_colorpicker
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.4.0-nullsafety.0" version: "0.4.0"
flutter_test: flutter_test:
dependency: "direct dev" dependency: "direct dev"
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.0" version: "0.0.0"
golden_toolkit:
dependency: "direct dev"
description:
name: golden_toolkit
url: "https://pub.dartlang.org"
source: hosted
version: "0.9.0-nullsafety.0"
http: http:
dependency: "direct main" dependency: "direct main"
description: description:
name: http name: http
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.12.2" version: "0.13.3"
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: "3.1.4" version: "4.0.0"
intl:
dependency: transitive
description:
name: intl
url: "https://pub.dartlang.org"
source: hosted
version: "0.16.1"
logging: logging:
dependency: transitive dependency: transitive
description: description:
name: logging name: logging
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.0.0" version: "1.0.1"
lottie: lottie:
dependency: "direct main" dependency: "direct main"
description: description:
@ -164,63 +150,63 @@ packages:
name: path_provider name: path_provider
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.6.27" version: "2.0.1"
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: "0.0.1+2" version: "2.0.0"
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: "0.0.4+8" version: "2.0.0"
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: "1.0.4" version: "2.0.1"
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: "0.0.4+3" version: "2.0.1"
pedantic: pedantic:
dependency: transitive dependency: transitive
description: description:
name: pedantic name: pedantic
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.9.2" version: "1.11.0"
platform: platform:
dependency: transitive dependency: transitive
description: description:
name: platform name: platform
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.2.1" version: "3.0.0"
plugin_platform_interface: plugin_platform_interface:
dependency: transitive dependency: transitive
description: description:
name: plugin_platform_interface name: plugin_platform_interface
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.0.3" version: "2.0.0"
process: process:
dependency: transitive dependency: transitive
description: description:
name: process name: process
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.0.13" version: "4.2.1"
sky_engine: sky_engine:
dependency: transitive dependency: transitive
description: flutter description: flutter
@ -232,7 +218,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.0" version: "1.8.1"
stack_trace: stack_trace:
dependency: transitive dependency: transitive
description: description:
@ -267,7 +253,7 @@ packages:
name: test_api name: test_api
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.2.19" version: "0.3.0"
typed_data: typed_data:
dependency: transitive dependency: transitive
description: description:
@ -288,14 +274,14 @@ packages:
name: win32 name: win32
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.7.4" version: "2.0.5"
xdg_directories: xdg_directories:
dependency: transitive dependency: transitive
description: description:
name: xdg_directories name: xdg_directories
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.1.2" version: "0.2.0"
sdks: sdks:
dart: ">=2.12.0-29.10.beta <3.0.0" dart: ">=2.12.0 <3.0.0"
flutter: ">=1.24.0-10.2.pre" flutter: ">=1.20.0"

View File

@ -8,7 +8,7 @@ environment:
dependencies: dependencies:
flutter: flutter:
sdk: flutter sdk: flutter
flutter_colorpicker: ^0.4.0-nullsafety.0 flutter_colorpicker:
http: http:
lottie: lottie:
path: ../ path: ../
@ -17,7 +17,6 @@ dependencies:
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:
sdk: flutter sdk: flutter
golden_toolkit: ^0.9.0-nullsafety.0
# For information on the generic Dart part of this file, see the # For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec # following page: https://dart.dev/tools/pub/pubspec
@ -60,4 +59,4 @@ flutter:
- asset: assets/fonts/Roboto.ttf - asset: assets/fonts/Roboto.ttf
- family: Noto Emoji - family: Noto Emoji
fonts: fonts:
- asset: assets/fonts/NotoEmoji-Regular.ttf - asset: assets/fonts/Noto-Emoji.ttf

View File

@ -1,7 +0,0 @@
import 'dart:async';
import 'package:golden_toolkit/golden_toolkit.dart';
Future<void> testExecutable(FutureOr<void> Function() testMain) async {
await loadAppFonts();
return testMain();
}

View File

@ -1,4 +1,5 @@
import 'dart:io'; import 'dart:io';
import 'package:path/path.dart' as p;
void main() { void main() {
var buffer = StringBuffer(); var buffer = StringBuffer();
@ -8,7 +9,9 @@ void main() {
var allFiles = Directory('assets') var allFiles = Directory('assets')
.listSync(recursive: true) .listSync(recursive: true)
.whereType<File>() .whereType<File>()
.where((f) => f.path.endsWith('.json') || f.path.endsWith('.zip')) .where((f) =>
(f.path.endsWith('.json') || f.path.endsWith('.zip')) &&
!p.basename(f.path).startsWith('_'))
.toList(); .toList();
allFiles.sort((a, b) => a.path.compareTo(b.path)); allFiles.sort((a, b) => a.path.compareTo(b.path));
for (var file in allFiles) { for (var file in allFiles) {

View File

@ -198,7 +198,7 @@ class GradientFillContent implements DrawingContent, KeyPathElementContent {
colors[i] = dynamicColors[i]; colors[i] = dynamicColors[i];
} }
} else { } else {
colors = List.filled(dynamicColors.length, Color(0)); colors = List.filled(dynamicColors.length, Color(0x00000000));
for (var i = 0; i < dynamicColors.length; i++) { for (var i = 0; i < dynamicColors.length; i++) {
colors[i] = dynamicColors[i]; colors[i] = dynamicColors[i];
} }

View File

@ -149,7 +149,7 @@ class GradientStrokeContent extends BaseStrokeContent {
colors[i] = dynamicColors[i]; colors[i] = dynamicColors[i];
} }
} else { } else {
colors = List<Color>.filled(dynamicColors.length, Color(0)); colors = List<Color>.filled(dynamicColors.length, Color(0x00000000));
for (var i = 0; i < dynamicColors.length; i++) { for (var i = 0; i < dynamicColors.length; i++) {
colors[i] = dynamicColors[i]; colors[i] = dynamicColors[i];
} }

View File

@ -10,8 +10,8 @@ class GradientColorKeyframeAnimation extends KeyframeAnimation<GradientColor> {
: super(keyframes) { : super(keyframes) {
var startValue = keyframes.first.startValue; var startValue = keyframes.first.startValue;
var size = startValue == null ? 0 : startValue.size; var size = startValue == null ? 0 : startValue.size;
_gradientColor = GradientColor( _gradientColor = GradientColor(List<double>.filled(size, 0.0),
List<double>.filled(size, 0.0), List<Color>.filled(size, Color(0))); List<Color>.filled(size, Color(0x00000000)));
} }
@override @override

View File

@ -51,8 +51,8 @@ import 'dart:ui';
/// {@link #TIME_REMAP} (composition layers only) /// {@link #TIME_REMAP} (composition layers only)
abstract class LottieProperty { abstract class LottieProperty {
/// ColorInt **/ /// ColorInt **/
static final Color color = Color(1); static final Color color = Color(0x00000001);
static final Color strokeColor = Color(2); static final Color strokeColor = Color(0x00000002);
/// Opacity value are 0-100 to match after effects **/ /// Opacity value are 0-100 to match after effects **/
static final int transformOpacity = 3; static final int transformOpacity = 3;

View File

@ -425,7 +425,7 @@ class TextLayer extends BaseLayer {
_colorCallbackAnimation = null; _colorCallbackAnimation = null;
} else { } else {
_colorCallbackAnimation = ValueCallbackKeyframeAnimation( _colorCallbackAnimation = ValueCallbackKeyframeAnimation(
callback as LottieValueCallback<Color>, const Color(0)) callback as LottieValueCallback<Color>, const Color(0x00000000))
..addUpdateListener(invalidateSelf); ..addUpdateListener(invalidateSelf);
addAnimation(_colorCallbackAnimation); addAnimation(_colorCallbackAnimation);
} }
@ -438,7 +438,7 @@ class TextLayer extends BaseLayer {
_strokeColorCallbackAnimation = null; _strokeColorCallbackAnimation = null;
} else { } else {
_strokeColorCallbackAnimation = ValueCallbackKeyframeAnimation( _strokeColorCallbackAnimation = ValueCallbackKeyframeAnimation(
callback as LottieValueCallback<Color>, const Color(0)) callback as LottieValueCallback<Color>, const Color(0x00000000))
..addUpdateListener(invalidateSelf); ..addUpdateListener(invalidateSelf);
addAnimation(_strokeColorCallbackAnimation); addAnimation(_strokeColorCallbackAnimation);
} }

View File

@ -14,8 +14,8 @@ DocumentData documentDataParser(JsonReader reader, {required double scale}) {
var tracking = 0; var tracking = 0;
var lineHeight = 0.0; var lineHeight = 0.0;
var baselineShift = 0.0; var baselineShift = 0.0;
var fillColor = Color(0); var fillColor = Color(0x00000000);
var strokeColor = Color(0); var strokeColor = Color(0x00000000);
var strokeWidth = 0.0; var strokeWidth = 0.0;
var strokeOverFill = true; var strokeOverFill = true;

View File

@ -45,7 +45,7 @@ class GradientColorParser {
} }
var positions = List<double>.filled(_colorPoints, 0.0); var positions = List<double>.filled(_colorPoints, 0.0);
var colors = List<Color>.filled(_colorPoints, Color(0)); var colors = List<Color>.filled(_colorPoints, Color(0x00000000));
var r = 0; var r = 0;
var g = 0; var g = 0;

View File

@ -59,7 +59,7 @@ class LayerParser {
transform: AnimatableTransform(), transform: AnimatableTransform(),
solidWidth: 0, solidWidth: 0,
solidHeight: 0, solidHeight: 0,
solidColor: Color(0), solidColor: Color(0x00000000),
timeStretch: 0, timeStretch: 0,
startFrame: 0, startFrame: 0,
preCompWidth: bounds.width, preCompWidth: bounds.width,
@ -85,7 +85,7 @@ class LayerParser {
var layerId = 0; var layerId = 0;
var solidWidth = 0; var solidWidth = 0;
var solidHeight = 0; var solidHeight = 0;
var solidColor = Color(0); var solidColor = Color(0x00000000);
var preCompWidth = 0; var preCompWidth = 0;
var preCompHeight = 0; var preCompHeight = 0;
var parentId = -1; var parentId = -1;

View File

@ -1,3 +1,5 @@
// This file is using conditional import so it is safe to import dart:html
// ignore: avoid_web_libraries_in_flutter
import 'dart:html'; import 'dart:html';
import 'dart:typed_data'; import 'dart:typed_data';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';

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: "16.0.0" version: "21.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: "1.0.0" version: "1.5.0"
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.0.0" version: "3.1.2"
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.0.0" version: "2.1.0"
async: async:
dependency: transitive dependency: transitive
description: description:
@ -49,42 +49,42 @@ packages:
name: build name: build
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.6.3" version: "2.0.1"
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: "0.4.6" version: "1.0.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: "2.1.8" version: "3.0.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: "1.5.4" version: "2.0.1"
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: "1.11.5" version: "2.0.2"
build_runner_core: build_runner_core:
dependency: transitive dependency: transitive
description: description:
name: build_runner_core name: build_runner_core
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "6.1.10" version: "7.0.0"
built_collection: built_collection:
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.0.0" version: "8.0.5"
characters: characters:
dependency: "direct main" dependency: "direct main"
description: description:
@ -119,7 +119,7 @@ packages:
name: checked_yaml name: checked_yaml
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.0.4" version: "2.0.1"
cli_util: cli_util:
dependency: transitive dependency: transitive
description: description:
@ -140,7 +140,7 @@ packages:
name: code_builder name: code_builder
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.6.0" version: "4.0.0"
collection: collection:
dependency: "direct main" dependency: "direct main"
description: description:
@ -161,14 +161,14 @@ packages:
name: crypto name: crypto
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.0.0" version: "3.0.1"
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: "1.3.13" version: "2.0.1"
fake_async: fake_async:
dependency: transitive dependency: transitive
description: description:
@ -200,27 +200,34 @@ packages:
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.0" version: "0.0.0"
frontend_server_client:
dependency: transitive
description:
name: frontend_server_client
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
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.0" version: "2.0.1"
graphs: graphs:
dependency: transitive dependency: transitive
description: description:
name: graphs name: graphs
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.2.0" version: "2.0.0"
http_multi_server: http_multi_server:
dependency: transitive dependency: transitive
description: description:
name: http_multi_server name: http_multi_server
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.2.0" version: "3.0.1"
http_parser: http_parser:
dependency: transitive dependency: transitive
description: description:
@ -234,7 +241,7 @@ packages:
name: io name: io
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.3.4" version: "1.0.0"
js: js:
dependency: transitive dependency: transitive
description: description:
@ -248,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.0.0" version: "4.0.1"
logging: logging:
dependency: "direct main" dependency: "direct main"
description: description:
name: logging name: logging
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.0.0" version: "1.0.1"
matcher: matcher:
dependency: transitive dependency: transitive
description: description:
@ -283,7 +290,7 @@ packages:
name: mockito name: mockito
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "5.0.0" version: "5.0.7"
package_config: package_config:
dependency: transitive dependency: transitive
description: description:
@ -304,7 +311,7 @@ packages:
name: pedantic name: pedantic
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.10.0" version: "1.11.0"
pool: pool:
dependency: transitive dependency: transitive
description: description:
@ -325,21 +332,21 @@ packages:
name: pubspec_parse name: pubspec_parse
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.1.8" version: "1.0.0"
shelf: shelf:
dependency: transitive dependency: transitive
description: description:
name: shelf name: shelf
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.0.0" version: "1.1.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: "0.2.4+1" version: "1.0.1"
sky_engine: sky_engine:
dependency: transitive dependency: transitive
description: flutter description: flutter
@ -351,7 +358,7 @@ packages:
name: source_gen name: source_gen
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.9.10+3" version: "1.0.0"
source_span: source_span:
dependency: transitive dependency: transitive
description: description:
@ -407,7 +414,7 @@ packages:
name: timing name: timing
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.1.1+3" version: "1.0.0"
typed_data: typed_data:
dependency: transitive dependency: transitive
description: description:
@ -435,13 +442,13 @@ packages:
name: web_socket_channel name: web_socket_channel
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.2.0" version: "2.1.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.0.0" version: "3.1.0"
sdks: sdks:
dart: ">=2.12.0-0.0 <3.0.0" dart: ">=2.12.0 <3.0.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.0.1 version: 1.0.2
homepage: https://github.com/xvrh/lottie-flutter homepage: https://github.com/xvrh/lottie-flutter
environment: environment:
@ -19,11 +19,11 @@ dependencies:
vector_math: ^2.1.0 vector_math: ^2.1.0
dev_dependencies: dev_dependencies:
analyzer: ^1.0.0 analyzer:
build_runner: build_runner:
dart_style: dart_style:
flutter_test: flutter_test:
sdk: flutter sdk: flutter
mockito: mockito:
pub_semver: pub_semver:
yaml: ^3.0.0 yaml:

2
run_tests.sh Normal file
View File

@ -0,0 +1,2 @@
flutter test test
(cd example && flutter test test)

View File

@ -15,11 +15,11 @@ void main() {
var callCount = 0; var callCount = 0;
LottieImageProviderFactory imageProviderFactory = (image) { LottieImageProviderFactory imageProviderFactory = (image) {
++callCount; ++callCount;
return FileImage(File('assets/Images/WeAccept/img_0.png')); return FileImage(File('example/assets/Images/WeAccept/img_0.png'));
}; };
var composition = (await tester.runAsync(() => FileLottie( var composition = (await tester.runAsync(() => FileLottie(
File('assets/spinning_carrousel.zip'), File('example/assets/spinning_carrousel.zip'),
imageProviderFactory: imageProviderFactory) imageProviderFactory: imageProviderFactory)
.load()))!; .load()))!;
@ -35,11 +35,11 @@ void main() {
tester.binding.window.physicalSizeTestValue = size; tester.binding.window.physicalSizeTestValue = size;
tester.binding.window.devicePixelRatioTestValue = 1.0; tester.binding.window.devicePixelRatioTestValue = 1.0;
var image = await tester.runAsync( var image = await tester.runAsync(() =>
() => loadImage(FileImage(File('assets/Images/WeAccept/img_0.png')))); loadImage(FileImage(File('example/assets/Images/WeAccept/img_0.png'))));
var composition = (await tester.runAsync( var composition = (await tester.runAsync(() =>
() => FileLottie(File('assets/spinning_carrousel.zip')).load()))!; FileLottie(File('example/assets/spinning_carrousel.zip')).load()))!;
var delegates = LottieDelegates(image: (composition, asset) { var delegates = LottieDelegates(image: (composition, asset) {
return image; return image;

View File

@ -11,7 +11,7 @@ void main() {
setUpAll(() async { setUpAll(() async {
composition = await LottieComposition.fromBytes( composition = await LottieComposition.fromBytes(
File('assets/Tests/Shapes.json').readAsBytesSync()); File('example/assets/Tests/Shapes.json').readAsBytesSync());
}); });
void testGolden(String description, ValueDelegate delegate, void testGolden(String description, ValueDelegate delegate,
@ -22,6 +22,9 @@ void main() {
.replaceAll(' ', '_'); .replaceAll(' ', '_');
testWidgets(description, (tester) async { testWidgets(description, (tester) async {
tester.binding.window.physicalSizeTestValue = Size(500, 400);
tester.binding.window.devicePixelRatioTestValue = 1.0;
var animation = var animation =
AnimationController(vsync: tester, duration: composition.duration); AnimationController(vsync: tester, duration: composition.duration);
if (progress != null) { if (progress != null) {

View File

@ -1,13 +1,15 @@
import 'dart:io'; import 'dart:io';
import 'dart:ui';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
import 'package:lottie/lottie.dart'; import 'package:lottie/lottie.dart';
void main() { void main() {
testWidgets('Dynamic test', (tester) async { testWidgets('Dynamic test', (tester) async {
tester.binding.window.physicalSizeTestValue = Size(500, 400);
tester.binding.window.devicePixelRatioTestValue = 1.0;
var composition = await LottieComposition.fromBytes( var composition = await LottieComposition.fromBytes(
File('assets/Tests/DynamicText.json').readAsBytesSync()); File('example/assets/Tests/DynamicText.json').readAsBytesSync());
await tester.pumpWidget( await tester.pumpWidget(
MaterialApp( MaterialApp(

View File

@ -13,7 +13,7 @@ void main() {
tester.binding.window.devicePixelRatioTestValue = 1.0; tester.binding.window.devicePixelRatioTestValue = 1.0;
var composition = await LottieComposition.fromBytes( var composition = await LottieComposition.fromBytes(
File('assets/17297-fireworks.json').readAsBytesSync()); File('example/assets/17297-fireworks.json').readAsBytesSync());
await tester.pumpWidget(FilmStrip(composition, size: size)); await tester.pumpWidget(FilmStrip(composition, size: size));

View File

@ -0,0 +1,22 @@
import 'dart:async';
import 'dart:io';
import 'package:flutter/services.dart';
import 'package:path/path.dart' as path;
Future<void> testExecutable(FutureOr<void> Function() testMain) async {
await loadFonts();
return testMain();
}
Future<void> loadFonts() async {
for (var file in Directory('example/assets/fonts')
.listSync()
.whereType<File>()
.where((f) => f.path.endsWith('.ttf'))) {
var fontLoader = FontLoader(
path.basenameWithoutExtension(file.path).replaceAll('-', ' '));
var future = file.readAsBytes().then((value) => value.buffer.asByteData());
fontLoader.addFont(future);
await fontLoader.load();
}
}

View File

@ -7,7 +7,7 @@ import 'package:path/path.dart' as p;
import 'utils.dart'; import 'utils.dart';
void main() { void main() {
var root = 'assets'; var root = 'example/assets';
for (var asset in Directory(root) for (var asset in Directory(root)
.listSync(recursive: true) .listSync(recursive: true)
.whereType<File>() .whereType<File>()

View File

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

View File

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

View File

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

View File

Before

Width:  |  Height:  |  Size: 7.1 KiB

After

Width:  |  Height:  |  Size: 7.1 KiB

View File

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

Before

Width:  |  Height:  |  Size: 5.7 KiB

After

Width:  |  Height:  |  Size: 5.7 KiB

View File

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

View File

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View File

Before

Width:  |  Height:  |  Size: 7.5 KiB

After

Width:  |  Height:  |  Size: 7.5 KiB

View File

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View File

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

Before

Width:  |  Height:  |  Size: 7.7 KiB

After

Width:  |  Height:  |  Size: 7.7 KiB

View File

Before

Width:  |  Height:  |  Size: 6.4 KiB

After

Width:  |  Height:  |  Size: 6.4 KiB

View File

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

View File

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View File

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View File

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View File

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

Before

Width:  |  Height:  |  Size: 6.3 KiB

After

Width:  |  Height:  |  Size: 6.3 KiB

View File

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

View File

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 33 KiB

View File

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 33 KiB

View File

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 36 KiB

View File

Before

Width:  |  Height:  |  Size: 88 KiB

After

Width:  |  Height:  |  Size: 88 KiB

View File

Before

Width:  |  Height:  |  Size: 102 KiB

After

Width:  |  Height:  |  Size: 102 KiB

View File

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

View File

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

View File

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

View File

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View File

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View File

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View File

Before

Width:  |  Height:  |  Size: 9.9 KiB

After

Width:  |  Height:  |  Size: 9.9 KiB

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

Before

Width:  |  Height:  |  Size: 6.8 KiB

After

Width:  |  Height:  |  Size: 6.8 KiB

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

View File

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 5.7 KiB

After

Width:  |  Height:  |  Size: 5.7 KiB

View File

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

View File

Before

Width:  |  Height:  |  Size: 6.9 KiB

After

Width:  |  Height:  |  Size: 6.9 KiB

View File

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

View File

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

Some files were not shown because too many files have changed in this diff Show More