【发布时间】:2021-05-15 07:24:00
【问题描述】:
为什么这段代码在 Flutter 中不起作用?它说它不能使用带有 Widget build(BuildContext context) {
return Scaffold(
body: SafeArea(
child: ListView(
padding: EdgeInsets.symmetric(vertical: 30.0),
children: <widget>[
Padding(
padding: const EdgeInsets.only(left: 20.0, right: 120.0),
child: Text(
'what would you like to find?',
style: TextStyle(
fontSize: 30.0,
fontWeight: FontWeight.bold,
),
),
),
],
),
),
),
);
}
}
【问题讨论】:
-
简单地说,只需删除
。它会正常工作。在 Flutter 中,一切都是小部件