public override Widget build(BuildContext context) { return(new StoreConnector <AppState, UserFollowingScreenViewModel>( converter: state => { var user = state.userState.userDict.ContainsKey(key: this.userId) ? state.userState.userDict[key: this.userId] : new User(); var followingUsers = user.followingUsers ?? 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 UserFollowingScreenViewModel { userId = this.userId, followingUserLoading = state.userState.followingUserLoading, searchFollowingUserLoading = state.searchState.searchFollowingLoading, followingUsers = followingUsers, searchFollowingUsers = state.searchState.searchFollowings, searchFollowingKeyword = state.searchState.searchFollowingKeyword, searchFollowingUserHasMore = state.searchState.searchFollowingHasMore, followingUsersHasMore = user.followingUsersHasMore ?? false, followingUserOffset = followingUsers.Count, userDict = state.userState.userDict, userLicenseDict = state.userState.userLicenseDict, followMap = followMap, currentUserId = currentUserId, isLoggedIn = state.loginState.isLoggedIn }; }, builder: (context1, viewModel, dispatcher) => { var actionModel = new UserFollowingScreenActionModel { startFetchFollowingUser = () => dispatcher.dispatch(new StartFetchFollowingUserAction()), fetchFollowingUser = offset => dispatcher.dispatch <IPromise>(Actions.fetchFollowingUser(userId: this.userId, 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)), startSearchFollowingUser = () => dispatcher.dispatch(new StartSearchFollowingAction()), searchFollowingUser = (keyword, pageNumber) => dispatcher.dispatch <IPromise>( Actions.searchFollowings(keyword: keyword, pageNumber: pageNumber)), pushToLogin = () => dispatcher.dispatch(new MainNavigatorPushToAction { routeName = MainNavigatorRoutes.Login }), pushToUserDetail = userId => dispatcher.dispatch( new MainNavigatorPushToUserDetailAction { userId = userId } ) }; return new UserFollowingUserScreen(viewModel: viewModel, actionModel: actionModel); } )); }
public UserFollowingScreen( UserFollowingScreenViewModel viewModel = null, UserFollowingScreenActionModel actionModel = null, Key key = null ) : base(key: key) { this.viewModel = viewModel; this.actionModel = actionModel; }
public override Widget build(BuildContext context) { return(new StoreConnector <AppState, UserFollowingScreenViewModel>( converter: state => { var user = state.userState.userDict.ContainsKey(key: this.userId) ? state.userState.userDict[key: this.userId] : new User(); var followingTeams = user.followingTeams ?? new List <Team>(); 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 UserFollowingScreenViewModel { userId = this.userId, followingTeamLoading = state.userState.followingTeamLoading, followingTeams = followingTeams, followingTeamsHasMore = user.followingTeamsHasMore ?? false, followingTeamOffset = followingTeams.Count, teamDict = state.teamState.teamDict, followMap = followMap, currentUserId = currentUserId, isLoggedIn = state.loginState.isLoggedIn }; }, builder: (context1, viewModel, dispatcher) => { var actionModel = new UserFollowingScreenActionModel { startFetchFollowingTeam = () => dispatcher.dispatch(new StartFetchFollowingTeamAction()), fetchFollowingTeam = offset => dispatcher.dispatch <IPromise>(Actions.fetchFollowingTeam(userId: this.userId, offset: offset)), startFollowTeam = followTeamId => dispatcher.dispatch(new StartFetchFollowTeamAction { followTeamId = followTeamId }), followTeam = followTeamId => dispatcher.dispatch <IPromise>(Actions.fetchFollowTeam(followTeamId: followTeamId)), startUnFollowTeam = unFollowTeamId => dispatcher.dispatch(new StartFetchUnFollowTeamAction { unFollowTeamId = unFollowTeamId }), unFollowTeam = unFollowTeamId => dispatcher.dispatch <IPromise>(Actions.fetchUnFollowTeam(unFollowTeamId: unFollowTeamId)), pushToLogin = () => dispatcher.dispatch(new MainNavigatorPushToAction { routeName = MainNavigatorRoutes.Login }), pushToTeamDetail = teamId => dispatcher.dispatch( new MainNavigatorPushToTeamDetailAction { teamId = teamId } ) }; return new UserFollowingTeamScreen(viewModel: viewModel, actionModel: actionModel); } )); }
public override Widget build(BuildContext context) { return(new StoreConnector <AppState, UserFollowingScreenViewModel>( converter: state => new UserFollowingScreenViewModel { userId = this.userId, initialPage = this.initialPage, searchFollowingKeyword = state.searchState.searchFollowingKeyword, searchFollowingUsers = state.searchState.searchFollowings, currentUserId = state.loginState.loginInfo.userId ?? "" }, builder: (context1, viewModel, dispatcher) => { var actionModel = new UserFollowingScreenActionModel { mainRouterPop = () => dispatcher.dispatch(new MainNavigatorPopAction()), clearSearchFollowingResult = () => dispatcher.dispatch(new ClearSearchFollowingResultAction()) }; return new UserFollowingScreen(viewModel: viewModel, actionModel: actionModel); } )); }