美文网首页Android学习记录
Fish_redux如何创建一个TabController

Fish_redux如何创建一个TabController

作者: 旺仔_100 | 来源:发表于2020-09-07 13:40 被阅读0次

在page对应的界面创建一个createState方法

class DeviceDetailPage extends Page<DeviceDetailState, Map<String, dynamic>> {

  @override
  StateWithTickerProvider  createState() =>StateWithTickerProvider();

  DeviceDetailPage()
      : super(
            initState: initState,
            effect: buildEffect(),
            reducer: buildReducer(),
            view: buildView,
            dependencies: Dependencies<DeviceDetailState>(
                adapter: null,
                slots: <String, Dependent<DeviceDetailState>>{
                }),
            middleware: <Middleware<DeviceDetailState>>[
            ],);

}

class StateWithTickerProvider extends ComponentState<DeviceDetailState> with TickerProviderStateMixin{

}

二,在effect文件里面创建TabContoller

final TickerProvider tickerProvider = ctx.stfState as StateWithTickerProvider;
TabController(
          length: ctx.state.projectList.length, vsync: tickerProvider)

相关文章

网友评论

    本文标题:Fish_redux如何创建一个TabController

    本文链接:https://www.haomeiwen.com/subject/yibkektx.html