Android学习记录

Fish_redux如何创建一个TabController

2020-09-07  本文已影响0人  旺仔_100

在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)
上一篇 下一篇

猜你喜欢

热点阅读