public ChannelMembersScreen( ChannelMembersScreenActionModel actionModel = null, ChannelMembersScreenViewModel viewModel = null, Key key = null ) : base(key: key) { this.viewModel = viewModel; this.actionModel = actionModel; }
public override Widget build(BuildContext context) { return(new StoreConnector <AppState, ChannelMembersScreenViewModel>( converter: state => { var channel = state.channelState.channelDict[key: this.channelId]; var members = channel.memberIds.Select( memberId => channel.membersDict[key: memberId] ).ToList(); Dictionary <string, bool> followDict = new Dictionary <string, bool>(); if (state.loginState.isLoggedIn) { state.followState.followDict.TryGetValue(key: state.loginState.loginInfo.userId, value: out followDict); } return new ChannelMembersScreenViewModel { channel = channel, followed = followDict, userDict = state.userState.userDict, members = members, isLoggedIn = state.loginState.isLoggedIn, currentUserId = state.loginState.loginInfo.userId ?? "" }; }, builder: (context1, viewModel, dispatcher) => { var actionModel = new ChannelMembersScreenActionModel { mainRouterPop = () => dispatcher.dispatch(new MainNavigatorPopAction()), pushToLogin = () => dispatcher.dispatch(new MainNavigatorPushToAction { routeName = MainNavigatorRoutes.Login }), pushToUserDetail = userId => dispatcher.dispatch(new MainNavigatorPushToUserDetailAction { userId = userId }), fetchMembers = offset => dispatcher.dispatch <IPromise>( Actions.fetchChannelMembers(channelId: this.channelId, 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)) }; return new ChannelMembersScreen(actionModel: actionModel, viewModel: viewModel); } )); }