public GameScreen( GameScreenViewModel viewModel, GameScreenActionModel actionModel, Key key = null ) : base(key: key) { this.viewModel = viewModel; this.actionModel = actionModel; }
public override Widget build(BuildContext context) { return new StoreConnector<AppState, GameScreenViewModel>( converter: state => new GameScreenViewModel { gameLoading = state.gameState.gameLoading, gameIds = state.gameState.gameIds, gamePage = state.gameState.gamePage, gameHasMore = state.gameState.gameHasMore, rankDict = state.leaderBoardState.rankDict }, builder: (context1, viewModel, dispatcher) => { var actionModel = new GameScreenActionModel { mainRouterPop = () => dispatcher.dispatch(new MainNavigatorPopAction()), pushToGameDetail = gameId => dispatcher.dispatch(new MainNavigatorPushToGameDetailAction { gameId = gameId }), startFetchGame = () => dispatcher.dispatch(new StartFetchGameAction()), fetchGame = page => dispatcher.dispatch<IPromise>(Actions.fetchGames(page: page)) }; return new GameScreen(viewModel: viewModel, actionModel: actionModel); } ); }