【发布时间】:2020-11-28 18:53:35
【问题描述】:
我正在学习一些颤振,我遇到了我们定义状态的部分,一个类被赋予了这样的东西:
class _sButtonState extends State<sButton>{
@override
Widget build(BuildContext context){
return Container(
RaisedButton(
color: Colors.red,
child: widget.child,
onPressed: widget.onPressed,
)
);
}
}
widget 不是在任何地方定义的 instance 或 class 变量。所以,我只能假设它是由 dart 框架隐式提供的。所以,我的问题是:
- 什么是
widget - 什么是 widget.child
- 什么是 widget.onPressed
- 在
dart中隐式提供的变量是什么?
【问题讨论】: