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
jobs:
analyze_and_test:
analyze:
name: Flutter analyze
strategy:
matrix:
flutter: ['beta']
flutter: ['stable', 'beta']
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
@ -22,9 +22,6 @@ jobs:
- run: flutter pub get
working-directory: example
- 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
- name: "check for uncommitted changes"
run: |
@ -33,6 +30,15 @@ jobs:
"and check in all changes" \
&& exit 1)
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:
name: Check that the web version compile
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
analyzer:
errors:
strong-mode:
implicit-casts: false
implicit-dynamic: false
linter:
rules:
avoid_dynamic_calls: true
avoid_renaming_method_parameters: true
avoid_returning_null_for_future: true
avoid_returning_null_for_void: true
avoid_returning_this: true
avoid_setters_without_getters: true
avoid_web_libraries_in_flutter: true
await_only_futures: true
camel_case_types: true
cancel_subscriptions: true
@ -26,6 +27,7 @@ linter:
overridden_fields: true
prefer_inlined_adds: true
prefer_interpolation_to_compose_strings: true
prefer_null_aware_method_calls: true
prefer_null_aware_operators: true
prefer_relative_imports: true
prefer_typing_uninitialized_variables: true
@ -33,7 +35,9 @@ linter:
test_types_in_equals: true
unnecessary_brace_in_string_interps: true
unnecessary_getters_setters: true
unnecessary_null_checks: true
unnecessary_parenthesis: true
unnecessary_statements: true
use_function_type_syntax_for_parameters: true
use_if_null_to_convert_nulls_to_bools: true
void_checks: true

View File

