这里最重要的就是定义@required this.onChanged
class SonWidget extends StatefulWidget {
SonWidget ({Key key,this.weibo,@required this.onChanged}):super(key:key);
Map weibo;
final ValueChanged<bool> onChanged;
}
然后再父widget 中 调用子widget
child:SonWidget(
onChanged:(value){
}
)