public TeamFollowerScreen( TeamFollowerScreenViewModel viewModel = null, TeamFollowerScreenActionModel actionModel = null, Key key = null ) : base(key: key) { this.viewModel = viewModel; this.actionModel = actionModel; }
public override Widget build(BuildContext context) { return(new StoreConnector <AppState, TeamFollowerScreenViewModel>( converter: state => { var team = state.teamState.teamDict.ContainsKey(key: this.teamId) ? state.teamState.teamDict[key: this.teamId] : new Team(); var followers = team.followers ?? new List <User>(); var currentUserId = state.loginState.loginInfo.userId ?? ""; var followMap = state.followState.followDict.ContainsKey(key: currentUserId) ? state.followState.followDict[key: currentUserId] : new Dictionary <string, bool>(); return new TeamFollowerScreenViewModel { teamId = this.teamId, followerLoading = state.teamState.followerLoading, followers = followers, followersHasMore = team.followersHasMore ?? false, userOffset = followers.Count, userDict = state.userState.userDict, userLicenseDict = state.userState.userLicenseDict, followMap = followMap, currentUserId = currentUserId, isLoggedIn = state.loginState.isLoggedIn }; }, builder: (context1, viewModel, dispatcher) => { var actionModel = new TeamFollowerScreenActionModel { startFetchFollower = () => dispatcher.dispatch(new StartFetchTeamFollowerAction()), fetchFollower = offset => dispatcher.dispatch <IPromise>(Actions.fetchTeamFollower(teamId: this.teamId, offset: offset)), startFollowUser = followUserId => dispatcher.dispatch(new StartFollowUserAction { followUserId = followUserId }), followUser = followUserId => dispatcher.dispatch <IPromise>(Actions.fetchFollowUser(followUserId: followUserId)), startUnFollowUser = unFollowUserId => dispatcher.dispatch(new StartUnFollowUserAction { unFollowUserId = unFollowUserId }), unFollowUser = unFollowUserId => dispatcher.dispatch <IPromise>(Actions.fetchUnFollowUser(unFollowUserId: unFollowUserId)), mainRouterPop = () => dispatcher.dispatch(new MainNavigatorPopAction()), pushToLogin = () => dispatcher.dispatch(new MainNavigatorPushToAction { routeName = MainNavigatorRoutes.Login }), pushToUserDetail = userId => dispatcher.dispatch( new MainNavigatorPushToUserDetailAction { userId = userId } ) }; return new TeamFollowerScreen(viewModel: viewModel, actionModel: actionModel); } )); }