【发布时间】:2019-11-26 06:10:52
【问题描述】:
如果没有返回数据,我想在正文中添加一个文本小部件。否则,我想显示数据。但是,返回以下错误:
flutter: type '_CompactLinkedHashSet<Widget>' is not a subtype of type 'Widget'
我的代码:
body: SafeArea(
child: (isLoading)
? Center(
child: new CircularProgressIndicator(),
)
: Stack(
children: <Widget>[
(jobDetail == null && !isLoading)
? noDataFound()
: {
detailWidget(context, jobDetail),
applyWidget(context, jobDetail)
}
],
),
),
这是我的文本小部件代码
Widget noDataFound() {
return Container(
child: Center(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
"We could not get the detail. Please try again later",
textAlign: TextAlign.center,
style: TextStyle(fontSize: 20.0),
),
)),
);
}
【问题讨论】:
-
你尝试过未来的建设者吗?
-
谢谢。不,我没有尝试过未来的建设者。我目前的逻辑有什么不对吗?
-
尝试删除这个:&& !isLoading
标签: flutter