fish_redux adapter使用问题 Navigator传参使用问题

168 阅读1分钟
各位老师,你们好! 我是一个刚刚接触移动端的程序员,初步学习了flutter,在项目开发过程中,想寻找一些flutter的框架,发现了 fish_redux,在使用中遇到了一些问题,想请教您一下。


1.关于adapter的循环使用

orgloginstatus_page,里面利用 orgloginstatus_adapter循环展示了 orgstatus_component的内容(通过API接口获取的数据ListA,接口报文类型为JSON),orgstatus_component是一个按钮, 

image.png

image.png

image.png

我想实现的是 当点击按钮的时候,showDailog 一个循环列表(tellerstatus_component的内容),

Effect<OrgStatusComponentState> buildEffect(OpenDoorMapper openDoorMapper) {
   return combineEffects(<Object, Effect<OrgStatusComponentState>>{
      Lifecycle.initState: _init,
      OrgStatusComponentAction.showTellerStatusEffect: _onShowTellerStatusEffect,
   });
}
void _init(Action action, Context<OrgStatusComponentState> ctx) {}
void _onShowTellerStatusEffect(Action action, Context<OrgStatusComponentState> ctx) {
   showDialog(
      context: ctx.context,
      builder: (BuildContext context) {
         return ctx.buildComponent('dialog');
      }
   );
}

列表内容是通过tellerdialog_component的effect  API接口获取的 

void _onRefresh(Action action, Context<TellerDialogState> ctx) async {
   NetUtil.get(Api.TellerStatusMapper + '/' + ctx.state.openDoorMapper.orgid, (data){
      List<TellerStatusMapper> tellerList = getTellerStatusMapperList(data);
       ctx.dispatch(TellerDialogAdapterActionCreator.onSetNewData(tellerList));
   }, errorCallBack: (errorMsg){
      println("error: " + errorMsg);
   });
}

这个时候我在 tellerdialog_component下对应创建了一个 tellerdialog_adapter,用来循环展示tellerstaus_component的内容,

image.png

这样当我点击页面上的按钮时候,理想的是弹出showdailog的循环内容,可实际情况是报类型错误。

image.png

不知道为什么?

界面显示的是这样的

image.png

实际想实现的是这样的

image.png



    2. 关于Navigator传参问题

Navigator.of(ctx.context).pushNamed('aaa', arguments: action.payload); 时,怎么在 ‘aaa’ 页获取到 传递过来的 action.paload数据,是在‘aaa’的page里面,还是state里面,或者是effect里面?