Ejemplo n.º 1
0
 public BloggerScreen(
     BloggerScreenViewModel viewModel,
     BloggerScreenActionModel actionModel,
     Key key = null
     ) : base(key: key)
 {
     this.viewModel   = viewModel;
     this.actionModel = actionModel;
 }
Ejemplo n.º 2
0
 public override Widget build(BuildContext context)
 {
     return(new StoreConnector <AppState, BloggerScreenViewModel>(
                converter: state => {
         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 BloggerScreenViewModel {
             bloggerLoading = state.leaderBoardState.homeBloggerLoading,
             bloggerIds = state.leaderBoardState.homeBloggerIds,
             bloggerHasMore = state.leaderBoardState.homeBloggerHasMore,
             bloggerPageNumber = state.leaderBoardState.homeBloggerPageNumber,
             isLoggedIn = state.loginState.isLoggedIn,
             currentUserId = currentUserId,
             userDict = state.userState.userDict,
             followMap = followMap,
             userLicenseDict = state.userState.userLicenseDict
         };
     },
                builder: (context1, viewModel, dispatcher) => {
         var actionModel = new BloggerScreenActionModel {
             mainRouterPop = () => dispatcher.dispatch(new MainNavigatorPopAction()),
             startFetchBlogger = () => dispatcher.dispatch(new StartFetchHomeBloggerAction()),
             fetchBlogger = page => dispatcher.dispatch <IPromise>(Actions.fetchHomeBlogger(page: page)),
             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)),
             pushToLogin = () => dispatcher.dispatch(new MainNavigatorPushToAction {
                 routeName = MainNavigatorRoutes.Login
             }),
             pushToUserDetail = userId => dispatcher.dispatch(new MainNavigatorPushToUserDetailAction {
                 userId = userId
             })
         };
         return new BloggerScreen(viewModel: viewModel, actionModel: actionModel);
     }
                ));
 }