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){

 }
)
相關文章
相關標籤/搜索