'build' 方法在 Flutter 的超类型中始终是抽象的
The method 'build' is always abstract in the supertype in Flutter
我每次都试图在颤动中重建我的 TabController 屏幕,为此我
需要在 Widget build(BuildContext context)
方法中添加 super.build(context);
。但我在编译时出错
我收到以下错误
The method 'build' is always abstract in the supertype. (Documentation)
这是我的代码
class TrendingScreen 扩展了 StatefulWidget {
@覆盖
_TrendingScreenState createState() => _TrendingScreenState();
}
class _TrendingScreenState extends State<TrendingScreen> {
@override
Widget build(BuildContext context) {
super.build(context);
return Scaffold(
backgroundColor: colorSecondary,
appBar: customAppbar(),
body: Container(
height: double.infinity,
width: double.infinity,
child: buildTrendingList()));
}
}
我缺少一个将 mixin 与 AutomaticKeepAliveClientMixin
添加到状态 class 然后你可以调用 super.build(context);
我每次都试图在颤动中重建我的 TabController 屏幕,为此我
需要在 Widget build(BuildContext context)
方法中添加 super.build(context);
。但我在编译时出错
我收到以下错误
The method 'build' is always abstract in the supertype. (Documentation)
这是我的代码
class TrendingScreen 扩展了 StatefulWidget { @覆盖 _TrendingScreenState createState() => _TrendingScreenState(); }
class _TrendingScreenState extends State<TrendingScreen> {
@override
Widget build(BuildContext context) {
super.build(context);
return Scaffold(
backgroundColor: colorSecondary,
appBar: customAppbar(),
body: Container(
height: double.infinity,
width: double.infinity,
child: buildTrendingList()));
}
}
我缺少一个将 mixin 与 AutomaticKeepAliveClientMixin
添加到状态 class 然后你可以调用 super.build(context);