@ -87,7 +87,6 @@ class _MyAppState extends State<MyApp> with TickerProviderStateMixin {
),
const SizedBox(height: 30),
ElevatedButton(
child: Text('Loop between frames'),
onPressed: () {
// Loop between 2 specifics frames
@ -100,6 +99,7 @@ class _MyAppState extends State<MyApp> with TickerProviderStateMixin {
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)),
),
ElevatedButton(
child: Text('touchDownEnd - touchUpCancel'),
onPressed: () => _playBetween('touchDownEnd', 'touchUpCancel'),
child: Text('touchDownEnd - touchUpCancel'),
),
ElevatedButton(
child: Text('touchDownStart - touchDownEnd'),
onPressed: () => _playBetween('touchDownStart', 'touchDownEnd'),
child: Text('touchDownStart - touchDownEnd'),
),
ElevatedButton(
child: Text('touchDownEnd - touchUpEnd'),
onPressed: () => _playBetween('touchDownEnd', 'touchUpEnd'),
child: Text('touchDownEnd - touchUpEnd'),
),
for (var marker in widget.composition.markers)
ListTile(

View File

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

View File

@ -29,25 +29,25 @@ class App extends StatelessWidget {
itemBuilder: (context, index) {
var assetName = files[index];
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: () {
Navigator.push(
context,
MaterialPageRoute<void>(
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/map.zip',
'assets/TwitterHeartButton.json',
'assets/_loading_indicator.json',
'assets/battery_optimizations.json',
'assets/bluetoothscanning.json',
'assets/camera_change.json',
'assets/envelope.json',
'assets/example_with_images/data.json',
'assets/lf20_w2Afea.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/StreetByMorning.json',
'assets/lottiefiles/___.json',
'assets/lottiefiles/a_mountain.json',
'assets/lottiefiles/accept_arrows.json',
'assets/lottiefiles/airbnb.json',
@ -346,7 +349,9 @@ final files = [
'assets/lottiefiles/yoga_carpet.json',
'assets/lottiefiles/youtube_icon_reveal.json',
'assets/playing.json',
'assets/weather/_hurricane.json',
'assets/spinning_carrousel.zip',
'assets/sticker.json',
'assets/tent.json',
'assets/weather/fog.json',
'assets/weather/hurricane.json',
'assets/weather/thunder-storm.json',

View File

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

View File

@ -8,7 +8,7 @@ environment:
dependencies:
flutter:
sdk: flutter
flutter_colorpicker: ^0.4.0-nullsafety.0
flutter_colorpicker:
http:
lottie:
path: ../
@ -17,7 +17,6 @@ dependencies:
dev_dependencies:
flutter_test:
sdk: flutter
golden_toolkit: ^0.9.0-nullsafety.0
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
@ -60,4 +59,4 @@ flutter:
- asset: assets/fonts/Roboto.ttf
- family: Noto Emoji
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 'package:path/path.dart' as p;
void main() {
var buffer = StringBuffer();
@ -8,7 +9,9 @@ void main() {
var allFiles = Directory('assets')
.listSync(recursive: true)
.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();
allFiles.sort((a, b) => a.path.compareTo(b.path));
for (var file in allFiles) {

View File

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

View File

@ -149,7 +149,7 @@ class GradientStrokeContent extends BaseStrokeContent {
colors[i] = dynamicColors[i];
}
} 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++) {
colors[i] = dynamicColors[i];
}

View File

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

View File

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

View File

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

View File

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

View File

@ -45,7 +45,7 @@ class GradientColorParser {
}
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 g = 0;

View File

@ -59,7 +59,7 @@ class LayerParser {
transform: AnimatableTransform(),
solidWidth: 0,
solidHeight: 0,
solidColor: Color(0),
solidColor: Color(0x00000000),
timeStretch: 0,
startFrame: 0,
preCompWidth: bounds.width,
@ -85,7 +85,7 @@ class LayerParser {
var layerId = 0;
var solidWidth = 0;
var solidHeight = 0;
var solidColor = Color(0);
var solidColor = Color(0x00000000);
var preCompWidth = 0;
var preCompHeight = 0;
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:typed_data';
import 'package:flutter/rendering.dart';

View File

@ -7,28 +7,28 @@ packages:
name: _fe_analyzer_shared
url: "https://pub.dartlang.org"
source: hosted
version: "16.0.0"
version: "21.0.0"
analyzer:
dependency: "direct dev"
description:
name: analyzer
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
version: "1.5.0"
archive:
dependency: "direct main"
description:
name: archive
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.0"
version: "3.1.2"
args:
dependency: transitive
description:
name: args
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
version: "2.1.0"
async:
dependency: transitive
description:
@ -49,42 +49,42 @@ packages:
name: build
url: "https://pub.dartlang.org"
source: hosted
version: "1.6.3"
version: "2.0.1"
build_config:
dependency: transitive
description:
name: build_config
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.6"
version: "1.0.0"
build_daemon:
dependency: transitive
description:
name: build_daemon
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.8"
version: "3.0.0"
build_resolvers:
dependency: transitive
description:
name: build_resolvers
url: "https://pub.dartlang.org"
source: hosted
version: "1.5.4"
version: "2.0.1"
build_runner:
dependency: "direct dev"
description:
name: build_runner
url: "https://pub.dartlang.org"
source: hosted
version: "1.11.5"
version: "2.0.2"
build_runner_core:
dependency: transitive
description:
name: build_runner_core
url: "https://pub.dartlang.org"
source: hosted
version: "6.1.10"
version: "7.0.0"
built_collection:
dependency: transitive
description:
@ -98,7 +98,7 @@ packages:
name: built_value
url: "https://pub.dartlang.org"
source: hosted
version: "8.0.0"
version: "8.0.5"
characters:
dependency: "direct main"
description:
@ -119,7 +119,7 @@ packages:
name: checked_yaml
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.4"
version: "2.0.1"
cli_util:
dependency: transitive
description:
@ -140,7 +140,7 @@ packages:
name: code_builder
url: "https://pub.dartlang.org"
source: hosted
version: "3.6.0"
version: "4.0.0"
collection:
dependency: "direct main"
description:
@ -161,14 +161,14 @@ packages:
name: crypto
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.0"
version: "3.0.1"
dart_style:
dependency: "direct dev"
description:
name: dart_style
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.13"
version: "2.0.1"
fake_async:
dependency: transitive
description:
@ -200,27 +200,34 @@ packages:
description: flutter
source: sdk
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:
dependency: transitive
description:
name: glob
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
version: "2.0.1"
graphs:
dependency: transitive
description:
name: graphs
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.0"
version: "2.0.0"
http_multi_server:
dependency: transitive
description:
name: http_multi_server
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.0"
version: "3.0.1"
http_parser:
dependency: transitive
description:
@ -234,7 +241,7 @@ packages:
name: io
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.4"
version: "1.0.0"
js:
dependency: transitive
description:
@ -248,14 +255,14 @@ packages:
name: json_annotation
url: "https://pub.dartlang.org"
source: hosted
version: "4.0.0"
version: "4.0.1"
logging:
dependency: "direct main"
description:
name: logging
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
version: "1.0.1"
matcher:
dependency: transitive
description:
@ -283,7 +290,7 @@ packages:
name: mockito
url: "https://pub.dartlang.org"
source: hosted
version: "5.0.0"
version: "5.0.7"
package_config:
dependency: transitive
description:
@ -304,7 +311,7 @@ packages:
name: pedantic
url: "https://pub.dartlang.org"
source: hosted
version: "1.10.0"
version: "1.11.0"
pool:
dependency: transitive
description:
@ -325,21 +332,21 @@ packages:
name: pubspec_parse
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.8"
version: "1.0.0"
shelf:
dependency: transitive
description:
name: shelf
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
version: "1.1.1"
shelf_web_socket:
dependency: transitive
description:
name: shelf_web_socket
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.4+1"
version: "1.0.1"
sky_engine:
dependency: transitive
description: flutter
@ -351,7 +358,7 @@ packages:
name: source_gen
url: "https://pub.dartlang.org"
source: hosted
version: "0.9.10+3"
version: "1.0.0"
source_span:
dependency: transitive
description:
@ -407,7 +414,7 @@ packages:
name: timing
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.1+3"
version: "1.0.0"
typed_data:
dependency: transitive
description:
@ -435,13 +442,13 @@ packages:
name: web_socket_channel
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
version: "2.1.0"
yaml:
dependency: "direct dev"
description:
name: yaml
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.0"
version: "3.1.0"
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
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
environment:
@ -19,11 +19,11 @@ dependencies:
vector_math: ^2.1.0
dev_dependencies:
analyzer: ^1.0.0
analyzer:
build_runner:
dart_style:
flutter_test:
sdk: flutter
mockito:
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;
LottieImageProviderFactory imageProviderFactory = (image) {
++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(
File('assets/spinning_carrousel.zip'),
File('example/assets/spinning_carrousel.zip'),
imageProviderFactory: imageProviderFactory)
.load()))!;
@ -35,11 +35,11 @@ void main() {
tester.binding.window.physicalSizeTestValue = size;
tester.binding.window.devicePixelRatioTestValue = 1.0;
var image = await tester.runAsync(
() => loadImage(FileImage(File('assets/Images/WeAccept/img_0.png'))));
var image = await tester.runAsync(() =>
loadImage(FileImage(File('example/assets/Images/WeAccept/img_0.png'))));
var composition = (await tester.runAsync(
() => FileLottie(File('assets/spinning_carrousel.zip')).load()))!;
var composition = (await tester.runAsync(() =>
FileLottie(File('example/assets/spinning_carrousel.zip')).load()))!;
var delegates = LottieDelegates(image: (composition, asset) {
return image;

View File

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

View File

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

View File

@ -13,7 +13,7 @@ void main() {
tester.binding.window.devicePixelRatioTestValue = 1.0;
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));

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';
void main() {
var root = 'assets';
var root = 'example/assets';
for (var asset in Directory(root)
.listSync(recursive: true)
.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