Flutter _SpinnerTextState#9863f(ticker active)与活动ticker一起处理
我曾尝试使用SplashScreen运行我的颤振应用程序,但当我返回到应用程序的抽屉时,出现了如下错误:\u SpinnerTextState#9863f(股票代码激活)与激活的股票代码一起处理Flutter _SpinnerTextState#9863f(ticker active)与活动ticker一起处理,flutter,Flutter,我曾尝试使用SplashScreen运行我的颤振应用程序,但当我返回到应用程序的抽屉时,出现了如下错误:\u SpinnerTextState#9863f(股票代码激活)与激活的股票代码一起处理 我在启动屏幕中使用了动画启动屏幕包。当我回到抽屉时,时间屏幕在微秒内显示黑色,控制台显示错误 import 'package:animated_splash_screen/animated_splash_screen.dart'; import 'package:page_transition/page
我在启动屏幕中使用了动画启动屏幕包。当我回到抽屉时,时间屏幕在微秒内显示黑色,控制台显示错误
import 'package:animated_splash_screen/animated_splash_screen.dart';
import 'package:page_transition/page_transition.dart';
import 'package:flutter/material.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'login/login.dart';
import 'pages/dashboard.dart';
import 'pages/drawer.dart';
var username;
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
SharedPreferences prefs = await SharedPreferences.getInstance();
username = prefs.getString('username');
runApp(
MyApp(),
);
}
class MyApp extends StatelessWidget {
Widget build(BuildContext context) {
return MaterialApp(
home: MasterScreen(),
);
}
}
class MasterScreen extends StatefulWidget {
@override
final AppBar appBar;
const MasterScreen({Key key, this.appBar}) : super(key: key);
@override
_MasterScreenState createState() => _MasterScreenState();
}
class _MasterScreenState extends State<MasterScreen> with SingleTickerProviderStateMixin {
AnimationController animationController;
Animation<double> animation;
var _visible = true;
@override
void initState() {
super.initState();
animationController = new AnimationController(
vsync: this,
duration: new Duration(seconds: 2),
);
animation =
new CurvedAnimation(parent: animationController, curve: Curves.easeOut);
animation.addListener(() => this.setState(() {}));
animationController.forward();
setState(() {
_visible = !_visible;
});
}
@override
dispose() {
animationController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
home:AnimatedSplashScreen(
curve: Curves.bounceIn,
splash: Image.asset(
'assets/logo.png',
height: 200,
width: 200,
),
nextScreen: username == null
? LoginScreen()
: AppDrawer(
child: DashBoard(
appBar: widget.appBar,
),
),
splashTransition: SplashTransition.scaleTransition,
pageTransitionType: PageTransitionType.leftToRightWithFade,
backgroundColor: Colors.blue,
animationDuration: Duration(
seconds: 2,
),
),
);
}
}
import'package:animated_splash_screen/animated_splash_screen.dart';
导入“package:page_transition/page_transition.dart”;
进口“包装:颤振/材料.省道”;
导入“package:shared_preferences/shared_preferences.dart”;
导入“login/login.dart”;
导入“pages/dashboard.dart”;
导入“pages/drawer.dart”;
var用户名;
Future main()异步{
WidgetsFlutterBinding.ensureInitialized();
SharedReferences prefs=等待SharedReferences.getInstance();
username=prefs.getString('username');
runApp(
MyApp(),
);
}
类MyApp扩展了无状态小部件{
小部件构建(构建上下文){
返回材料PP(
主屏幕:主屏幕(),
);
}
}
类MasterScreen扩展StatefulWidget{
@凌驾
最终AppBar AppBar;
常量主屏幕({Key,this.appBar}):超级(Key:Key);
@凌驾
_MasterScreenState createState()=>\u MasterScreenState();
}
类_MasterScreenState使用SingleTickerProviderStateMixin扩展状态{
动画控制器;
动画;
var_visible=true;
@凌驾
void initState(){
super.initState();
animationController=新的animationController(
vsync:这个,,
持续时间:新的持续时间(秒数:2),
);
动画=
新曲线动画(父对象:animationController,曲线:Curves.easeOut);
animation.addListener(()=>this.setState((){}));
animationController.forward();
设置状态(){
_可见=!\u可见;
});
}
@凌驾
处置{
animationController.dispose();
super.dispose();
}
@凌驾
小部件构建(构建上下文){
返回脚手架(
主页:动画SplashScreen(
曲线:Curves.bounceIn,
splash:Image.asset(
“assets/logo.png”,
身高:200,
宽度:200,
),
nextScreen:username==null
?登录筛选()
:AppDrawer(
子:仪表板(
appBar:widget.appBar,
),
),
splashTransition:splashTransition.scaleTransition,
pageTransitionType:pageTransitionType.leftToRightWithFade,
背景颜色:Colors.blue,
动画持续时间:持续时间(
秒:2,
),
),
);
}
}
在上面的代码中,动画SplashScreen包被简单的SplashScreen包取代,我们在这里找到了SplashScreen包
您可以共享完整的错误日志吗?@ibhavikmakwana先生控制台仅显示此错误=_SpinnerTextState#14910(ticker active)已与活动的ticker一起处理。
SplashScreen(
backgroundColor: Colors.blue,
seconds: 5,
navigateAfterSeconds: LoginScreen(),
image: new Image.asset(
'assets/logo.png',
),
styleTextUnderTheLoader: new TextStyle(),
photoSize: 150.0,
loaderColor: Colors.white,
loadingText: Text(
'Welcome To QA Platform',
style: TextStyle(
color: Colors.white,
fontSize: 20,
),
),
),