我使用 Flare 为我的 Flutter 项目创建了一个动画。但是,尝试运行它时出现错误。动画不起作用,只有带有我使用的徽标的黑屏显示。
这是我的代码:
import 'package:flare_splash_screen/flare_splash_screen.dart';
import 'package:flutter/material.dart';
void main () {
runApp(MaterialApp(
home: SplashScreen(
'assets/splash.flr',
(context) => SplashTela(),
startAnimation: 'intro',
backgroundColor: Color(0xff3333),
),
));
}
class SplashTela extends StatefulWidget {
@override
_SplashTelaState createState() => _SplashTelaState();
}
class _SplashTelaState extends State<SplashTela> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: null,
body: Container(
color: Colors.redAccent,
),
);
}
}
这是错误:
E/flutter (25496): [ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception:
'package:flare_splash_screen/flare_splash_screen.dart': Failed assertion: line 113 pos 16: '!
(isLoading == null && until == null)': isLoading and until are null, pick one ;)
E/flutter (25496): #0 _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:40:39)
E/flutter (25496): #1 _AssertionError._throwNew (dart:core-patch/errors_patch.dart:36:5)
E/flutter (25496): #2 new SplashScreen
(package:flare_splash_screen/flare_splash_screen.dart:113:16)
E/flutter (25496): #3 main (package:leagueuniverse/main.dart:6:11)
E/flutter (25496): #4 _runMainZoned.<anonymous closure>.<anonymous closure>
(dart:ui/hooks.dart:229:25)
E/flutter (25496): #5 _rootRun (dart:async/zone.dart:1124:13)
E/flutter (25496): #6 _CustomZone.run (dart:async/zone.dart:1021:19)
E/flutter (25496): #7 _runZoned (dart:async/zone.dart:1516:10)
E/flutter (25496): #8 runZoned (dart:async/zone.dart:1500:12)
E/flutter (25496): #9 _runMainZoned.<anonymous closure> (dart:ui/hooks.dart:221:5)
E/flutter (25496): #10 _startIsolate.<anonymous closure> (dart:isolate-
patch/isolate_patch.dart:305:19)
E/flutter (25496): #11 _RawReceivePortImpl._handleMessage (dart:isolate-
patch/isolate_patch.dart:172:12)
E/flutter (25496):