Compare commits

...

8 Commits

Author SHA1 Message Date
d0edd1b3ee Fix web version (#135) 2021-02-22 08:42:09 +01:00
6831f475d4 Add an image delegate to dynamically change images (#130)
And allow to use an imageProviderFactory with a zip file.
2021-02-08 22:25:58 +01:00
bbfe04f00d Remove prints (#129) 2021-02-06 14:42:46 +01:00
5b7fde198a Fix bounds calculation bug (#128) 2021-02-06 09:32:25 +01:00
fe8847a5ba Fix publish action 2021-01-23 11:26:38 +01:00
2360f643b7 Migrate to null safety (#127) 2021-01-23 11:09:32 +01:00
1146e1f01d Add bad golden tests (#118) 2020-12-29 19:07:10 +01:00
ba0bfcd126 Fix crash when path.computeMetrics returns empty list (#116) 2020-12-12 22:41:38 +01:00
233 changed files with 12287 additions and 1507 deletions

View File

@ -10,7 +10,7 @@ jobs:
name: Flutter analyze name: Flutter analyze
strategy: strategy:
matrix: matrix:
flutter: ['stable'] flutter: ['beta']
runs-on: macos-latest runs-on: macos-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
@ -33,3 +33,17 @@ jobs:
"and check in all changes" \ "and check in all changes" \
&& exit 1) && exit 1)
shell: bash shell: bash
build_web_version:
name: Check that the web version compile
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: subosito/flutter-action@v1
with:
channel: 'beta'
- run: flutter config --enable-web
- run: flutter precache web
- run: flutter pub get
working-directory: example
- run: flutter build web
working-directory: example

View File

@ -10,12 +10,11 @@ jobs:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- uses: subosito/flutter-action@v1 - uses: subosito/flutter-action@v1
with: with:
channel: 'stable' channel: 'beta'
- 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
- run: echo ::set-env name=RELEASE_VERSION::${GITHUB_REF} - run: flutter pub run tool/publish/check_version.dart ${GITHUB_REF}
- run: flutter pub run tool/publish/check_version.dart ${{ env.RELEASE_VERSION }}
- name: Setup credentials - name: Setup credentials
run: | run: |
mkdir -p $FLUTTER_HOME/.pub-cache mkdir -p $FLUTTER_HOME/.pub-cache

View File

@ -1,3 +1,10 @@
## [0.8.0]
- Migrate to null safety
- Fix some rendering bugs
## [0.7.1]
- Fix a crash for some lottie file with empty paths.
## [0.7.0+1] ## [0.7.0+1]
- Fix Flutter Web compilation error - Fix Flutter Web compilation error

View File

@ -64,7 +64,7 @@ class MyApp extends StatefulWidget {
} }
class _MyAppState extends State<MyApp> with TickerProviderStateMixin { class _MyAppState extends State<MyApp> with TickerProviderStateMixin {
AnimationController _controller; late final AnimationController _controller;
@override @override
void initState() { void initState() {
@ -137,7 +137,7 @@ class MyWidget extends StatefulWidget {
} }
class _MyWidgetState extends State<MyWidget> { class _MyWidgetState extends State<MyWidget> {
Future<LottieComposition> _composition; late final Future<LottieComposition> _composition;
@override @override
void initState() { void initState() {
@ -176,7 +176,7 @@ a specific position and size.
class CustomDrawer extends StatelessWidget { class CustomDrawer extends StatelessWidget {
final LottieComposition composition; final LottieComposition composition;
const CustomDrawer(this.composition, {Key key}) : super(key: key); const CustomDrawer(this.composition, {Key? key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

7280
example/assets/envelope.json Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@ -1,2 +1,3 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
#include "Generated.xcconfig" #include "Generated.xcconfig"

View File

@ -1,2 +1,3 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include "Generated.xcconfig" #include "Generated.xcconfig"

View File

@ -23,7 +23,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

@ -6,7 +6,7 @@ void main() async {
} }
class App extends StatelessWidget { class App extends StatelessWidget {
const App({Key key}) : super(key: key); const App({Key? key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {

View File

@ -9,7 +9,7 @@ class MyApp extends StatefulWidget {
} }
class _MyAppState extends State<MyApp> with TickerProviderStateMixin { class _MyAppState extends State<MyApp> with TickerProviderStateMixin {
AnimationController _controller; late final AnimationController _controller;
@override @override
void initState() { void initState() {

View File

@ -17,7 +17,7 @@ class MyApp extends StatefulWidget {
} }
class _MyAppState extends State<MyApp> with TickerProviderStateMixin { class _MyAppState extends State<MyApp> with TickerProviderStateMixin {
AnimationController _controller; late final AnimationController _controller;
@override @override
void initState() { void initState() {
@ -86,7 +86,7 @@ class _MyAppState extends State<MyApp> with TickerProviderStateMixin {
], ],
), ),
const SizedBox(height: 30), const SizedBox(height: 30),
RaisedButton( ElevatedButton(
child: Text('Loop between frames'), child: Text('Loop between frames'),
onPressed: () { onPressed: () {
// Loop between 2 specifics frames // Loop between 2 specifics frames
@ -97,7 +97,7 @@ class _MyAppState extends State<MyApp> with TickerProviderStateMixin {
min: start, min: start,
max: stop, max: stop,
reverse: true, reverse: true,
period: _controller.duration * (stop - start), period: _controller.duration! * (stop - start),
); );
}, },
), ),

View File

@ -22,7 +22,7 @@ class MyWidget extends StatefulWidget {
} }
class _MyWidgetState extends State<MyWidget> { class _MyWidgetState extends State<MyWidget> {
Future<LottieComposition> _composition; late final Future<LottieComposition> _composition;
@override @override
void initState() { void initState() {
@ -57,7 +57,7 @@ class _MyWidgetState extends State<MyWidget> {
class CustomDrawer extends StatelessWidget { class CustomDrawer extends StatelessWidget {
final LottieComposition composition; final LottieComposition composition;
const CustomDrawer(this.composition, {Key key}) : super(key: key); const CustomDrawer(this.composition, {Key? key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {

View File

@ -23,7 +23,7 @@ class MyWidget extends StatefulWidget {
} }
class _MyWidgetState extends State<MyWidget> { class _MyWidgetState extends State<MyWidget> {
Future<LottieComposition> _composition; late final Future<LottieComposition> _composition;
@override @override
void initState() { void initState() {

View File

@ -8,7 +8,7 @@ void main() async {
} }
class App extends StatefulWidget { class App extends StatefulWidget {
const App({Key key}) : super(key: key); const App({Key? key}) : super(key: key);
@override @override
_AppState createState() => _AppState(); _AppState createState() => _AppState();
@ -50,7 +50,7 @@ class _AppState extends State<App> with TickerProviderStateMixin {
value: _useDelegates, value: _useDelegates,
onChanged: (newValue) { onChanged: (newValue) {
setState(() { setState(() {
_useDelegates = newValue; _useDelegates = newValue!;
}); });
}, },
), ),

View File

@ -7,14 +7,14 @@ void main() async {
} }
class App extends StatefulWidget { class App extends StatefulWidget {
const App({Key key}) : super(key: key); const App({Key? key}) : super(key: key);
@override @override
_AppState createState() => _AppState(); _AppState createState() => _AppState();
} }
class _AppState extends State<App> with TickerProviderStateMixin { class _AppState extends State<App> with TickerProviderStateMixin {
TextEditingController _textController; late final TextEditingController _textController;
@override @override
void initState() { void initState() {

View File

@ -6,14 +6,14 @@ void main() async {
} }
class App extends StatefulWidget { class App extends StatefulWidget {
const App({Key key}) : super(key: key); const App({Key? key}) : super(key: key);
@override @override
_AppState createState() => _AppState(); _AppState createState() => _AppState();
} }
class _AppState extends State<App> with TickerProviderStateMixin { class _AppState extends State<App> with TickerProviderStateMixin {
AnimationController _animationController; late final AnimationController _animationController;
bool _showAnimation = true; bool _showAnimation = true;
@override @override

View File

@ -9,14 +9,14 @@ void main() async {
} }
class App extends StatefulWidget { class App extends StatefulWidget {
const App({Key key}) : super(key: key); const App({Key? key}) : super(key: key);
@override @override
_AppState createState() => _AppState(); _AppState createState() => _AppState();
} }
class _AppState extends State<App> with TickerProviderStateMixin { class _AppState extends State<App> with TickerProviderStateMixin {
Future<LottieComposition> _composition; late final Future<LottieComposition> _composition;
@override @override
void initState() { void initState() {
@ -35,9 +35,9 @@ class _AppState extends State<App> with TickerProviderStateMixin {
body: FutureBuilder<LottieComposition>( body: FutureBuilder<LottieComposition>(
future: _composition, future: _composition,
builder: (context, snapshot) { builder: (context, snapshot) {
if (snapshot.hasError) return ErrorWidget(snapshot.error); if (snapshot.hasError) return ErrorWidget(snapshot.error!);
if (!snapshot.hasData) return CircularProgressIndicator(); if (!snapshot.hasData) return CircularProgressIndicator();
return _LottieDetails(snapshot.data); return _LottieDetails(snapshot.data!);
}, },
), ),
), ),
@ -48,7 +48,7 @@ class _AppState extends State<App> with TickerProviderStateMixin {
class _LottieDetails extends StatefulWidget { class _LottieDetails extends StatefulWidget {
final LottieComposition composition; final LottieComposition composition;
const _LottieDetails(this.composition, {Key key}) : super(key: key); const _LottieDetails(this.composition, {Key? key}) : super(key: key);
@override @override
_LottieDetailsState createState() => _LottieDetailsState(); _LottieDetailsState createState() => _LottieDetailsState();
@ -56,7 +56,7 @@ class _LottieDetails extends StatefulWidget {
class _LottieDetailsState extends State<_LottieDetails> class _LottieDetailsState extends State<_LottieDetails>
with TickerProviderStateMixin { with TickerProviderStateMixin {
AnimationController _controller; late final AnimationController _controller;
@override @override
void initState() { void initState() {
@ -87,15 +87,15 @@ class _LottieDetailsState extends State<_LottieDetails>
title: Text('Composition duration'), title: Text('Composition duration'),
trailing: Text(widget.composition.durationFrames.toStringAsFixed(1)), trailing: Text(widget.composition.durationFrames.toStringAsFixed(1)),
), ),
RaisedButton( ElevatedButton(
child: Text('touchDownEnd - touchUpCancel'), child: Text('touchDownEnd - touchUpCancel'),
onPressed: () => _playBetween('touchDownEnd', 'touchUpCancel'), onPressed: () => _playBetween('touchDownEnd', 'touchUpCancel'),
), ),
RaisedButton( ElevatedButton(
child: Text('touchDownStart - touchDownEnd'), child: Text('touchDownStart - touchDownEnd'),
onPressed: () => _playBetween('touchDownStart', 'touchDownEnd'), onPressed: () => _playBetween('touchDownStart', 'touchDownEnd'),
), ),
RaisedButton( ElevatedButton(
child: Text('touchDownEnd - touchUpEnd'), child: Text('touchDownEnd - touchUpEnd'),
onPressed: () => _playBetween('touchDownEnd', 'touchUpEnd'), onPressed: () => _playBetween('touchDownEnd', 'touchUpEnd'),
), ),
@ -112,8 +112,8 @@ class _LottieDetailsState extends State<_LottieDetails>
} }
void _playBetween(String marker1, String marker2) { void _playBetween(String marker1, String marker2) {
var start = widget.composition.getMarker(marker1).start; var start = widget.composition.getMarker(marker1)!.start;
var end = widget.composition.getMarker(marker2).start; var end = widget.composition.getMarker(marker2)!.start;
_controller.value = start; _controller.value = start;
_controller.animateTo(end, _controller.animateTo(end,

View File

@ -0,0 +1,63 @@
import 'package:flutter/material.dart';
import 'package:lottie/lottie.dart';
void main() => runApp(MyApp());
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> with TickerProviderStateMixin {
late final AnimationController _controller;
int _repeatIndex = 0;
@override
void initState() {
super.initState();
_controller = AnimationController(vsync: this)
..addStatusListener((status) {
if (status == AnimationStatus.completed) {
setState(() {
_repeatIndex++;
});
if (_repeatIndex < 5) {
_controller.reset();
_controller.forward();
}
}
});
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: ListView(
children: [
Lottie.asset(
'assets/AndroidWave.json',
controller: _controller,
width: 150,
height: 150,
onLoaded: (composition) {
// Configure the AnimationController with the duration of the
// Lottie file and start the animation.
_controller.duration = composition.duration;
_controller.forward();
},
),
Center(child: Text('Repeat: $_repeatIndex')),
],
),
),
);
}
@override
void dispose() {
_controller.dispose();
super.dispose();
}
}

View File

@ -12,7 +12,7 @@ void main() async {
} }
class App extends StatefulWidget { class App extends StatefulWidget {
const App({Key key}) : super(key: key); const App({Key? key}) : super(key: key);
@override @override
_AppState createState() => _AppState(); _AppState createState() => _AppState();
@ -20,7 +20,7 @@ class App extends StatefulWidget {
class _AppState extends State<App> with TickerProviderStateMixin { class _AppState extends State<App> with TickerProviderStateMixin {
int _index = 0; int _index = 0;
AnimationController _animationController; late final AnimationController _animationController;
@override @override
void initState() { void initState() {

View File

@ -1,3 +1,5 @@
//@dart=2.10
import 'dart:io'; import 'dart:io';
import 'dart:ui'; import 'dart:ui';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -26,7 +28,7 @@ class _MyAppState extends State<MyApp> {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch, crossAxisAlignment: CrossAxisAlignment.stretch,
children: [ children: [
RaisedButton( ElevatedButton(
child: Text('Export all frames'), child: Text('Export all frames'),
onPressed: _export, onPressed: _export,
), ),

View File

@ -21,32 +21,36 @@ class App extends StatelessWidget {
appBar: AppBar( appBar: AppBar(
title: Text('Lottie Flutter'), title: Text('Lottie Flutter'),
), ),
body: GridView.builder( body: Scrollbar(
itemCount: files.length, child: GridView.builder(
gridDelegate: itemCount: files.length,
SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 4), gridDelegate:
itemBuilder: (context, index) { SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 4),
var assetName = files[index]; itemBuilder: (context, index) {
return GestureDetector( var assetName = files[index];
child: _Item( return GestureDetector(
child: Lottie.asset( child: _Item(
assetName, child: Lottie.asset(
frameBuilder: (context, child, composition) { assetName,
return AnimatedOpacity( frameBuilder: (context, child, composition) {
child: child, return AnimatedOpacity(
opacity: composition == null ? 0 : 1, child: child,
duration: const Duration(seconds: 1), opacity: composition == null ? 0 : 1,
curve: Curves.easeOut, duration: const Duration(seconds: 1),
); curve: Curves.easeOut,
}, );
},
),
), ),
), onTap: () {
onTap: () { Navigator.push(
Navigator.of(context).push(MaterialPageRoute<void>( context,
builder: (context) => Detail(assetName))); MaterialPageRoute<void>(
}, builder: (context) => Detail(assetName)));
); },
}, );
},
),
), ),
), ),
); );
@ -56,7 +60,7 @@ class App extends StatelessWidget {
class _Item extends StatelessWidget { class _Item extends StatelessWidget {
final Widget child; final Widget child;
const _Item({Key key, this.child}) : super(key: key); const _Item({Key? key, required this.child}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -81,26 +85,18 @@ class _Item extends StatelessWidget {
class Detail extends StatefulWidget { class Detail extends StatefulWidget {
final String assetName; final String assetName;
const Detail(this.assetName, {Key key}) : super(key: key); const Detail(this.assetName, {Key? key}) : super(key: key);
@override @override
_DetailState createState() => _DetailState(); _DetailState createState() => _DetailState();
} }
class _DetailState extends State<Detail> with TickerProviderStateMixin { class _DetailState extends State<Detail> with TickerProviderStateMixin {
AnimationController _controller; late final _controller = AnimationController(vsync: this);
@override
void initState() {
super.initState();
_controller = AnimationController(vsync: this);
}
@override @override
void dispose() { void dispose() {
_controller.dispose(); _controller.dispose();
super.dispose(); super.dispose();
} }

View File

@ -13,7 +13,7 @@ void main() async {
class App extends StatelessWidget { class App extends StatelessWidget {
final LottieComposition composition; final LottieComposition composition;
const App({Key key, this.composition}) : super(key: key); const App({Key? key, required this.composition}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -97,13 +97,13 @@ class App extends StatelessWidget {
class _Lottie extends StatefulWidget { class _Lottie extends StatefulWidget {
final LottieComposition composition; final LottieComposition composition;
final double width; final double? width;
final double height; final double? height;
final BoxFit fit; final BoxFit? fit;
final AlignmentGeometry alignment; final AlignmentGeometry? alignment;
const _Lottie(this.composition, const _Lottie(this.composition,
{Key key, this.width, this.height, this.fit, this.alignment}) {Key? key, this.width, this.height, this.fit, this.alignment})
: super(key: key); : super(key: key);
@override @override
@ -111,7 +111,7 @@ class _Lottie extends StatefulWidget {
} }
class __LottieState extends State<_Lottie> with TickerProviderStateMixin { class __LottieState extends State<_Lottie> with TickerProviderStateMixin {
AnimationController _controller; late AnimationController _controller;
@override @override
void initState() { void initState() {

View File

@ -6,7 +6,7 @@ void main() async {
} }
class App extends StatelessWidget { class App extends StatelessWidget {
const App({Key key}) : super(key: key); const App({Key? key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {

View File

@ -6,7 +6,7 @@ void main() async {
} }
class App extends StatelessWidget { class App extends StatelessWidget {
const App({Key key}) : super(key: key); const App({Key? key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {

View File

@ -1,2 +1,3 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
#include "ephemeral/Flutter-Generated.xcconfig" #include "ephemeral/Flutter-Generated.xcconfig"

View File

@ -1,2 +1,3 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include "ephemeral/Flutter-Generated.xcconfig" #include "ephemeral/Flutter-Generated.xcconfig"

View File

@ -1,27 +1,28 @@
PODS: PODS:
- FlutterMacOS (1.0.0) - FlutterMacOS (1.22.4)
- path_provider (0.0.1) - path_provider (0.0.1)
- path_provider_macos (0.0.1): - path_provider_macos (0.0.1):
- FlutterMacOS - FlutterMacOS
DEPENDENCIES: DEPENDENCIES:
- FlutterMacOS (from `Flutter/ephemeral/.symlinks/flutter/darwin-x64-profile`)
- path_provider (from `Flutter/ephemeral/.symlinks/plugins/path_provider/macos`) - path_provider (from `Flutter/ephemeral/.symlinks/plugins/path_provider/macos`)
- path_provider_macos (from `Flutter/ephemeral/.symlinks/plugins/path_provider_macos/macos`) - path_provider_macos (from `Flutter/ephemeral/.symlinks/plugins/path_provider_macos/macos`)
SPEC REPOS:
trunk:
- FlutterMacOS
EXTERNAL SOURCES: EXTERNAL SOURCES:
FlutterMacOS:
:path: Flutter/ephemeral/.symlinks/flutter/darwin-x64-profile
path_provider: path_provider:
:path: Flutter/ephemeral/.symlinks/plugins/path_provider/macos :path: Flutter/ephemeral/.symlinks/plugins/path_provider/macos
path_provider_macos: path_provider_macos:
:path: Flutter/ephemeral/.symlinks/plugins/path_provider_macos/macos :path: Flutter/ephemeral/.symlinks/plugins/path_provider_macos/macos
SPEC CHECKSUMS: SPEC CHECKSUMS:
FlutterMacOS: 15bea8a44d2fa024068daa0140371c020b4b6ff9 FlutterMacOS: ac210ef71944b3f04789076d70d4c72c7ec0c619
path_provider: e0848572d1d38b9a7dd099e79cf83f5b7e2cde9f path_provider: e0848572d1d38b9a7dd099e79cf83f5b7e2cde9f
path_provider_macos: a0a3fd666cb7cd0448e936fb4abad4052961002b path_provider_macos: a0a3fd666cb7cd0448e936fb4abad4052961002b
PODFILE CHECKSUM: d8ba9b3e9e93c62c74a660b46c6fcb09f03991a7 PODFILE CHECKSUM: d8ba9b3e9e93c62c74a660b46c6fcb09f03991a7
COCOAPODS: 1.9.1 COCOAPODS: 1.10.1

View File

@ -26,10 +26,6 @@
33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F22044A3C60003C045 /* Assets.xcassets */; }; 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F22044A3C60003C045 /* Assets.xcassets */; };
33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; }; 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; };
33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; }; 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; };
33D1A10422148B71006C7A3E /* FlutterMacOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 33D1A10322148B71006C7A3E /* FlutterMacOS.framework */; };
33D1A10522148B93006C7A3E /* FlutterMacOS.framework in Bundle Framework */ = {isa = PBXBuildFile; fileRef = 33D1A10322148B71006C7A3E /* FlutterMacOS.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
D73912F022F37F9E000D13A0 /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D73912EF22F37F9E000D13A0 /* App.framework */; };
D73912F222F3801D000D13A0 /* App.framework in Bundle Framework */ = {isa = PBXBuildFile; fileRef = D73912EF22F37F9E000D13A0 /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
F03CC91740A974D36C2A6384 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0BC6FF5FCD90624533CC60DB /* Pods_Runner.framework */; }; F03CC91740A974D36C2A6384 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0BC6FF5FCD90624533CC60DB /* Pods_Runner.framework */; };
/* End PBXBuildFile section */ /* End PBXBuildFile section */
@ -50,8 +46,6 @@
dstPath = ""; dstPath = "";
dstSubfolderSpec = 10; dstSubfolderSpec = 10;
files = ( files = (
D73912F222F3801D000D13A0 /* App.framework in Bundle Framework */,
33D1A10522148B93006C7A3E /* FlutterMacOS.framework in Bundle Framework */,
); );
name = "Bundle Framework"; name = "Bundle Framework";
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
@ -73,14 +67,12 @@
33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Debug.xcconfig"; sourceTree = "<group>"; }; 33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Debug.xcconfig"; sourceTree = "<group>"; };
33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Release.xcconfig"; sourceTree = "<group>"; }; 33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Release.xcconfig"; sourceTree = "<group>"; };
33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = "Flutter-Generated.xcconfig"; path = "ephemeral/Flutter-Generated.xcconfig"; sourceTree = "<group>"; }; 33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = "Flutter-Generated.xcconfig"; path = "ephemeral/Flutter-Generated.xcconfig"; sourceTree = "<group>"; };
33D1A10322148B71006C7A3E /* FlutterMacOS.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = FlutterMacOS.framework; path = Flutter/ephemeral/FlutterMacOS.framework; sourceTree = SOURCE_ROOT; };
33E51913231747F40026EE4D /* DebugProfile.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DebugProfile.entitlements; sourceTree = "<group>"; }; 33E51913231747F40026EE4D /* DebugProfile.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DebugProfile.entitlements; sourceTree = "<group>"; };
33E51914231749380026EE4D /* Release.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Release.entitlements; sourceTree = "<group>"; }; 33E51914231749380026EE4D /* Release.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Release.entitlements; sourceTree = "<group>"; };
33E5194F232828860026EE4D /* AppInfo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AppInfo.xcconfig; sourceTree = "<group>"; }; 33E5194F232828860026EE4D /* AppInfo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AppInfo.xcconfig; sourceTree = "<group>"; };
5B4C0E87024EC2686CA05E23 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; }; 5B4C0E87024EC2686CA05E23 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = "<group>"; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = "<group>"; };
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = "<group>"; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = "<group>"; };
D73912EF22F37F9E000D13A0 /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/ephemeral/App.framework; sourceTree = SOURCE_ROOT; };
/* End PBXFileReference section */ /* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */ /* Begin PBXFrameworksBuildPhase section */
@ -88,8 +80,6 @@
isa = PBXFrameworksBuildPhase; isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
D73912F022F37F9E000D13A0 /* App.framework in Frameworks */,
33D1A10422148B71006C7A3E /* FlutterMacOS.framework in Frameworks */,
F03CC91740A974D36C2A6384 /* Pods_Runner.framework in Frameworks */, F03CC91740A974D36C2A6384 /* Pods_Runner.framework in Frameworks */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
@ -145,8 +135,6 @@
33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */, 33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */,
33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */, 33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */,
33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */, 33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */,
D73912EF22F37F9E000D13A0 /* App.framework */,
33D1A10322148B71006C7A3E /* FlutterMacOS.framework */,
); );
path = Flutter; path = Flutter;
sourceTree = "<group>"; sourceTree = "<group>";
@ -281,7 +269,7 @@
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh; shellPath = /bin/sh;
shellScript = "echo \"$PRODUCT_NAME.app\" > \"$PROJECT_DIR\"/Flutter/ephemeral/.app_filename\n"; shellScript = "echo \"$PRODUCT_NAME.app\" > \"$PROJECT_DIR\"/Flutter/ephemeral/.app_filename && \"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh embed\n";
}; };
33CC111E2044C6BF0003C045 /* ShellScript */ = { 33CC111E2044C6BF0003C045 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase; isa = PBXShellScriptBuildPhase;
@ -330,10 +318,10 @@
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
); );
inputFileListPaths = ( inputPaths = (
); );
name = "[CP] Embed Pods Frameworks"; name = "[CP] Embed Pods Frameworks";
outputFileListPaths = ( outputPaths = (
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh; shellPath = /bin/sh;

View File

@ -7,77 +7,63 @@ packages:
name: archive name: archive
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.13" version: "3.0.0"
args:
dependency: transitive
description:
name: args
url: "https://pub.dartlang.org"
source: hosted
version: "1.6.0"
async: async:
dependency: transitive dependency: transitive
description: description:
name: async name: async
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.5.0-nullsafety.1" version: "2.5.0"
boolean_selector: boolean_selector:
dependency: transitive dependency: transitive
description: description:
name: boolean_selector name: boolean_selector
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.0-nullsafety.1" version: "2.1.0"
characters: characters:
dependency: transitive dependency: transitive
description: description:
name: characters name: characters
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.0-nullsafety.3" version: "1.1.0"
charcode: charcode:
dependency: transitive dependency: transitive
description: description:
name: charcode name: charcode
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.2.0-nullsafety.1" version: "1.2.0"
clock: clock:
dependency: transitive dependency: transitive
description: description:
name: clock name: clock
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.0-nullsafety.1" version: "1.1.0"
collection: collection:
dependency: transitive dependency: transitive
description: description:
name: collection name: collection
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.15.0-nullsafety.3" version: "1.15.0"
convert:
dependency: transitive
description:
name: convert
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.1"
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: "2.1.5" version: "3.0.0"
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-nullsafety.1" version: "1.2.0"
ffi: ffi:
dependency: transitive dependency: transitive
description: description:
@ -103,7 +89,7 @@ packages:
name: flutter_colorpicker name: flutter_colorpicker
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.3.4" version: "0.4.0-nullsafety.0"
flutter_test: flutter_test:
dependency: "direct dev" dependency: "direct dev"
description: flutter description: flutter
@ -115,7 +101,7 @@ packages:
name: golden_toolkit name: golden_toolkit
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.6.0" version: "0.9.0-nullsafety.0"
http: http:
dependency: "direct main" dependency: "direct main"
description: description:
@ -143,42 +129,42 @@ packages:
name: logging name: logging
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.11.4" version: "1.0.0"
lottie: lottie:
dependency: "direct main" dependency: "direct main"
description: description:
path: ".." path: ".."
relative: true relative: true
source: path source: path
version: "0.7.0+1" version: "0.8.0-nullsafety.4"
matcher: matcher:
dependency: transitive dependency: transitive
description: description:
name: matcher name: matcher
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.12.10-nullsafety.1" version: "0.12.10"
meta: meta:
dependency: transitive dependency: transitive
description: description:
name: meta name: meta
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.3.0-nullsafety.3" version: "1.3.0"
path: path:
dependency: transitive dependency: transitive
description: description:
name: path name: path
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.8.0-nullsafety.1" version: "1.8.0"
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: "1.6.21" version: "1.6.27"
path_provider_linux: path_provider_linux:
dependency: transitive dependency: transitive
description: description:
@ -192,21 +178,21 @@ packages:
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+4" version: "0.0.4+8"
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.3" version: "1.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: "0.0.4+1" version: "0.0.4+3"
pedantic: pedantic:
dependency: transitive dependency: transitive
description: description:
@ -246,63 +232,63 @@ 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-nullsafety.2" version: "1.8.0"
stack_trace: stack_trace:
dependency: transitive dependency: transitive
description: description:
name: stack_trace name: stack_trace
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.10.0-nullsafety.1" version: "1.10.0"
stream_channel: stream_channel:
dependency: transitive dependency: transitive
description: description:
name: stream_channel name: stream_channel
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.0-nullsafety.1" version: "2.1.0"
string_scanner: string_scanner:
dependency: transitive dependency: transitive
description: description:
name: string_scanner name: string_scanner
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.0-nullsafety.1" version: "1.1.0"
term_glyph: term_glyph:
dependency: transitive dependency: transitive
description: description:
name: term_glyph name: term_glyph
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.2.0-nullsafety.1" version: "1.2.0"
test_api: test_api:
dependency: transitive dependency: transitive
description: description:
name: test_api name: test_api
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.2.19-nullsafety.2" version: "0.2.19"
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-nullsafety.3" version: "1.3.0"
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.0-nullsafety.3" version: "2.1.0"
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: "1.7.3" version: "1.7.4"
xdg_directories: xdg_directories:
dependency: transitive dependency: transitive
description: description:
@ -311,5 +297,5 @@ packages:
source: hosted source: hosted
version: "0.1.2" version: "0.1.2"
sdks: sdks:
dart: ">=2.10.0-110 <2.11.0" dart: ">=2.12.0-29.10.beta <3.0.0"
flutter: ">=1.12.13+hotfix.5 <2.0.0" flutter: ">=1.24.0-10.2.pre"

View File

@ -1,14 +1,14 @@
name: lottie_example name: lottie_example
description: A sample app for the Lottie player description: A sample app for the Lottie player
version: 0.0.1 publish_to: none
environment: environment:
sdk: ">=2.7.0 <3.0.0" sdk: ">=2.12.0-0 <3.0.0"
dependencies: dependencies:
flutter: flutter:
sdk: flutter sdk: flutter
flutter_colorpicker: flutter_colorpicker: ^0.4.0-nullsafety.0
http: http:
lottie: lottie:
path: ../ path: ../
@ -17,7 +17,7 @@ dependencies:
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:
sdk: flutter sdk: flutter
golden_toolkit: 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
@ -31,6 +31,7 @@ flutter:
- assets/lottiefiles/ - assets/lottiefiles/
- assets/Mobilo/ - assets/Mobilo/
- assets/Tests/ - assets/Tests/
- assets/Tests/images/
- assets/Logo/ - assets/Logo/
- assets/Images/ - assets/Images/
- assets/Images/WeAccept/ - assets/Images/WeAccept/

View File

@ -0,0 +1,74 @@
import 'dart:async';
import 'dart:io';
import 'dart:ui' as ui;
import 'package:flutter/widgets.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:lottie/lottie.dart';
import 'utils.dart';
void main() {
testWidgets('Can specify ImageProvider with zip file ', (tester) async {
var size = Size(500, 400);
tester.binding.window.physicalSizeTestValue = size;
tester.binding.window.devicePixelRatioTestValue = 1.0;
var callCount = 0;
LottieImageProviderFactory imageProviderFactory = (image) {
++callCount;
return FileImage(File('assets/Images/WeAccept/img_0.png'));
};
var composition = (await tester.runAsync(() => FileLottie(
File('assets/spinning_carrousel.zip'),
imageProviderFactory: imageProviderFactory)
.load()))!;
await tester.pumpWidget(FilmStrip(composition, size: size));
expect(callCount, 2);
await expectLater(find.byType(FilmStrip),
matchesGoldenFile('goldens/dynamic_image/zip_with_provider.png'));
});
testWidgets('Can specify image delegate', (tester) async {
var size = Size(500, 400);
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 composition = (await tester.runAsync(
() => FileLottie(File('assets/spinning_carrousel.zip')).load()))!;
var delegates = LottieDelegates(image: (composition, asset) {
return image;
});
await tester.pumpWidget(FilmStrip(
composition,
size: size,
delegates: delegates,
));
await expectLater(find.byType(FilmStrip),
matchesGoldenFile('goldens/dynamic_image/delegate.png'));
});
}
Future<ui.Image?> loadImage(ImageProvider provider) {
var completer = Completer<ui.Image?>();
var imageStream = provider.resolve(ImageConfiguration.empty);
late ImageStreamListener listener;
listener = ImageStreamListener((image, synchronousLoaded) {
imageStream.removeListener(listener);
completer.complete(image.image);
}, onError: (dynamic e, __) {
imageStream.removeListener(listener);
completer.complete();
});
imageStream.addListener(listener);
return completer.future;
}

View File

@ -7,7 +7,7 @@ import 'package:lottie/lottie.dart';
import 'utils.dart'; import 'utils.dart';
void main() { void main() {
LottieComposition composition; late LottieComposition composition;
setUpAll(() async { setUpAll(() async {
composition = await LottieComposition.fromBytes( composition = await LottieComposition.fromBytes(
@ -15,7 +15,7 @@ void main() {
}); });
void testGolden(String description, ValueDelegate delegate, void testGolden(String description, ValueDelegate delegate,
{double progress}) async { {double? progress}) async {
var screenshotName = description var screenshotName = description
.toLowerCase() .toLowerCase()
.replaceAll(RegExp('[^a-z0-9 ]'), '') .replaceAll(RegExp('[^a-z0-9 ]'), '')
@ -288,8 +288,8 @@ void main() {
testGolden( testGolden(
'Opacity interpolation ($progress)', 'Opacity interpolation ($progress)',
ValueDelegate.transformOpacity(['Shape Layer 1', 'Rectangle'], ValueDelegate.transformOpacity(['Shape Layer 1', 'Rectangle'],
callback: (frameInfo) => lerpDouble( callback: (frameInfo) => lerpDouble(10, 100,
10, 100, Curves.linear.transform(frameInfo.overallProgress)) Curves.linear.transform(frameInfo.overallProgress))!
.round()), .round()),
progress: progress); progress: progress);
} }

View File

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

View File

@ -16,7 +16,8 @@ void main() {
var size = Size(500, 400); var size = Size(500, 400);
tester.binding.window.physicalSizeTestValue = size; tester.binding.window.physicalSizeTestValue = size;
tester.binding.window.devicePixelRatioTestValue = 1.0; tester.binding.window.devicePixelRatioTestValue = 1.0;
var composition = await tester.runAsync(() => FileLottie(asset).load()); var composition =
(await tester.runAsync(() => FileLottie(asset).load()))!;
await tester.pumpWidget(FilmStrip(composition, size: size)); await tester.pumpWidget(FilmStrip(composition, size: size));

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.5 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.2 KiB

After

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 884 B

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 62 KiB

After

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 53 KiB

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.5 KiB

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 65 KiB

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 43 KiB

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.0 KiB

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

View File

@ -3,11 +3,11 @@ import 'package:lottie/lottie.dart';
class FilmStrip extends StatelessWidget { class FilmStrip extends StatelessWidget {
final LottieComposition composition; final LottieComposition composition;
final LottieDelegates delegates; final LottieDelegates? delegates;
final Size size; final Size size;
const FilmStrip(this.composition, const FilmStrip(this.composition,
{Key key, @required this.size, this.delegates}) {Key? key, required this.size, this.delegates})
: super(key: key); : super(key: key);
@override @override

View File

@ -9,6 +9,7 @@ export 'src/model/marker.dart' show Marker;
export 'src/options.dart' show LottieOptions; export 'src/options.dart' show LottieOptions;
export 'src/providers/asset_provider.dart' show AssetLottie; export 'src/providers/asset_provider.dart' show AssetLottie;
export 'src/providers/file_provider.dart' show FileLottie; export 'src/providers/file_provider.dart' show FileLottie;
export 'src/providers/load_image.dart' show LottieImageProviderFactory;
export 'src/providers/lottie_provider.dart' show LottieProvider; export 'src/providers/lottie_provider.dart' show LottieProvider;
export 'src/providers/memory_provider.dart' show MemoryLottie; export 'src/providers/memory_provider.dart' show MemoryLottie;
export 'src/providers/network_provider.dart' show NetworkLottie; export 'src/providers/network_provider.dart' show NetworkLottie;

View File

@ -34,21 +34,20 @@ abstract class BaseStrokeContent
final List<double> _dashPatternValues; final List<double> _dashPatternValues;
final Paint paint = Paint()..style = PaintingStyle.stroke; final Paint paint = Paint()..style = PaintingStyle.stroke;
final BaseKeyframeAnimation<dynamic, double> _widthAnimation; final BaseKeyframeAnimation<Object, double> _widthAnimation;
final BaseKeyframeAnimation<dynamic, int> _opacityAnimation; final BaseKeyframeAnimation<Object, int> _opacityAnimation;
final List<BaseKeyframeAnimation<dynamic, double>> _dashPatternAnimations; final List<BaseKeyframeAnimation<Object, double>> _dashPatternAnimations;
final BaseKeyframeAnimation<dynamic, final BaseKeyframeAnimation<Object, double>? _dashPatternOffsetAnimation;
double> /*?*/ _dashPatternOffsetAnimation; BaseKeyframeAnimation<ColorFilter, ColorFilter?>? _colorFilterAnimation;
BaseKeyframeAnimation<ColorFilter, ColorFilter> /*?*/ _colorFilterAnimation;
BaseStrokeContent(this.lottieDrawable, this.layer, BaseStrokeContent(this.lottieDrawable, this.layer,
{StrokeCap cap, {required StrokeCap cap,
StrokeJoin join, required StrokeJoin join,
double miterLimit, required double miterLimit,
AnimatableIntegerValue opacity, required AnimatableIntegerValue opacity,
AnimatableDoubleValue width, required AnimatableDoubleValue width,
List<AnimatableDoubleValue> dashPattern, required List<AnimatableDoubleValue> dashPattern,
AnimatableDoubleValue dashOffset}) AnimatableDoubleValue? dashOffset})
: _widthAnimation = width.createAnimation(), : _widthAnimation = width.createAnimation(),
_opacityAnimation = opacity.createAnimation(), _opacityAnimation = opacity.createAnimation(),
_dashPatternOffsetAnimation = dashOffset?.createAnimation(), _dashPatternOffsetAnimation = dashOffset?.createAnimation(),
@ -76,7 +75,7 @@ abstract class BaseStrokeContent
_dashPatternAnimations[i].addUpdateListener(onUpdateListener); _dashPatternAnimations[i].addUpdateListener(onUpdateListener);
} }
if (_dashPatternOffsetAnimation != null) { if (_dashPatternOffsetAnimation != null) {
_dashPatternOffsetAnimation.addUpdateListener(onUpdateListener); _dashPatternOffsetAnimation!.addUpdateListener(onUpdateListener);
} }
} }
@ -86,7 +85,7 @@ abstract class BaseStrokeContent
@override @override
void setContents(List<Content> contentsBefore, List<Content> contentsAfter) { void setContents(List<Content> contentsBefore, List<Content> contentsAfter) {
TrimPathContent trimPathContentBefore; TrimPathContent? trimPathContentBefore;
for (var i = contentsBefore.length - 1; i >= 0; i--) { for (var i = contentsBefore.length - 1; i >= 0; i--) {
var content = contentsBefore[i]; var content = contentsBefore[i];
if (content is TrimPathContent && if (content is TrimPathContent &&
@ -98,7 +97,7 @@ abstract class BaseStrokeContent
trimPathContentBefore.addListener(onUpdateListener); trimPathContentBefore.addListener(onUpdateListener);
} }
_PathGroup currentPathGroup; _PathGroup? currentPathGroup;
for (var i = contentsAfter.length - 1; i >= 0; i--) { for (var i = contentsAfter.length - 1; i >= 0; i--) {
var content = contentsAfter[i]; var content = contentsAfter[i];
if (content is TrimPathContent && if (content is TrimPathContent &&
@ -119,7 +118,8 @@ abstract class BaseStrokeContent
} }
@override @override
void draw(Canvas canvas, Size size, Matrix4 parentMatrix, {int parentAlpha}) { void draw(Canvas canvas, Size size, Matrix4 parentMatrix,
{required int parentAlpha}) {
L.beginSection('StrokeContent#draw'); L.beginSection('StrokeContent#draw');
if (parentMatrix.hasZeroScaleAxis) { if (parentMatrix.hasZeroScaleAxis) {
L.endSection('StrokeContent#draw'); L.endSection('StrokeContent#draw');
@ -136,7 +136,7 @@ abstract class BaseStrokeContent
} }
if (_colorFilterAnimation != null) { if (_colorFilterAnimation != null) {
paint.colorFilter = _colorFilterAnimation.value; paint.colorFilter = _colorFilterAnimation!.value;
} }
for (var i = 0; i < _pathGroups.length; i++) { for (var i = 0; i < _pathGroups.length; i++) {
@ -175,18 +175,17 @@ abstract class BaseStrokeContent
var pathMetrics = _path.computeMetrics().toList(); var pathMetrics = _path.computeMetrics().toList();
var totalLength = pathMetrics.fold<double>(0.0, (a, b) => a + b.length); var totalLength = pathMetrics.fold<double>(0.0, (a, b) => a + b.length);
var offsetLength = totalLength * pathGroup.trimPath.offset.value / 360.0; var trimPath = pathGroup.trimPath!;
var startLength = var offsetLength = totalLength * trimPath.offset.value / 360.0;
totalLength * pathGroup.trimPath.start.value / 100.0 + offsetLength; var startLength = totalLength * trimPath.start.value / 100.0 + offsetLength;
var endLength = var endLength = totalLength * trimPath.end.value / 100.0 + offsetLength;
totalLength * pathGroup.trimPath.end.value / 100.0 + offsetLength;
var currentLength = 0.0; var currentLength = 0.0;
for (var j = pathGroup.paths.length - 1; j >= 0; j--) { for (var j = pathGroup.paths.length - 1; j >= 0; j--) {
_trimPathPath _trimPathPath
.set(pathGroup.paths[j].getPath().transform(parentMatrix.storage)); .set(pathGroup.paths[j].getPath().transform(parentMatrix.storage));
var pathMetrics = _trimPathPath.computeMetrics().toList(); var pathMetrics = _trimPathPath.computeMetrics().toList();
var length = pathMetrics.first.length; var length = pathMetrics.isNotEmpty ? pathMetrics.first.length : 0;
if (endLength > totalLength && if (endLength > totalLength &&
endLength - totalLength < currentLength + length && endLength - totalLength < currentLength + length &&
currentLength < endLength - totalLength) { currentLength < endLength - totalLength) {
@ -229,7 +228,7 @@ abstract class BaseStrokeContent
} }
@override @override
Rect getBounds(Matrix4 parentMatrix, {bool applyParents}) { Rect getBounds(Matrix4 parentMatrix, {required bool applyParents}) {
L.beginSection('StrokeContent#getBounds'); L.beginSection('StrokeContent#getBounds');
_path.reset(); _path.reset();
for (var i = 0; i < _pathGroups.length; i++) { for (var i = 0; i < _pathGroups.length; i++) {
@ -242,11 +241,9 @@ abstract class BaseStrokeContent
var bounds = _path.getBounds(); var bounds = _path.getBounds();
var width = _widthAnimation.value; var width = _widthAnimation.value;
bounds = Rect.fromLTWH(bounds.left - width / 2.0, bounds.top - width / 2.0, bounds = bounds.inflate(width / 2.0);
bounds.right + width / 2.0, bounds.bottom + width / 2.0);
// Add padding to account for rounding errors. // Add padding to account for rounding errors.
bounds = Rect.fromLTWH( bounds = bounds.inflate(1);
bounds.left - 1, bounds.top - 1, bounds.right + 1, bounds.bottom + 1);
L.endSection('StrokeContent#getBounds'); L.endSection('StrokeContent#getBounds');
return bounds; return bounds;
} }
@ -279,7 +276,7 @@ abstract class BaseStrokeContent
var offset = _dashPatternOffsetAnimation == null var offset = _dashPatternOffsetAnimation == null
? 0.0 ? 0.0
: _dashPatternOffsetAnimation.value * scale; : _dashPatternOffsetAnimation!.value * scale;
var newPath = dashPath(path, intervals: _dashPatternValues, phase: offset); var newPath = dashPath(path, intervals: _dashPatternValues, phase: offset);
L.endSection('StrokeContent#applyDashPattern'); L.endSection('StrokeContent#applyDashPattern');
@ -295,7 +292,7 @@ abstract class BaseStrokeContent
@override @override
@mustCallSuper @mustCallSuper
void addValueCallback<T>(T property, LottieValueCallback<T> /*?*/ callback) { void addValueCallback<T>(T property, LottieValueCallback<T>? callback) {
if (property == LottieProperty.opacity) { if (property == LottieProperty.opacity) {
_opacityAnimation.setValueCallback(callback as LottieValueCallback<int>); _opacityAnimation.setValueCallback(callback as LottieValueCallback<int>);
} else if (property == LottieProperty.strokeWidth) { } else if (property == LottieProperty.strokeWidth) {
@ -309,9 +306,9 @@ abstract class BaseStrokeContent
_colorFilterAnimation = null; _colorFilterAnimation = null;
} else { } else {
_colorFilterAnimation = _colorFilterAnimation =
ValueCallbackKeyframeAnimation<ColorFilter, ColorFilter>( ValueCallbackKeyframeAnimation<ColorFilter, ColorFilter?>(
callback as LottieValueCallback<ColorFilter>); callback as LottieValueCallback<ColorFilter>, null);
_colorFilterAnimation.addUpdateListener(onUpdateListener); _colorFilterAnimation!.addUpdateListener(onUpdateListener);
layer.addAnimation(_colorFilterAnimation); layer.addAnimation(_colorFilterAnimation);
} }
} }
@ -321,7 +318,7 @@ abstract class BaseStrokeContent
/// Data class to help drawing trim paths individually. /// Data class to help drawing trim paths individually.
class _PathGroup { class _PathGroup {
final List<PathContent> paths = <PathContent>[]; final List<PathContent> paths = <PathContent>[];
final TrimPathContent /*?*/ trimPath; final TrimPathContent? trimPath;
_PathGroup(this.trimPath); _PathGroup(this.trimPath);
} }

View File

@ -1,5 +1,5 @@
abstract class Content { abstract class Content {
String get name; String? get name;
void setContents(List<Content> contentsBefore, List<Content> contentsAfter); void setContents(List<Content> contentsBefore, List<Content> contentsAfter);
} }

View File

@ -1,5 +1,4 @@
import 'dart:ui'; import 'dart:ui';
import 'package:meta/meta.dart';
import 'package:vector_math/vector_math_64.dart'; import 'package:vector_math/vector_math_64.dart';
import '../../lottie_drawable.dart'; import '../../lottie_drawable.dart';
import '../../model/animatable/animatable_transform.dart'; import '../../model/animatable/animatable_transform.dart';
@ -32,8 +31,7 @@ class ContentGroup implements DrawingContent, PathContent, KeyPathElement {
return contents; return contents;
} }
static AnimatableTransform /*?*/ findTransform( static AnimatableTransform? findTransform(List<ContentModel> contentModels) {
List<ContentModel> contentModels) {
for (var i = 0; i < contentModels.length; i++) { for (var i = 0; i < contentModels.length; i++) {
var contentModel = contentModels[i]; var contentModel = contentModels[i];
if (contentModel is AnimatableTransform) { if (contentModel is AnimatableTransform) {
@ -47,12 +45,12 @@ class ContentGroup implements DrawingContent, PathContent, KeyPathElement {
final Path _path = PathFactory.create(); final Path _path = PathFactory.create();
@override @override
final String name; final String? name;
final bool _hidden; final bool _hidden;
final List<Content> _contents; final List<Content> _contents;
final LottieDrawable _lottieDrawable; final LottieDrawable _lottieDrawable;
List<PathContent> /*?*/ _pathContents; List<PathContent>? _pathContents;
TransformKeyframeAnimation /*?*/ _transformAnimation; TransformKeyframeAnimation? _transformAnimation;
ContentGroup(final LottieDrawable lottieDrawable, BaseLayer layer, ContentGroup(final LottieDrawable lottieDrawable, BaseLayer layer,
ShapeGroup shapeGroup) ShapeGroup shapeGroup)
@ -65,11 +63,11 @@ class ContentGroup implements DrawingContent, PathContent, KeyPathElement {
findTransform(shapeGroup.items)); findTransform(shapeGroup.items));
ContentGroup.copy(this._lottieDrawable, BaseLayer layer, this.name, ContentGroup.copy(this._lottieDrawable, BaseLayer layer, this.name,
this._hidden, this._contents, AnimatableTransform /*?*/ transform) { this._hidden, this._contents, AnimatableTransform? transform) {
if (transform != null) { if (transform != null) {
_transformAnimation = transform.createAnimation(); _transformAnimation = transform.createAnimation()
_transformAnimation.addAnimationsToLayer(layer); ..addAnimationsToLayer(layer)
_transformAnimation.addListener(onValueChanged); ..addListener(onValueChanged);
} }
var greedyContents = <GreedyContent>[]; var greedyContents = <GreedyContent>[];
@ -104,20 +102,20 @@ class ContentGroup implements DrawingContent, PathContent, KeyPathElement {
List<PathContent> getPathList() { List<PathContent> getPathList() {
if (_pathContents == null) { if (_pathContents == null) {
_pathContents = <PathContent>[]; var pathContents = _pathContents = <PathContent>[];
for (var i = 0; i < _contents.length; i++) { for (var i = 0; i < _contents.length; i++) {
var content = _contents[i]; var content = _contents[i];
if (content is PathContent) { if (content is PathContent) {
_pathContents.add(content); pathContents.add(content);
} }
} }
} }
return _pathContents; return _pathContents!;
} }
Matrix4 getTransformationMatrix() { Matrix4 getTransformationMatrix() {
if (_transformAnimation != null) { if (_transformAnimation != null) {
return _transformAnimation.getMatrix(); return _transformAnimation!.getMatrix();
} }
_matrix.reset(); _matrix.reset();
return _matrix; return _matrix;
@ -128,7 +126,7 @@ class ContentGroup implements DrawingContent, PathContent, KeyPathElement {
// TODO: cache this somehow. // TODO: cache this somehow.
_matrix.reset(); _matrix.reset();
if (_transformAnimation != null) { if (_transformAnimation != null) {
_matrix.set(_transformAnimation.getMatrix()); _matrix.set(_transformAnimation!.getMatrix());
} }
_path.reset(); _path.reset();
if (_hidden) { if (_hidden) {
@ -145,17 +143,17 @@ class ContentGroup implements DrawingContent, PathContent, KeyPathElement {
@override @override
void draw(Canvas canvas, Size size, Matrix4 parentMatrix, void draw(Canvas canvas, Size size, Matrix4 parentMatrix,
{@required int parentAlpha}) { {required int parentAlpha}) {
if (_hidden) { if (_hidden) {
return; return;
} }
_matrix.set(parentMatrix); _matrix.set(parentMatrix);
int layerAlpha; int layerAlpha;
if (_transformAnimation != null) { if (_transformAnimation != null) {
_matrix.preConcat(_transformAnimation.getMatrix()); _matrix.preConcat(_transformAnimation!.getMatrix());
var opacity = _transformAnimation.opacity == null var opacity = _transformAnimation?.opacity == null
? 100 ? 100
: _transformAnimation.opacity.value; : _transformAnimation!.opacity!.value;
layerAlpha = ((opacity / 100.0 * parentAlpha / 255.0) * 255).round(); layerAlpha = ((opacity / 100.0 * parentAlpha / 255.0) * 255).round();
} else { } else {
layerAlpha = parentAlpha; layerAlpha = parentAlpha;
@ -199,10 +197,10 @@ class ContentGroup implements DrawingContent, PathContent, KeyPathElement {
} }
@override @override
Rect getBounds(Matrix4 parentMatrix, {bool applyParents}) { Rect getBounds(Matrix4 parentMatrix, {required bool applyParents}) {
_matrix.set(parentMatrix); _matrix.set(parentMatrix);
if (_transformAnimation != null) { if (_transformAnimation != null) {
_matrix.preConcat(_transformAnimation.getMatrix()); _matrix.preConcat(_transformAnimation!.getMatrix());
} }
var bounds = Rect.zero; var bounds = Rect.zero;
for (var i = _contents.length - 1; i >= 0; i--) { for (var i = _contents.length - 1; i >= 0; i--) {
@ -223,8 +221,8 @@ class ContentGroup implements DrawingContent, PathContent, KeyPathElement {
return; return;
} }
if ('__container' != name) { if ('__container' != name && name != null) {
currentPartialKeyPath = currentPartialKeyPath.addKey(name); currentPartialKeyPath = currentPartialKeyPath.addKey(name!);
if (keyPath.fullyResolvesTo(name, depth)) { if (keyPath.fullyResolvesTo(name, depth)) {
accumulator.add(currentPartialKeyPath.resolve(this)); accumulator.add(currentPartialKeyPath.resolve(this));
@ -245,9 +243,9 @@ class ContentGroup implements DrawingContent, PathContent, KeyPathElement {
} }
@override @override
void addValueCallback<T>(T property, LottieValueCallback<T> /*?*/ callback) { void addValueCallback<T>(T property, LottieValueCallback<T>? callback) {
if (_transformAnimation != null) { if (_transformAnimation != null) {
_transformAnimation.applyValueCallback(property, callback); _transformAnimation!.applyValueCallback(property, callback);
} }
} }
} }

View File

@ -1,10 +1,9 @@
import 'dart:ui'; import 'dart:ui';
import 'package:meta/meta.dart';
import 'package:vector_math/vector_math_64.dart'; import 'package:vector_math/vector_math_64.dart';
import 'content.dart'; import 'content.dart';
abstract class DrawingContent extends Content { abstract class DrawingContent extends Content {
void draw(Canvas canvas, Size canvasSize, Matrix4 parentMatrix, void draw(Canvas canvas, Size canvasSize, Matrix4 parentMatrix,
{@required int parentAlpha}); {required int parentAlpha});
Rect getBounds(Matrix4 parentMatrix, {@required bool applyParents}); Rect getBounds(Matrix4 parentMatrix, {required bool applyParents});
} }

View File

@ -22,10 +22,10 @@ class EllipseContent implements PathContent, KeyPathElementContent {
final Path _path = PathFactory.create(); final Path _path = PathFactory.create();
@override @override
final String name; final String? name;
final LottieDrawable lottieDrawable; final LottieDrawable lottieDrawable;
final BaseKeyframeAnimation<dynamic, Offset> _sizeAnimation; final BaseKeyframeAnimation<Object, Offset> _sizeAnimation;
final BaseKeyframeAnimation<dynamic, Offset> _positionAnimation; final BaseKeyframeAnimation<Object, Offset> _positionAnimation;
final CircleShape _circleShape; final CircleShape _circleShape;
final CompoundTrimPathContent _trimPaths = CompoundTrimPathContent(); final CompoundTrimPathContent _trimPaths = CompoundTrimPathContent();
@ -115,7 +115,7 @@ class EllipseContent implements PathContent, KeyPathElementContent {
} }
@override @override
void addValueCallback<T>(T property, LottieValueCallback<T> /*?*/ callback) { void addValueCallback<T>(T property, LottieValueCallback<T>? callback) {
if (property == LottieProperty.ellipseSize) { if (property == LottieProperty.ellipseSize) {
_sizeAnimation.setValueCallback(callback as LottieValueCallback<Offset>); _sizeAnimation.setValueCallback(callback as LottieValueCallback<Offset>);
} else if (property == LottieProperty.position) { } else if (property == LottieProperty.position) {

View File

@ -22,12 +22,12 @@ class FillContent implements DrawingContent, KeyPathElementContent {
final Paint _paint = Paint(); final Paint _paint = Paint();
final BaseLayer layer; final BaseLayer layer;
@override @override
final String name; final String? name;
final bool _hidden; final bool _hidden;
final List<PathContent> _paths = <PathContent>[]; final List<PathContent> _paths = <PathContent>[];
BaseKeyframeAnimation<Color, Color> _colorAnimation; late final BaseKeyframeAnimation<Color, Color> _colorAnimation;
BaseKeyframeAnimation<int, int> _opacityAnimation; late final BaseKeyframeAnimation<int, int> _opacityAnimation;
BaseKeyframeAnimation<ColorFilter, ColorFilter> /*?*/ _colorFilterAnimation; BaseKeyframeAnimation<ColorFilter, ColorFilter?>? _colorFilterAnimation;
final LottieDrawable lottieDrawable; final LottieDrawable lottieDrawable;
FillContent(this.lottieDrawable, this.layer, ShapeFill fill) FillContent(this.lottieDrawable, this.layer, ShapeFill fill)
@ -39,10 +39,10 @@ class FillContent implements DrawingContent, KeyPathElementContent {
_path.fillType = fill.fillType; _path.fillType = fill.fillType;
_colorAnimation = fill.color.createAnimation(); _colorAnimation = fill.color!.createAnimation();
_colorAnimation.addUpdateListener(onValueChanged); _colorAnimation.addUpdateListener(onValueChanged);
layer.addAnimation(_colorAnimation); layer.addAnimation(_colorAnimation);
_opacityAnimation = fill.opacity.createAnimation(); _opacityAnimation = fill.opacity!.createAnimation();
_opacityAnimation.addUpdateListener(onValueChanged); _opacityAnimation.addUpdateListener(onValueChanged);
layer.addAnimation(_opacityAnimation); layer.addAnimation(_opacityAnimation);
} }
@ -62,7 +62,8 @@ class FillContent implements DrawingContent, KeyPathElementContent {
} }
@override @override
void draw(Canvas canvas, Size size, Matrix4 parentMatrix, {int parentAlpha}) { void draw(Canvas canvas, Size size, Matrix4 parentMatrix,
{required int parentAlpha}) {
if (_hidden) { if (_hidden) {
return; return;
} }
@ -76,7 +77,7 @@ class FillContent implements DrawingContent, KeyPathElementContent {
} }
if (_colorFilterAnimation != null) { if (_colorFilterAnimation != null) {
_paint.colorFilter = _colorFilterAnimation.value; _paint.colorFilter = _colorFilterAnimation!.value;
} }
_path.reset(); _path.reset();
@ -93,7 +94,7 @@ class FillContent implements DrawingContent, KeyPathElementContent {
} }
@override @override
Rect getBounds(Matrix4 parentMatrix, {bool applyParents}) { Rect getBounds(Matrix4 parentMatrix, {required bool applyParents}) {
_path.reset(); _path.reset();
for (var i = 0; i < _paths.length; i++) { for (var i = 0; i < _paths.length; i++) {
_path.addPath(_paths[i].getPath(), Offset.zero, _path.addPath(_paths[i].getPath(), Offset.zero,
@ -101,8 +102,7 @@ class FillContent implements DrawingContent, KeyPathElementContent {
} }
var outBounds = _path.getBounds(); var outBounds = _path.getBounds();
// Add padding to account for rounding errors. // Add padding to account for rounding errors.
outBounds = Rect.fromLTWH(outBounds.left - 1, outBounds.top - 1, outBounds = outBounds.inflate(1);
outBounds.right + 1, outBounds.bottom + 1);
return outBounds; return outBounds;
} }
@ -114,7 +114,7 @@ class FillContent implements DrawingContent, KeyPathElementContent {
} }
@override @override
void addValueCallback<T>(T property, LottieValueCallback<T> /*?*/ callback) { void addValueCallback<T>(T property, LottieValueCallback<T>? callback) {
if (property == LottieProperty.color) { if (property == LottieProperty.color) {
_colorAnimation.setValueCallback(callback as LottieValueCallback<Color>); _colorAnimation.setValueCallback(callback as LottieValueCallback<Color>);
} else if (property == LottieProperty.opacity) { } else if (property == LottieProperty.opacity) {
@ -128,8 +128,8 @@ class FillContent implements DrawingContent, KeyPathElementContent {
_colorFilterAnimation = null; _colorFilterAnimation = null;
} else { } else {
_colorFilterAnimation = ValueCallbackKeyframeAnimation( _colorFilterAnimation = ValueCallbackKeyframeAnimation(
callback as LottieValueCallback<ColorFilter>); callback as LottieValueCallback<ColorFilter>, null)
_colorFilterAnimation.addUpdateListener(onValueChanged); ..addUpdateListener(onValueChanged);
layer.addAnimation(_colorFilterAnimation); layer.addAnimation(_colorFilterAnimation);
} }
} }

View File

@ -33,9 +33,9 @@ class GradientFillContent implements DrawingContent, KeyPathElementContent {
final BaseKeyframeAnimation<int, int> _opacityAnimation; final BaseKeyframeAnimation<int, int> _opacityAnimation;
final BaseKeyframeAnimation<Offset, Offset> _startPointAnimation; final BaseKeyframeAnimation<Offset, Offset> _startPointAnimation;
final BaseKeyframeAnimation<Offset, Offset> _endPointAnimation; final BaseKeyframeAnimation<Offset, Offset> _endPointAnimation;
BaseKeyframeAnimation<ColorFilter, ColorFilter> /*?*/ _colorFilterAnimation; BaseKeyframeAnimation<ColorFilter, ColorFilter?>? _colorFilterAnimation;
ValueCallbackKeyframeAnimation<List<Color>, ValueCallbackKeyframeAnimation<List<Color>, List<Color>>?
List<Color>> /*?*/ _colorCallbackAnimation; _colorCallbackAnimation;
final LottieDrawable lottieDrawable; final LottieDrawable lottieDrawable;
final int _cacheSteps; final int _cacheSteps;
@ -62,7 +62,7 @@ class GradientFillContent implements DrawingContent, KeyPathElementContent {
} }
@override @override
String get name => _fill.name; String? get name => _fill.name;
void invalidate() { void invalidate() {
lottieDrawable.invalidateSelf(); lottieDrawable.invalidateSelf();
@ -79,7 +79,8 @@ class GradientFillContent implements DrawingContent, KeyPathElementContent {
} }
@override @override
void draw(Canvas canvas, Size size, Matrix4 parentMatrix, {int parentAlpha}) { void draw(Canvas canvas, Size size, Matrix4 parentMatrix,
{required int parentAlpha}) {
if (_fill.hidden) { if (_fill.hidden) {
return; return;
} }
@ -99,7 +100,7 @@ class GradientFillContent implements DrawingContent, KeyPathElementContent {
_paint.shader = gradient; _paint.shader = gradient;
if (_colorFilterAnimation != null) { if (_colorFilterAnimation != null) {
_paint.colorFilter = _colorFilterAnimation.value; _paint.colorFilter = _colorFilterAnimation!.value;
} }
var alpha = var alpha =
@ -117,7 +118,7 @@ class GradientFillContent implements DrawingContent, KeyPathElementContent {
} }
@override @override
Rect getBounds(Matrix4 parentMatrix, {bool applyParents}) { Rect getBounds(Matrix4 parentMatrix, {required bool applyParents}) {
_path.reset(); _path.reset();
for (var i = 0; i < _paths.length; i++) { for (var i = 0; i < _paths.length; i++) {
_path.addPath(_paths[i].getPath(), Offset.zero, _path.addPath(_paths[i].getPath(), Offset.zero,
@ -126,8 +127,7 @@ class GradientFillContent implements DrawingContent, KeyPathElementContent {
var outBounds = _path.getBounds(); var outBounds = _path.getBounds();
// Add padding to account for rounding errors. // Add padding to account for rounding errors.
return Rect.fromLTWH(outBounds.left - 1, outBounds.top - 1, return outBounds.inflate(1);
outBounds.right + 1, outBounds.bottom + 1);
} }
Gradient _getLinearGradient() { Gradient _getLinearGradient() {
@ -192,7 +192,7 @@ class GradientFillContent implements DrawingContent, KeyPathElementContent {
List<Color> _applyDynamicColorsIfNeeded(List<Color> colors) { List<Color> _applyDynamicColorsIfNeeded(List<Color> colors) {
if (_colorCallbackAnimation != null) { if (_colorCallbackAnimation != null) {
var dynamicColors = _colorCallbackAnimation.value; var dynamicColors = _colorCallbackAnimation!.value;
if (colors.length == dynamicColors.length) { if (colors.length == dynamicColors.length) {
for (var i = 0; i < colors.length; i++) { for (var i = 0; i < colors.length; i++) {
colors[i] = dynamicColors[i]; colors[i] = dynamicColors[i];
@ -215,7 +215,7 @@ class GradientFillContent implements DrawingContent, KeyPathElementContent {
} }
@override @override
void addValueCallback<T>(T property, LottieValueCallback<T> /*?*/ callback) { void addValueCallback<T>(T property, LottieValueCallback<T>? callback) {
if (property == LottieProperty.opacity) { if (property == LottieProperty.opacity) {
_opacityAnimation.setValueCallback(callback as LottieValueCallback<int>); _opacityAnimation.setValueCallback(callback as LottieValueCallback<int>);
} else if (property == LottieProperty.colorFilter) { } else if (property == LottieProperty.colorFilter) {
@ -227,8 +227,8 @@ class GradientFillContent implements DrawingContent, KeyPathElementContent {
_colorFilterAnimation = null; _colorFilterAnimation = null;
} else { } else {
_colorFilterAnimation = ValueCallbackKeyframeAnimation( _colorFilterAnimation = ValueCallbackKeyframeAnimation(
callback as LottieValueCallback<ColorFilter>); callback as LottieValueCallback<ColorFilter>, null)
_colorFilterAnimation.addUpdateListener(invalidate); ..addUpdateListener(invalidate);
layer.addAnimation(_colorFilterAnimation); layer.addAnimation(_colorFilterAnimation);
} }
} else if (property == LottieProperty.gradientColor) { } else if (property == LottieProperty.gradientColor) {
@ -240,8 +240,8 @@ class GradientFillContent implements DrawingContent, KeyPathElementContent {
_colorCallbackAnimation = null; _colorCallbackAnimation = null;
} else { } else {
_colorCallbackAnimation = ValueCallbackKeyframeAnimation( _colorCallbackAnimation = ValueCallbackKeyframeAnimation(
callback as LottieValueCallback<List<Color>>); callback as LottieValueCallback<List<Color>>, <Color>[])
_colorCallbackAnimation.addUpdateListener(invalidate); ..addUpdateListener(invalidate);
layer.addAnimation(_colorCallbackAnimation); layer.addAnimation(_colorCallbackAnimation);
} }
} }

View File

@ -18,7 +18,7 @@ class GradientStrokeContent extends BaseStrokeContent {
static final int _cacheStepsMs = 32; static final int _cacheStepsMs = 32;
@override @override
final String name; final String? name;
final bool _hidden; final bool _hidden;
final _linearGradientCache = <int, Gradient>{}; final _linearGradientCache = <int, Gradient>{};
final _radialGradientCache = <int, Gradient>{}; final _radialGradientCache = <int, Gradient>{};
@ -28,8 +28,8 @@ class GradientStrokeContent extends BaseStrokeContent {
final BaseKeyframeAnimation<GradientColor, GradientColor> _colorAnimation; final BaseKeyframeAnimation<GradientColor, GradientColor> _colorAnimation;
final BaseKeyframeAnimation<Offset, Offset> _startPointAnimation; final BaseKeyframeAnimation<Offset, Offset> _startPointAnimation;
final BaseKeyframeAnimation<Offset, Offset> _endPointAnimation; final BaseKeyframeAnimation<Offset, Offset> _endPointAnimation;
ValueCallbackKeyframeAnimation<List<Color>, ValueCallbackKeyframeAnimation<List<Color>, List<Color>>?
List<Color>> /*?*/ _colorCallbackAnimation; _colorCallbackAnimation;
GradientStrokeContent(final LottieDrawable lottieDrawable, BaseLayer layer, GradientStrokeContent(final LottieDrawable lottieDrawable, BaseLayer layer,
GradientStroke stroke) GradientStroke stroke)
@ -61,7 +61,8 @@ class GradientStrokeContent extends BaseStrokeContent {
} }
@override @override
void draw(Canvas canvas, Size size, Matrix4 parentMatrix, {int parentAlpha}) { void draw(Canvas canvas, Size size, Matrix4 parentMatrix,
{required int parentAlpha}) {
if (_hidden) { if (_hidden) {
return; return;
} }
@ -142,7 +143,7 @@ class GradientStrokeContent extends BaseStrokeContent {
List<Color> _applyDynamicColorsIfNeeded(List<Color> colors) { List<Color> _applyDynamicColorsIfNeeded(List<Color> colors) {
if (_colorCallbackAnimation != null) { if (_colorCallbackAnimation != null) {
var dynamicColors = _colorCallbackAnimation.value; var dynamicColors = _colorCallbackAnimation!.value;
if (colors.length == dynamicColors.length) { if (colors.length == dynamicColors.length) {
for (var i = 0; i < colors.length; i++) { for (var i = 0; i < colors.length; i++) {
colors[i] = dynamicColors[i]; colors[i] = dynamicColors[i];
@ -158,7 +159,7 @@ class GradientStrokeContent extends BaseStrokeContent {
} }
@override @override
void addValueCallback<T>(T property, LottieValueCallback<T> /*?*/ callback) { void addValueCallback<T>(T property, LottieValueCallback<T>? callback) {
super.addValueCallback(property, callback); super.addValueCallback(property, callback);
if (property == LottieProperty.gradientColor) { if (property == LottieProperty.gradientColor) {
if (_colorCallbackAnimation != null) { if (_colorCallbackAnimation != null) {
@ -169,8 +170,8 @@ class GradientStrokeContent extends BaseStrokeContent {
_colorCallbackAnimation = null; _colorCallbackAnimation = null;
} else { } else {
_colorCallbackAnimation = ValueCallbackKeyframeAnimation( _colorCallbackAnimation = ValueCallbackKeyframeAnimation(
callback as LottieValueCallback<List<Color>>); callback as LottieValueCallback<List<Color>>, <Color>[])
_colorCallbackAnimation.addUpdateListener(onUpdateListener); ..addUpdateListener(onUpdateListener);
layer.addAnimation(_colorCallbackAnimation); layer.addAnimation(_colorCallbackAnimation);
} }
} }

View File

@ -28,13 +28,13 @@ class PolystarContent implements PathContent, KeyPathElementContent {
final LottieDrawable lottieDrawable; final LottieDrawable lottieDrawable;
final PolystarShape _polystarShape; final PolystarShape _polystarShape;
final BaseKeyframeAnimation<dynamic, double> _pointsAnimation; final BaseKeyframeAnimation<Object, double> _pointsAnimation;
final BaseKeyframeAnimation<dynamic, Offset> _positionAnimation; final BaseKeyframeAnimation<Object, Offset> _positionAnimation;
final BaseKeyframeAnimation<dynamic, double> _rotationAnimation; final BaseKeyframeAnimation<Object, double> _rotationAnimation;
final BaseKeyframeAnimation<dynamic, double> /*?*/ _innerRadiusAnimation; final BaseKeyframeAnimation<Object, double>? _innerRadiusAnimation;
final BaseKeyframeAnimation<dynamic, double> _outerRadiusAnimation; final BaseKeyframeAnimation<Object, double> _outerRadiusAnimation;
final BaseKeyframeAnimation<dynamic, double> /*?*/ _innerRoundednessAnimation; final BaseKeyframeAnimation<Object, double>? _innerRoundednessAnimation;
final BaseKeyframeAnimation<dynamic, double> _outerRoundednessAnimation; final BaseKeyframeAnimation<Object, double> _outerRoundednessAnimation;
final _trimPaths = CompoundTrimPathContent(); final _trimPaths = CompoundTrimPathContent();
bool _isPathValid = false; bool _isPathValid = false;
@ -47,11 +47,11 @@ class PolystarContent implements PathContent, KeyPathElementContent {
_outerRoundednessAnimation = _outerRoundednessAnimation =
_polystarShape.outerRoundedness.createAnimation(), _polystarShape.outerRoundedness.createAnimation(),
_innerRadiusAnimation = _polystarShape.type == PolystarShapeType.star _innerRadiusAnimation = _polystarShape.type == PolystarShapeType.star
? _polystarShape.innerRadius.createAnimation() ? _polystarShape.innerRadius!.createAnimation()
: null, : null,
_innerRoundednessAnimation = _innerRoundednessAnimation =
_polystarShape.type == PolystarShapeType.star _polystarShape.type == PolystarShapeType.star
? _polystarShape.innerRoundedness.createAnimation() ? _polystarShape.innerRoundedness!.createAnimation()
: null { : null {
layer.addAnimation(_pointsAnimation); layer.addAnimation(_pointsAnimation);
layer.addAnimation(_positionAnimation); layer.addAnimation(_positionAnimation);
@ -69,8 +69,8 @@ class PolystarContent implements PathContent, KeyPathElementContent {
_outerRadiusAnimation.addUpdateListener(invalidate); _outerRadiusAnimation.addUpdateListener(invalidate);
_outerRoundednessAnimation.addUpdateListener(invalidate); _outerRoundednessAnimation.addUpdateListener(invalidate);
if (_polystarShape.type == PolystarShapeType.star) { if (_polystarShape.type == PolystarShapeType.star) {
_innerRadiusAnimation.addUpdateListener(invalidate); _innerRadiusAnimation!.addUpdateListener(invalidate);
_innerRoundednessAnimation.addUpdateListener(invalidate); _innerRoundednessAnimation!.addUpdateListener(invalidate);
} }
} }
@ -123,12 +123,11 @@ class PolystarContent implements PathContent, KeyPathElementContent {
} }
@override @override
String get name => _polystarShape.name; String? get name => _polystarShape.name;
void _createStarPath() { void _createStarPath() {
var points = _pointsAnimation.value; var points = _pointsAnimation.value;
var currentAngle = var currentAngle = _rotationAnimation.value;
_rotationAnimation == null ? 0.0 : _rotationAnimation.value;
// Start at +y instead of +x // Start at +y instead of +x
currentAngle -= 90; currentAngle -= 90;
// convert to radians // convert to radians
@ -143,16 +142,13 @@ class PolystarContent implements PathContent, KeyPathElementContent {
var outerRadius = _outerRadiusAnimation.value; var outerRadius = _outerRadiusAnimation.value;
//noinspection ConstantConditions //noinspection ConstantConditions
var innerRadius = _innerRadiusAnimation.value; var innerRadius = _innerRadiusAnimation!.value;
var innerRoundedness = 0.0; var innerRoundedness = 0.0;
if (_innerRoundednessAnimation != null) { if (_innerRoundednessAnimation != null) {
innerRoundedness = _innerRoundednessAnimation.value / 100.0; innerRoundedness = _innerRoundednessAnimation!.value / 100.0;
}
var outerRoundedness = 0.0;
if (_outerRoundednessAnimation != null) {
outerRoundedness = _outerRoundednessAnimation.value / 100.0;
} }
var outerRoundedness = _outerRoundednessAnimation.value / 100.0;
double x; double x;
double y; double y;
@ -235,8 +231,7 @@ class PolystarContent implements PathContent, KeyPathElementContent {
void _createPolygonPath() { void _createPolygonPath() {
var points = _pointsAnimation.value.floor(); var points = _pointsAnimation.value.floor();
var currentAngle = var currentAngle = _rotationAnimation.value;
_rotationAnimation == null ? 0.0 : _rotationAnimation.value;
// Start at +y instead of +x // Start at +y instead of +x
currentAngle -= 90; currentAngle -= 90;
// convert to radians // convert to radians
@ -297,7 +292,7 @@ class PolystarContent implements PathContent, KeyPathElementContent {
} }
@override @override
void addValueCallback<T>(T property, LottieValueCallback<T> /*?*/ callback) { void addValueCallback<T>(T property, LottieValueCallback<T>? callback) {
if (property == LottieProperty.polystarPoints) { if (property == LottieProperty.polystarPoints) {
_pointsAnimation _pointsAnimation
.setValueCallback(callback as LottieValueCallback<double>); .setValueCallback(callback as LottieValueCallback<double>);
@ -309,14 +304,14 @@ class PolystarContent implements PathContent, KeyPathElementContent {
.setValueCallback(callback as LottieValueCallback<Offset>); .setValueCallback(callback as LottieValueCallback<Offset>);
} else if (property == LottieProperty.polystarInnerRadius && } else if (property == LottieProperty.polystarInnerRadius &&
_innerRadiusAnimation != null) { _innerRadiusAnimation != null) {
_innerRadiusAnimation _innerRadiusAnimation!
.setValueCallback(callback as LottieValueCallback<double>); .setValueCallback(callback as LottieValueCallback<double>);
} else if (property == LottieProperty.polystarOuterRadius) { } else if (property == LottieProperty.polystarOuterRadius) {
_outerRadiusAnimation _outerRadiusAnimation
.setValueCallback(callback as LottieValueCallback<double>); .setValueCallback(callback as LottieValueCallback<double>);
} else if (property == LottieProperty.polystarInnerRoundedness && } else if (property == LottieProperty.polystarInnerRoundedness &&
_innerRoundednessAnimation != null) { _innerRoundednessAnimation != null) {
_innerRoundednessAnimation _innerRoundednessAnimation!
.setValueCallback(callback as LottieValueCallback<double>); .setValueCallback(callback as LottieValueCallback<double>);
} else if (property == LottieProperty.polystarOuterRoundedness) { } else if (property == LottieProperty.polystarOuterRoundedness) {
_outerRoundednessAnimation _outerRoundednessAnimation

View File

@ -21,12 +21,12 @@ class RectangleContent implements KeyPathElementContent, PathContent {
final _path = PathFactory.create(); final _path = PathFactory.create();
@override @override
final String name; final String? name;
final bool _hidden; final bool _hidden;
final LottieDrawable lottieDrawable; final LottieDrawable lottieDrawable;
final BaseKeyframeAnimation<dynamic, Offset> _positionAnimation; final BaseKeyframeAnimation<Object, Offset> _positionAnimation;
final BaseKeyframeAnimation<dynamic, Offset> _sizeAnimation; final BaseKeyframeAnimation<Object, Offset> _sizeAnimation;
final BaseKeyframeAnimation<dynamic, double> _cornerRadiusAnimation; final BaseKeyframeAnimation<Object, double> _cornerRadiusAnimation;
final CompoundTrimPathContent _trimPaths = CompoundTrimPathContent(); final CompoundTrimPathContent _trimPaths = CompoundTrimPathContent();
bool _isPathValid = false; bool _isPathValid = false;
@ -81,8 +81,7 @@ class RectangleContent implements KeyPathElementContent, PathContent {
var size = _sizeAnimation.value; var size = _sizeAnimation.value;
var halfWidth = size.dx / 2.0; var halfWidth = size.dx / 2.0;
var halfHeight = size.dy / 2.0; var halfHeight = size.dy / 2.0;
var radius = var radius = _cornerRadiusAnimation.value;
_cornerRadiusAnimation == null ? 0.0 : _cornerRadiusAnimation.value;
var maxRadius = min(halfWidth, halfHeight); var maxRadius = min(halfWidth, halfHeight);
if (radius > maxRadius) { if (radius > maxRadius) {
radius = maxRadius; radius = maxRadius;
@ -164,7 +163,7 @@ class RectangleContent implements KeyPathElementContent, PathContent {
} }
@override @override
void addValueCallback<T>(T property, LottieValueCallback<T> /*?*/ callback) { void addValueCallback<T>(T property, LottieValueCallback<T>? callback) {
if (property == LottieProperty.rectangleSize) { if (property == LottieProperty.rectangleSize) {
_sizeAnimation.setValueCallback(callback as LottieValueCallback<Offset>); _sizeAnimation.setValueCallback(callback as LottieValueCallback<Offset>);
} else if (property == LottieProperty.position) { } else if (property == LottieProperty.position) {

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