Пример #1
0
 public UserFollowerScreen(
     UserFollowerScreenViewModel viewModel     = null,
     UserFollowerScreenActionModel actionModel = null,
     Key key = null
     ) : base(key: key)
 {
     this.viewModel   = viewModel;
     this.actionModel = actionModel;
 }
Пример #2
0
 public override Widget build(BuildContext context)
 {
     return(new StoreConnector <AppState, UserFollowerScreenViewModel>(
                converter: state => {
         var user = state.userState.userDict.ContainsKey(key: this.userId)
                 ? state.userState.userDict[key: this.userId]
                 : new User();
         var followers = user.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 UserFollowerScreenViewModel {
             userId = this.userId,
             followerLoading = state.userState.followerLoading,
             followers = followers,
             followersHasMore = user.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 UserFollowerScreenActionModel {
             startFetchFollower = () => dispatcher.dispatch(new StartFetchFollowerAction()),
             fetchFollower = offset =>
                             dispatcher.dispatch <IPromise>(Actions.fetchFollower(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)),
             mainRouterPop = () => dispatcher.dispatch(new MainNavigatorPopAction()),
             pushToLogin = () => dispatcher.dispatch(new MainNavigatorPushToAction {
                 routeName = MainNavigatorRoutes.Login
             }),
             pushToUserDetail = userId => dispatcher.dispatch(
                 new MainNavigatorPushToUserDetailAction {
                 userId = userId
             }
                 )
         };
         return new UserFollowerScreen(viewModel: viewModel, actionModel: actionModel);
     }
                ));
 }