【发布时间】:2021-09-21 06:45:21
【问题描述】:
我写代码的时候出错了
这是我写的代码
class ProgressHUD extends StatelessWidget {
final Widget child;
final bool inAsyncCall;
final double opacity;
final Color color;
final Animation<Color> valueColor;
ProgressHUD({
required Key key,
required this.child,
required this.inAsyncCall,
this.opacity = 0.3,
this.color = Colors.grey,
required this.valueColor,
}) : super(key: key);
@override
Widget build(BuildContext context) {
List<Widget> widgetList = new List<Widget>();
widgetList.add(child);
if (inAsyncCall) {
final model = new Stack(
children: [
new Opacity(
opacity: opacity,
child: ModalBarrier(dismissible: false, color: color),
),
new Center(
child: new CircularProgressIndicator()
),
],
);
return Stack(children: widgetList,);
}
}
}
Build 上出现的错误消息说主体可能正常完成,导致返回“null”,但返回类型可能是不可为空的类型。 然后第二个错误在 List 中说 'list' 已弃用,不应使用
有人可以帮我解决它吗谢谢
【问题讨论】:
标签: visual-studio flutter dart