Widget build(BuildContext context) => Scaffold(
appBar: AppBar(
title: Text(MyApp.title),
centerTitle: true,
),
body: (()=>{
if(!list){
return Register();
}
else{
return Homepage();
}
})
);
我的应用程序在 init 上从本地存储中获取一个列表,然后下一个要呈现的页面取决于该列表是否为空。有没有办法根据条件确定要呈现的小部件?
答案 0 :(得分:1)
Widget build(BuildContext context) => Scaffold(
appBar: AppBar(
title: Text(MyApp.title),
centerTitle: true,
),
body: list.isEmpty ? Register() : Homepage()
);