flutter widget 混合管理 子组件传值给父组件

这里最重要的就是定义@required this.onChangedui

class SonWidget extends StatefulWidget {
  SonWidget ({Key key,this.weibo,@required this.onChanged}):super(key:key);
  Map weibo;
  final  ValueChanged<bool> onChanged;
}

而后再父widget 中  调用子widgetthis

child:SonWidget(
 onChanged:(value){

 }
)
相关文章
相关标签/搜索