作者热门文章
- mongodb - 在 MongoDB mapreduce 中,如何展平值对象?
- javascript - 对象传播与 Object.assign
- html - 输入类型 ="submit"Vs 按钮标签它们可以互换吗?
- sql - 使用 MongoDB 而不是 MS SQL Server 的优缺点
刚学flutter动画。使用 SingleTickerProviderStateMixin
IDE 给我这个错误:
The class 'SingleTickerProviderStateMixin' can't be used as a mixin because it extends a class other than Object
我的代码:
import 'package:flutter/material.dart';
class AnimationControllerOutputBody extends StatefulWidget with {
@override
_AnimationControllerOutputBodyState createState() =>
new _AnimationControllerOutputBodyState();
}
class _AnimationControllerOutputBodyState extends State<AnimationControllerOutputBody> with SingleTickerProviderStateMixin {
AnimationController animation;
@override
void initState() {
super.initState();
animation = new AnimationController(
vsync: this,
duration: new Duration(seconds: 3),
);
animation.addListener(() {
this.setState(() {});
});
}
@override
Widget build(BuildContext context) {
return new GestureDetector(
child: new Center(
child: new Text(
animation.isAnimating
? animation.value.toStringAsFixed(3)
: "Tap me!",
style: new TextStyle(
fontSize: 50.0,
),
),
),
onTap: () {
animation.forward(from: 0.0);
},
);
}
@override
void dispose() {
animation.dispose();
super.dispose();
}
}
我的代码有什么问题?
最佳答案
添加到 analysis_options.yaml
analyzer:
language:
enableSuperMixins: true
另见 https://github.com/flutter/flutter/blob/master/analysis_options.yaml#L24
关于android - 错误 : The class 'SingleTickerProviderStateMixin' can't be used as a mixin because it extends a class other than Object,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51346911/
我是一名优秀的程序员,十分优秀!