public override Widget build(BuildContext context)
        {
            Widget content = new Container();

            if (this.widget.viewModel.teamLoading && this.widget.viewModel.team == null)
            {
                content = new GlobalLoading();
            }
            else if (this.widget.viewModel.team == null || this.widget.viewModel.team.errorCode == "ResourceNotFound")
            {
                content = new BlankView("公司不存在");
            }
            else
            {
                content = this._buildContent(context: context);
            }

            return(new Container(
                       color: CColors.White,
                       child: new CustomSafeArea(
                           top: false,
                           bottom: false,
                           child: new Stack(
                               children: new List <Widget> {
                content,
                this._buildNavigationBar(context: context)
            }
                               )
                           )
                       ));
        }
        public override Widget build(BuildContext context)
        {
            var    searchTeamIds = this.widget.viewModel.searchTeamIds;
            var    searchKeyword = this.widget.viewModel.searchKeyword ?? "";
            Widget child         = new Container();

            if (this.widget.viewModel.searchTeamLoading && searchTeamIds == null)
            {
                child = new GlobalLoading();
            }
            else if (searchKeyword.Length > 0)
            {
                child = searchTeamIds != null && searchTeamIds.Count > 0
                    ? this._buildContent()
                    : new BlankView(
                    "哎呀,换个关键词试试吧",
                    "image/default-search"
                    );
            }

            return(new Container(
                       color: CColors.White,
                       child: child
                       ));
        }
        public override Widget build(BuildContext context)
        {
            if (this._topPadding != MediaQuery.of(context).padding.top&&
                Application.platform != RuntimePlatform.Android)
            {
                this._topPadding = MediaQuery.of(context).padding.top;
            }

            Widget content = new Container();

            if (this.widget.viewModel.teamLoading && this.widget.viewModel.team == null)
            {
                content = new GlobalLoading();
            }
            else if (this.widget.viewModel.team != null)
            {
                content = this._buildContent(context: context);
            }

            return(new Container(
                       color: CColors.White,
                       child: new CustomSafeArea(
                           top: false,
                           bottom: false,
                           child: new Stack(
                               children: new List <Widget> {
                content,
                this._buildNavigationBar()
            }
                               )
                           )
                       ));
        }
Beispiel #4
0
        public override Widget build(BuildContext context)
        {
            Widget content;
            var    notifications = this.widget.viewModel.notifications;

            if (this.widget.viewModel.notificationLoading && 0 == notifications.Count)
            {
                content = new GlobalLoading();
            }
            else if (0 == notifications.Count)
            {
                content = new BlankView(
                    "好冷清,多和小伙伴们互动呀",
                    "image/default-notification",
                    true,
                    () => {
                    this.widget.actionModel.startFetchNotifications();
                    this.widget.actionModel.fetchNotifications(arg: firstPageNumber);
                }
                    );
            }
            else
            {
                var enablePullUp = this.widget.viewModel.page < this.widget.viewModel.pageTotal;
                content = new Container(
                    color: CColors.Background,
                    child: new CustomListView(
                        controller: this._refreshController,
                        enablePullDown: true,
                        enablePullUp: enablePullUp,
                        onRefresh: this._onRefresh,
                        itemCount: notifications.Count,
                        itemBuilder: this._buildNotificationCard,
                        footerWidget: enablePullUp ? null : CustomListViewConstant.defaultFooterWidget,
                        hasScrollBar: false
                        )
                    );
            }

            return(new Container(
                       color: CColors.White,
                       child: new CustomSafeArea(
                           bottom: false,
                           child: new Column(
                               children: new List <Widget> {
                this._buildNavigationBar(),
                new CustomDivider(
                    color: CColors.Separator2,
                    height: 1
                    ),
                new Flexible(
                    child: new CustomScrollbar(child: content)
                    )
            }
                               )
                           )
                       ));
        }
Beispiel #5
0
        public override Widget build(BuildContext context)
        {
            var    followers = this.widget.viewModel.followers;
            Widget content;

            if (this.widget.viewModel.followerLoading && followers.isEmpty())
            {
                content = new GlobalLoading();
            }
            else if (followers.Count <= 0)
            {
                content = new BlankView(
                    $"暂无{this._title}用户",
                    "image/default-following",
                    true,
                    () => {
                    this.widget.actionModel.startFetchFollower();
                    this.widget.actionModel.fetchFollower(0);
                }
                    );
            }
            else
            {
                content = new CustomScrollbar(
                    new SmartRefresher(
                        controller: this._refreshController,
                        enablePullDown: true,
                        enablePullUp: this.widget.viewModel.followersHasMore,
                        onRefresh: this._onRefresh,
                        child: ListView.builder(
                            physics: new AlwaysScrollableScrollPhysics(),
                            itemCount: followers.Count,
                            itemBuilder: this._buildUserCard
                            )
                        )
                    );
            }

            return(new Container(
                       color: CColors.White,
                       child: new CustomSafeArea(
                           bottom: false,
                           child: new Container(
                               color: CColors.Background,
                               child: new Column(
                                   children: new List <Widget> {
                this._buildNavigationBar(context: context),
                new Expanded(
                    child: content
                    )
            }
                                   )
                               )
                           )
                       ));
        }
Beispiel #6
0
        public override Widget build(BuildContext context)
        {
            var    myFavorites = this.widget.viewModel.myFavoriteIds;
            Widget content;

            if (this.widget.viewModel.myFavoriteLoading && myFavorites.isEmpty())
            {
                content = new GlobalLoading();
            }
            else if (myFavorites.Count <= 0)
            {
                content = new BlankView(
                    "暂无我的收藏列表",
                    "image/default-following",
                    true,
                    () => {
                    this.widget.actionModel.startFetchMyFavorite();
                    this.widget.actionModel.fetchMyFavorite(0);
                }
                    );
            }
            else
            {
                var enablePullUp = this.widget.viewModel.myFavoriteHasMore;
                content = new Container(
                    color: CColors.Background,
                    child: new CustomListView(
                        controller: this._refreshController,
                        enablePullDown: true,
                        enablePullUp: enablePullUp,
                        onRefresh: this._onRefresh,
                        itemCount: myFavorites.Count,
                        itemBuilder: this._buildFavoriteCard,
                        footerWidget: enablePullUp ? null : CustomListViewConstant.defaultFooterWidget
                        )
                    );
            }

            return(new Container(
                       color: CColors.White,
                       child: new CustomSafeArea(
                           bottom: false,
                           child: new Container(
                               color: CColors.White,
                               child: new Column(
                                   children: new List <Widget> {
                this._buildNavigationBar(context: context),
                new Expanded(
                    child: content
                    )
            }
                                   )
                               )
                           )
                       ));
        }
Beispiel #7
0
        public override Widget build(BuildContext context)
        {
            var    game = this.widget.viewModel.game;
            Widget content;

            if (this.widget.viewModel.gameDetailLoading && game == null)
            {
                content = new GlobalLoading();
            }
            else if (game == null)
            {
                content = new BlankView(
                    "暂无该游戏",
                    "image/default-article"
                    );
            }
            else
            {
                content = ListView.builder(
                    itemCount: 3,
                    itemBuilder: this._buildGameItem
                    );
            }

            return(new Container(
                       color: CColors.White,
                       child: new CustomSafeArea(
                           top: false,
                           bottom: false,
                           child: new Container(
                               color: CColors.White,
                               child: new NotificationListener <ScrollNotification>(
                                   onNotification: notification => this._onNotification(context, notification),
                                   child: new Column(
                                       children: new List <Widget> {
                new Expanded(
                    child: new Stack(
                        children: new List <Widget> {
                    content,
                    new Positioned(
                        left: 0,
                        top: 0,
                        right: 0,
                        child: this._buildHeadTop(game: this.widget.viewModel.game,
                                                  context: context)
                        )
                }
                        )
                    )
            }
                                       )
                                   )
                               )
                           )
                       ));
        }
Beispiel #8
0
        public override Widget build(BuildContext context)
        {
            var    bloggerIds = this.widget.viewModel.bloggerIds;
            Widget content;

            if (this.widget.viewModel.bloggerLoading && bloggerIds.isEmpty())
            {
                content = new GlobalLoading();
            }
            else if (bloggerIds.Count <= 0)
            {
                content = new BlankView(
                    "暂无博主",
                    "image/default-following",
                    true,
                    () => {
                    this.widget.actionModel.startFetchBlogger();
                    this.widget.actionModel.fetchBlogger(arg: firstPageNumber);
                }
                    );
            }
            else
            {
                var enablePullUp = this.widget.viewModel.bloggerHasMore;
                content = new CustomListView(
                    controller: this._refreshController,
                    enablePullDown: true,
                    enablePullUp: enablePullUp,
                    onRefresh: this._onRefresh,
                    itemCount: bloggerIds.Count,
                    itemBuilder: this._buildUserCard,
                    footerWidget: enablePullUp ? null : CustomListViewConstant.defaultFooterWidget
                    );
            }

            return(new Container(
                       color: CColors.White,
                       child: new CustomSafeArea(
                           bottom: false,
                           child: new Container(
                               color: CColors.Background,
                               child: new Column(
                                   children: new List <Widget> {
                this._buildNavigationBar(),
                new Flexible(
                    child: content
                    )
            }
                                   )
                               )
                           )
                       ));
        }
        public override Widget build(BuildContext context)
        {
            var    homeEvents = this.widget.viewModel.homeEvents;
            Widget content;

            if (this.widget.viewModel.homeEventLoading && homeEvents.isEmpty())
            {
                content = new GlobalLoading();
            }
            else if (homeEvents.Count == 0)
            {
                content = new BlankView(
                    "暂无推荐活动",
                    "image/default-event",
                    true,
                    () => {
                    this.widget.actionModel.startFetchHomeEvent();
                    this.widget.actionModel.fetchHomeEvents(arg: firstPageNumber);
                }
                    );
            }
            else
            {
                var enablePullUp = this.widget.viewModel.homeEventHasMore;
                content = new CustomListView(
                    controller: this._refreshController,
                    enablePullDown: true,
                    enablePullUp: enablePullUp,
                    onRefresh: this._onRefresh,
                    itemCount: homeEvents.Count,
                    itemBuilder: this._buildEventCard,
                    footerWidget: enablePullUp ? null : CustomListViewConstant.defaultFooterWidget
                    );
            }

            return(new Container(
                       color: CColors.White,
                       child: new CustomSafeArea(
                           bottom: false,
                           child: new Container(
                               color: CColors.Background,
                               child: new Column(
                                   children: new List <Widget> {
                this._buildNavigationBar(),
                new Expanded(child: content)
            }
                                   )
                               )
                           )
                       ));
        }
Beispiel #10
0
        public override Widget build(BuildContext context)
        {
            if (this._topPadding != MediaQuery.of(context).padding.top&&
                Application.platform != RuntimePlatform.Android)
            {
                this._topPadding = MediaQuery.of(context).padding.top;
            }

            Widget content;

            if (this.widget.viewModel.userLoading && this.widget.viewModel.user == null)
            {
                content = new GlobalLoading();
            }
            else if (this.widget.viewModel.user == null || this.widget.viewModel.user.errorCode == "ResourceNotFound")
            {
                content = new BlankView(
                    "用户不存在",
                    "image/default-following"
                    );
            }
            else
            {
                content = this._buildUserContent(context: context);
            }

            return(new Container(
                       color: CColors.White,
                       child: new CustomSafeArea(
                           top: false,
                           bottom: false,
                           child: new Stack(
                               children: new List <Widget> {
                content,
                this._buildNavigationBar(),
                new Positioned(
                    left: 0,
                    top: 44 + this._topPadding,
                    right: 0,
                    child: new Offstage(
                        offstage: !this._isShowTop,
                        child: this._buildUserArticleTitle()
                        )
                    )
            }
                               )
                           )
                       ));
        }
Beispiel #11
0
        public override Widget build(BuildContext context)
        {
            var    members = this.widget.viewModel.members;
            Widget content;

            if (this.widget.viewModel.memberLoading && members.isEmpty())
            {
                content = new GlobalLoading();
            }
            else if (members.Count <= 0)
            {
                content = new BlankView(
                    "暂无更多公司成员",
                    "image/default-following"
                    );
            }
            else
            {
                var enablePullUp = this.widget.viewModel.membersHasMore;
                content = new CustomListView(
                    controller: this._refreshController,
                    enablePullDown: true,
                    enablePullUp: enablePullUp,
                    onRefresh: this._onRefresh,
                    itemCount: members.Count,
                    itemBuilder: this._buildMemberCard,
                    footerWidget: enablePullUp ? null : CustomListViewConstant.defaultFooterWidget
                    );
            }

            return(new Container(
                       color: CColors.White,
                       child: new CustomSafeArea(
                           bottom: false,
                           child: new Container(
                               color: CColors.Background,
                               child: new Column(
                                   children: new List <Widget> {
                this._buildNavigationBar(),
                new Expanded(
                    child: content
                    )
            }
                                   )
                               )
                           )
                       ));
        }
Beispiel #12
0
        public override Widget build(BuildContext context)
        {
            var    favoriteTag = this.widget.viewModel.favoriteTag;
            Widget content;

            if (this.widget.viewModel.favoriteDetailLoading && favoriteTag == null)
            {
                content = new GlobalLoading();
            }
            else if (favoriteTag == null)
            {
                content = new BlankView(
                    "暂无我的收藏详情",
                    "image/default-following",
                    true,
                    () => {
                    this.widget.actionModel.startFetchFavoriteDetail();
                    this.widget.actionModel.fetchFavoriteDetail(arg1: this.widget.viewModel.tagId, 0);
                }
                    );
            }
            else
            {
                content = new NotificationListener <ScrollNotification>(
                    child: this._buildFavoriteContent(),
                    onNotification: this._onNotification
                    );
            }

            return(new Container(
                       color: CColors.White,
                       child: new CustomSafeArea(
                           bottom: false,
                           child: new Column(
                               children: new List <Widget> {
                this._buildNavigationBar(),
                new Expanded(
                    child: content
                    )
            }
                               )
                           )
                       ));
        }
        public override Widget build(BuildContext context)
        {
            Widget content;

            if (this.widget.viewModel.userLoading && this.widget.viewModel.user == null)
            {
                content = new GlobalLoading();
            }
            else if (this.widget.viewModel.user == null || this.widget.viewModel.user.errorCode == "ResourceNotFound")
            {
                content = new BlankView(
                    "用户不存在",
                    "image/default-following"
                    );
            }
            else
            {
                content = this._buildUserContent(context: context);
            }

            return(new Container(
                       color: CColors.White,
                       child: new CustomSafeArea(
                           top: false,
                           bottom: false,
                           child: new Stack(
                               children: new List <Widget> {
                content,
                this._buildNavigationBar(context: context),
                new Positioned(
                    left: 0,
                    top: navBarHeight + CCommonUtils.getSafeAreaTopPadding(context: context),
                    right: 0,
                    child: new Offstage(
                        offstage: !this._isShowTop,
                        child: this._buildUserArticleTitle()
                        )
                    )
            }
                               )
                           )
                       ));
        }
        public override Widget build(BuildContext context)
        {
            var    game = this.widget.viewModel.game;
            Widget content;

            if (this.widget.viewModel.gameDetailLoading && game == null)
            {
                content = new GlobalLoading();
            }
            else if (game == null)
            {
                content = new BlankView(
                    "暂无该游戏",
                    "image/default-article"
                    );
            }
            else
            {
                content = ListView.builder(
                    itemCount: 3,
                    itemBuilder: this._buildGameItem
                    );
            }

            return(new Container(
                       color: CColors.White,
                       child: new CustomSafeArea(
                           bottom: false,
                           child: new Container(
                               color: CColors.White,
                               child: new Column(
                                   children: new List <Widget> {
                this._buildNavigationBar(),
                new Expanded(
                    child: content
                    )
            }
                                   )
                               )
                           )
                       ));
        }
Beispiel #15
0
        public override Widget build(BuildContext context)
        {
            Widget content;
            var    followingTeams = this.widget.viewModel.followingTeams;

            if (this.widget.viewModel.followingTeamLoading && followingTeams.isEmpty())
            {
                content = new GlobalLoading();
            }
            else if (followingTeams.Count <= 0)
            {
                content = new BlankView(
                    "没有关注的公司,去首页看看吧",
                    "image/default-following"
                    );
            }
            else
            {
                var enablePullUp = this.widget.viewModel.followingTeamsHasMore;
                var itemCount    = enablePullUp ? followingTeams.Count + 1 : followingTeams.Count + 2;
                content = new CustomScrollbar(
                    new SmartRefresher(
                        controller: this._refreshController,
                        enablePullDown: true,
                        enablePullUp: enablePullUp,
                        onRefresh: this._onRefresh,
                        child: ListView.builder(
                            physics: new AlwaysScrollableScrollPhysics(),
                            itemCount: itemCount,
                            itemBuilder: this._buildTeamCard
                            )
                        )
                    );
            }
            return(new Container(
                       color: CColors.Background,
                       child: content
                       ));
        }
        public override Widget build(BuildContext context)
        {
            Widget content;
            var    followingTeams = this.widget.viewModel.followingTeams;

            if (this.widget.viewModel.followingTeamLoading && followingTeams.isEmpty())
            {
                content = new GlobalLoading();
            }
            else if (followingTeams.Count <= 0)
            {
                content = new BlankView(
                    "没有关注的公司,去首页看看吧",
                    "image/default-following"
                    );
            }
            else
            {
                var enablePullUp = this.widget.viewModel.followingTeamsHasMore;
                content = new CustomListView(
                    controller: this._refreshController,
                    enablePullDown: true,
                    enablePullUp: enablePullUp,
                    onRefresh: this._onRefresh,
                    itemCount: followingTeams.Count,
                    itemBuilder: this._buildTeamCard,
                    headerWidget: CustomListViewConstant.defaultHeaderWidget,
                    footerWidget: enablePullUp ? null : CustomListViewConstant.defaultFooterWidget
                    );
            }

            return(new Container(
                       color: CColors.Background,
                       child: content
                       ));
        }
        public override Widget build(BuildContext context)
        {
            var    collectionIds = this.widget.viewModel.collectionIds;
            Widget content;

            if (this.widget.viewModel.collectionLoading && collectionIds.isEmpty())
            {
                content = new GlobalLoading(
                    color: CColors.Transparent,
                    loadingColor: LoadingColor.white
                    );
            }
            else if (collectionIds.Count <= 0)
            {
                content = new CustomScrollbar(
                    new CustomScrollView(
                        new PageStorageKey <string>("合辑"),
                        slivers: new List <Widget> {
                    new SliverToBoxAdapter(
                        child: new Container(height: 16)
                        ),
                    new SliverFillRemaining(
                        child: new BlankView(
                            "暂无合辑",
                            "image/default-article",
                            true,
                            () => {
                        this.widget.actionModel.startFetchCollection();
                        this.widget.actionModel.fetchCollection(arg: firstPageNumber);
                    },
                            new BoxDecoration(
                                color: CColors.White,
                                borderRadius: BorderRadius.only(12, 12)
                                )
                            )
                        )
                }
                        )
                    );
            }
            else
            {
                var    enablePullUp = this.widget.viewModel.collectionHasMore;
                Widget endView;
                if (!enablePullUp)
                {
                    endView = new EndView();
                }
                else
                {
                    endView = new Visibility(
                        visible: this._isLoading,
                        child: new Container(
                            padding: EdgeInsets.symmetric(16),
                            child: new CustomActivityIndicator(
                                loadingColor: LoadingColor.white,
                                animating: this._isLoading ? AnimatingType.repeat : AnimatingType.reset
                                )
                            )
                        );
                }

                content = new NotificationListener <ScrollNotification>(
                    onNotification: this._onNotification,
                    child: new CustomScrollbar(
                        new CustomScrollView(
                            new PageStorageKey <string>("合辑"),
                            physics: new AlwaysScrollableScrollPhysics(),
                            slivers: new List <Widget> {
                    new SliverToBoxAdapter(
                        child: new Container(
                            child: new Column(
                                children: new List <Widget> {
                        new SizedBox(height: 16),
                        new LeaderBoardUpdateTip(),
                        new CustomDivider(height: 1, color: CColors.Separator2)
                    }
                                )
                            )
                        ),
                    new SliverFixedExtentList(
                        del: new SliverChildBuilderDelegate(
                            builder: this._buildCollectionCard,
                            childCount: collectionIds.Count
                            ),
                        itemExtent: 112
                        ),
                    new SliverToBoxAdapter(
                        child: endView
                        )
                }
                            )
                        )
                    );
            }

            return(new Container(
                       child: content
                       ));
        }
Beispiel #18
0
        public override Widget build(BuildContext context)
        {
            Widget content;

            if (this.widget.viewModel.searchFollowingUserLoading)
            {
                content = new GlobalLoading();
            }
            else if (this.widget.viewModel.searchFollowingKeyword.Length > 0)
            {
                if (this.widget.viewModel.searchFollowingUsers.Count > 0)
                {
                    content = new Container(
                        color: CColors.Background,
                        child: new CustomScrollbar(
                            new SmartRefresher(
                                controller: this._refreshController,
                                enablePullDown: false,
                                enablePullUp: this.widget.viewModel.searchFollowingUserHasMore,
                                onRefresh: this._onRefreshSearchFollowing,
                                child: ListView.builder(
                                    physics: new AlwaysScrollableScrollPhysics(),
                                    itemCount: this.widget.viewModel.searchFollowingUsers.Count,
                                    itemBuilder: (cxt, index) => {
                        var searchUser = this.widget.viewModel.searchFollowingUsers[index: index];
                        return(new UserCard(
                                   user: searchUser,
                                   () => this.widget.actionModel.pushToUserDetail(obj: searchUser.id),
                                   key: new ObjectKey(value: searchUser.id)
                                   ));
                    }
                                    )
                                )
                            )
                        );
                }
                else
                {
                    content = new BlankView(
                        "哎呀,换个关键词试试吧",
                        "image/default-search"
                        );
                }
            }
            else if (this.widget.viewModel.followingUserLoading && this.widget.viewModel.followingUsers.isEmpty())
            {
                content = new GlobalLoading();
            }
            else if (this.widget.viewModel.followingUsers.Count <= 0)
            {
                content = new BlankView(
                    "没有关注的人,去首页看看吧",
                    "image/default-following"
                    );
            }
            else
            {
                var followingUsers = this.widget.viewModel.followingUsers;
                var enablePullUp   = this.widget.viewModel.followingUsersHasMore;
                var itemCount      = enablePullUp ? followingUsers.Count + 1 : followingUsers.Count + 2;
                content = new CustomScrollbar(
                    new SmartRefresher(
                        controller: this._refreshController,
                        enablePullDown: true,
                        enablePullUp: enablePullUp,
                        onRefresh: this._onRefreshFollowing,
                        child: ListView.builder(
                            physics: new AlwaysScrollableScrollPhysics(),
                            itemCount: itemCount,
                            itemBuilder: (cxt, index) => {
                    if (index == 0)
                    {
                        return(new CustomDivider(color: CColors.White));
                    }

                    if (index == followingUsers.Count + 1)
                    {
                        return(new EndView());
                    }

                    var followingUser = followingUsers[index - 1];
                    UserType userType = UserType.unFollow;
                    if (!this.widget.viewModel.isLoggedIn)
                    {
                        userType = UserType.unFollow;
                    }
                    else
                    {
                        var followUserLoading = false;
                        if (this.widget.viewModel.userDict.ContainsKey(key: followingUser.id))
                        {
                            var user          = this.widget.viewModel.userDict[key: followingUser.id];
                            followUserLoading = user.followUserLoading ?? false;
                        }

                        if (this.widget.viewModel.currentUserId == followingUser.id)
                        {
                            userType = UserType.me;
                        }
                        else if (followUserLoading)
                        {
                            userType = UserType.loading;
                        }
                        else if (this.widget.viewModel.followMap.ContainsKey(key: followingUser.id))
                        {
                            userType = UserType.follow;
                        }
                    }

                    return(new UserCard(
                               user: followingUser,
                               () => this.widget.actionModel.pushToUserDetail(obj: followingUser.id),
                               userType: userType,
                               () => this._onFollow(userType: userType, userId: followingUser.id),
                               new ObjectKey(value: followingUser.id)
                               ));
                }
                            )
                        )
                    );
            }

            return(new Container(
                       color: CColors.Background,
                       child: content
                       ));
        }
        public override Widget build(BuildContext context)
        {
            base.build(context: context);
            Widget content;
            var    notifications = this.widget.viewModel.notifications;

            if (this.widget.viewModel.notificationLoading && notifications.Count == 0)
            {
                content = new GlobalLoading();
            }
            else
            {
                if (notifications.Count <= 0)
                {
                    content = new Container(
                        child: new BlankView(
                            "好冷清,多和小伙伴们互动呀",
                            "image/default-notification",
                            true,
                            () => {
                        this.widget.actionModel.startFetchNotifications();
                        this.widget.actionModel.fetchNotifications(arg: firstPageNumber);
                    }
                            )
                        );
                }
                else
                {
                    var enablePullUp = this.widget.viewModel.page < this.widget.viewModel.pageTotal;
                    var itemCount    = enablePullUp ? notifications.Count : notifications.Count + 1;
                    content = new Container(
                        color: CColors.Background,
                        child: new SmartRefresher(
                            controller: this._refreshController,
                            enablePullDown: true,
                            enablePullUp: enablePullUp,
                            onRefresh: this._onRefresh,
                            child: ListView.builder(
                                physics: new AlwaysScrollableScrollPhysics(),
                                itemCount: itemCount,
                                itemBuilder: this._buildNotificationCard
                                )
                            )
                        );
                }
            }

            return(new Container(
                       color: CColors.White,
                       child: new Column(
                           children: new List <Widget> {
                this._buildNavigationBar(),
                new CustomDivider(
                    color: CColors.Separator2,
                    height: 1
                    ),
                new Flexible(
                    child: new NotificationListener <ScrollNotification>(
                        onNotification: this._onNotification,
                        child: new CustomScrollbar(child: content)
                        )
                    )
            }
                           )
                       ));
        }
Beispiel #20
0
        public override Widget build(BuildContext context)
        {
            base.build(context);
            Widget content = new Container();

            if (this.widget.viewModel.notificationLoading && this.widget.viewModel.notifications.Count == 0)
            {
                content = new GlobalLoading();
            }
            else
            {
                if (this.widget.viewModel.notifications.Count <= 0)
                {
                    content = new Container(
                        child: new BlankView("暂无通知消息", true, () => {
                        this.widget.actionModel.startFetchNotifications();
                        this.widget.actionModel.fetchNotifications(firstPageNumber);
                    })
                        );
                }
                else
                {
                    content = new Container(
                        color: CColors.background3,
                        child: new SmartRefresher(
                            controller: this._refreshController,
                            enablePullDown: true,
                            enablePullUp: this.widget.viewModel.notifications.Count < this.widget.viewModel.total,
                            onRefresh: this._onRefresh,
                            child: ListView.builder(
                                physics: new AlwaysScrollableScrollPhysics(),
                                itemCount: this.widget.viewModel.notifications.Count,
                                itemBuilder: (cxt, index) => {
                        var notification = this.widget.viewModel.notifications[index];
                        var user         = this.widget.viewModel.userDict[notification.data.userId];
                        return(new NotificationCard(
                                   notification,
                                   user,
                                   () => this.widget.actionModel.pushToArticleDetail(notification.data.projectId),
                                   new ObjectKey(notification.id)
                                   ));
                    }
                                )
                            )
                        );
                }
            }

            return(new Container(
                       color: CColors.White,
                       child: new Column(
                           children: new List <Widget> {
                new AnimatedContainer(
                    height: this.navBarHeight,
                    duration: new TimeSpan(0, 0, 0, 0, 0),
                    child: new Row(
                        mainAxisAlignment: MainAxisAlignment.start,
                        crossAxisAlignment: CrossAxisAlignment.end,
                        children: new List <Widget> {
                    new Container(
                        padding: EdgeInsets.only(16, bottom: 8),
                        child: new AnimatedDefaultTextStyle(
                            child: new Text("通知"),
                            style: this.titleStyle,
                            duration: new TimeSpan(0, 0, 0, 0, 100)
                            )
                        )
                }
                        )
                    ),
                new CustomDivider(
                    color: CColors.Separator2,
                    height: 1
                    ),
                new Flexible(
                    child: new NotificationListener <ScrollNotification>(
                        onNotification: this._onNotification,
                        child: content
                        )
                    )
            }
                           )
                       ));
        }
        Widget _buildChatList()
        {
            Widget child = new Container();

            if (this.widget.viewModel.messageLoading)
            {
                child = new GlobalLoading();
            }
            else
            {
                if (this.widget.viewModel.messageList.Count <= 0)
                {
                    child = new BlankView("暂无聊天内容", null);
                }
                else
                {
                    child = new SmartRefresher(
                        controller: this._refreshController,
                        enablePullDown: this.widget.viewModel.hasMore,
                        enablePullUp: false,
                        onRefresh: this._onRefresh,
                        child: ListView.builder(
                            padding: EdgeInsets.only(16, right: 16, bottom: 10),
                            physics: new AlwaysScrollableScrollPhysics(),
                            itemCount: this.widget.viewModel.messageList.Count,
                            itemBuilder: (cxt, index) => {
                        var messageId =
                            this.widget.viewModel.messageList[
                                this.widget.viewModel.messageList.Count - index - 1];
                        var messageDict = new Dictionary <string, Message>();
                        if (this.widget.viewModel.channelMessageDict.ContainsKey(
                                this.widget.viewModel.channelId))
                        {
                            messageDict =
                                this.widget.viewModel.channelMessageDict[this.widget.viewModel.channelId];
                        }

                        var message = new Message();
                        if (messageDict.ContainsKey(messageId))
                        {
                            message = messageDict[messageId];
                        }

                        return(new ChatMessage(
                                   message
                                   ));
                    }
                            )
                        );
                }
            }

            return(new Flexible(
                       child: new GestureDetector(
                           onTap: () => this._focusNode.unfocus(),
                           child: new Container(
                               color: CColors.White,
                               child: child
                               )
                           )
                       ));
        }
Beispiel #22
0
        public override Widget build(BuildContext context)
        {
            Widget child = new Container();

            if (this.widget.viewModel.searchLoading)
            {
                child = new GlobalLoading();
            }
            else if (this.widget.viewModel.searchKeyword.Length > 0)
            {
                if (this.widget.viewModel.searchArticles.Count > 0)
                {
                    var currentPage = this.widget.viewModel.currentPage;
                    var pages       = this.widget.viewModel.pages;
                    child = new Container(
                        color: CColors.Background,
                        child: new SmartRefresher(
                            controller: this._refreshController,
                            enablePullDown: false,
                            enablePullUp: currentPage != pages.Count - 1,
                            onRefresh: this._onRefresh,
                            child: ListView.builder(
                                physics: new AlwaysScrollableScrollPhysics(),
                                itemCount: this.widget.viewModel.searchArticles.Count,
                                itemBuilder: (cxt, index) => {
                        var searchArticle = this.widget.viewModel.searchArticles[index];
                        if (this.widget.viewModel.blockArticleList.Contains(searchArticle.id))
                        {
                            return(new Container());
                        }

                        if (searchArticle.ownerType == OwnerType.user.ToString())
                        {
                            var user = this.widget.viewModel.userDict[searchArticle.userId];
                            return(RelatedArticleCard.User(searchArticle, user,
                                                           () => { this.widget.actionModel.pushToArticleDetail(searchArticle.id); }));
                        }

                        var team = this.widget.viewModel.teamDict[searchArticle.teamId];
                        return(RelatedArticleCard.Team(searchArticle, team,
                                                       () => { this.widget.actionModel.pushToArticleDetail(searchArticle.id); }));
                    }
                                )
                            )
                        );
                }
                else
                {
                    child = new BlankView("暂无搜索结果");
                }
            }
            else
            {
                child = new ListView(
                    children: new List <Widget> {
                    this._buildSearchHistory(this.widget.viewModel.searchHistoryList), this._buildHotSearch()
                }
                    );
            }

            return(new Container(
                       color: CColors.White,
                       child: new CustomSafeArea(
                           child: new Container(
                               child: new Column(
                                   children: new List <Widget> {
                this._buildSearchBar(context),
                new Flexible(
                    child: child
                    )
            }
                                   )
                               )
                           )
                       ));
        }
Beispiel #23
0
        public override Widget build(BuildContext context)
        {
            base.build(context: context);
            Widget content = new Container();

            if (this.widget.viewModel.notificationLoading && this.widget.viewModel.notifications.Count == 0)
            {
                content = new GlobalLoading();
            }
            else
            {
                if (this.widget.viewModel.notifications.Count <= 0)
                {
                    content = new Container(
                        child: new BlankView(
                            "好冷清,多和小伙伴们互动呀",
                            "image/default-notification",
                            true,
                            () => {
                        this.widget.actionModel.startFetchNotifications();
                        this.widget.actionModel.fetchNotifications(firstPageNumber);
                    }
                            )
                        );
                }
                else
                {
                    content = new Container(
                        color: CColors.Background,
                        child: new SmartRefresher(
                            controller: this._refreshController,
                            enablePullDown: true,
                            enablePullUp: this._pageNumber < this.widget.viewModel.pageTotal,
                            onRefresh: this._onRefresh,
                            child: ListView.builder(
                                physics: new AlwaysScrollableScrollPhysics(),
                                itemCount: this.widget.viewModel.notifications.Count,
                                itemBuilder: (cxt, index) => {
                        var notification = this.widget.viewModel.notifications[index];
                        var user         = this.widget.viewModel.userDict[notification.data.userId];
                        return(new NotificationCard(
                                   notification,
                                   user,
                                   this.widget.viewModel.mentions,
                                   () => {
                            this.widget.actionModel.pushToArticleDetail(notification.data.projectId);
                            AnalyticsManager.ClickEnterArticleDetail("Notification_Article",
                                                                     notification.data.projectId, notification.data.projectTitle);
                        },
                                   new ObjectKey(notification.id)
                                   ));
                    }
                                )
                            )
                        );
                }
            }

            return(new Container(
                       color: CColors.White,
                       child: new Column(
                           children: new List <Widget> {
                this._buildNavigationBar(),
                new CustomDivider(
                    color: CColors.Separator2,
                    height: 1
                    ),
                new Flexible(
                    child: new NotificationListener <ScrollNotification>(
                        onNotification: this._onNotification,
                        child: new CustomScrollbar(content)
                        )
                    )
            }
                           )
                       ));
        }
        public override Widget build(BuildContext context)
        {
            var    bloggerIds = this.widget.viewModel.bloggerIds;
            Widget content;

            if (this.widget.viewModel.bloggerLoading && bloggerIds.isEmpty())
            {
                content = new GlobalLoading(
                    color: CColors.Transparent,
                    loadingColor: LoadingColor.white
                    );
            }
            else if (bloggerIds.Count <= 0)
            {
                content = new CustomScrollbar(
                    new CustomScrollView(
                        new PageStorageKey <string>("博主"),
                        physics: new AlwaysScrollableScrollPhysics(),
                        slivers: new List <Widget> {
                    new SliverToBoxAdapter(
                        child: new Container(height: 16)
                        ),
                    new SliverFillRemaining(
                        child: new BlankView(
                            "暂无博主",
                            "image/default-following",
                            true,
                            () => {
                        this.widget.actionModel.startFetchBlogger();
                        this.widget.actionModel.fetchBlogger(arg: firstPageNumber);
                    },
                            new BoxDecoration(
                                color: CColors.White,
                                borderRadius: BorderRadius.only(12, 12)
                                )
                            )
                        )
                }
                        )
                    );
            }
            else
            {
                var    enablePullUp = this.widget.viewModel.bloggerHasMore;
                Widget endView;
                if (!enablePullUp)
                {
                    endView = new EndView();
                }
                else
                {
                    endView = new Visibility(
                        visible: this._isLoading,
                        child: new Container(
                            color: CColors.Background,
                            padding: EdgeInsets.symmetric(16),
                            child: new CustomActivityIndicator(
                                loadingColor: LoadingColor.black,
                                animating: this._isLoading ? AnimatingType.repeat : AnimatingType.reset
                                )
                            )
                        );
                }
                content = new NotificationListener <ScrollNotification>(
                    onNotification: this._onNotification,
                    child: new CustomScrollbar(
                        new CustomScrollView(
                            new PageStorageKey <string>("博主"),
                            physics: new AlwaysScrollableScrollPhysics(),
                            slivers: new List <Widget> {
                    new SliverToBoxAdapter(
                        child: new Container(
                            child: new Column(
                                children: new List <Widget> {
                        new LeaderBoardBloggerHeader(
                            bloggerIds: bloggerIds,
                            userDict: this.widget.viewModel.userDict,
                            userId => this.widget.actionModel.pushToUserDetail(obj: userId)
                            ),
                        new LeaderBoardUpdateTip(),
                        new CustomDivider(height: 1, color: CColors.Separator2)
                    }
                                )
                            )
                        ),
                    new SliverList(
                        del: new SliverChildBuilderDelegate(
                            builder: this._buildBloggerCard,
                            childCount: bloggerIds.Count
                            )
                        ),
                    new SliverToBoxAdapter(
                        child: endView
                        )
                }
                            )
                        )
                    );
            }
            return(new Container(
                       child: content
                       ));
        }
        public override Widget build(BuildContext context)
        {
            Widget content;

            if (this.widget.viewModel.searchFollowingUserLoading)
            {
                content = new GlobalLoading();
            }
            else if (this.widget.viewModel.searchFollowingKeyword.Length > 0)
            {
                if (this.widget.viewModel.searchFollowingUsers.Count > 0)
                {
                    var enablePullUp = this.widget.viewModel.searchFollowingUserHasMore;
                    content = new Container(
                        color: CColors.Background,
                        child: new CustomListView(
                            controller: this._refreshController,
                            enablePullDown: false,
                            enablePullUp: enablePullUp,
                            onRefresh: this._onRefreshSearchFollowing,
                            itemCount: this.widget.viewModel.searchFollowingUsers.Count,
                            itemBuilder: (cxt, index) => {
                        var searchUser = this.widget.viewModel.searchFollowingUsers[index: index];
                        return(new UserCard(
                                   user: searchUser,
                                   CCommonUtils.GetUserLicense(userId: searchUser.id,
                                                               userLicenseMap: this.widget.viewModel.userLicenseDict),
                                   () => this.widget.actionModel.pushToUserDetail(obj: searchUser.id),
                                   key: new ObjectKey(value: searchUser.id)
                                   ));
                    },
                            headerWidget: CustomListViewConstant.defaultHeaderWidget,
                            footerWidget: enablePullUp ? null : CustomListViewConstant.defaultFooterWidget
                            )
                        );
                }
                else
                {
                    content = new BlankView(
                        "哎呀,换个关键词试试吧",
                        "image/default-search"
                        );
                }
            }
            else if (this.widget.viewModel.followingUserLoading && this.widget.viewModel.followingUsers.isEmpty())
            {
                content = new GlobalLoading();
            }
            else if (this.widget.viewModel.followingUsers.Count <= 0)
            {
                content = new BlankView(
                    "没有关注的人,去首页看看吧",
                    "image/default-following"
                    );
            }
            else
            {
                var followingUsers = this.widget.viewModel.followingUsers;
                var enablePullUp   = this.widget.viewModel.followingUsersHasMore;
                content = new CustomListView(
                    controller: this._refreshController,
                    enablePullDown: true,
                    enablePullUp: enablePullUp,
                    onRefresh: this._onRefreshFollowing,
                    itemCount: followingUsers.Count,
                    itemBuilder: this._buildUserCard,
                    headerWidget: CustomListViewConstant.defaultHeaderWidget,
                    footerWidget: enablePullUp ? null : CustomListViewConstant.defaultFooterWidget
                    );
            }

            return(new Container(
                       color: CColors.Background,
                       child: content
                       ));
        }
        public override Widget build(BuildContext context)
        {
            Widget content;

            if (this.isLoading)
            {
                content = new GlobalLoading();
            }
            else if (this.needFetchAgain)
            {
                content = new Container(
                    child: new Column(
                        mainAxisAlignment: MainAxisAlignment.center,
                        children: new List <Widget> {
                    new Container(
                        margin: EdgeInsets.only(bottom: 24),
                        child: Image.asset(
                            name: "image/default-network",
                            width: 128,
                            height: 128
                            )
                        ),
                    new Container(
                        margin: EdgeInsets.only(bottom: 24),
                        child: new Text(
                            data: "数据获取失败",
                            style: new TextStyle(
                                fontSize: 16,
                                fontFamily: "Roboto-Regular",
                                color: CColors.TextBody5
                                )
                            )
                        ),
                    new Container(height: 32),
                    new CustomButton(
                        padding: EdgeInsets.zero,
                        onPressed: () => {
                        this.isLoading      = true;
                        this.needFetchAgain = false;
                        this.setState(() => {});
                        this._checkNewVersion();
                    },
                        child: new Container(
                            height: 40,
                            width: 120,
                            alignment: Alignment.center,
                            decoration: new BoxDecoration(
                                color: CColors.PrimaryBlue,
                                borderRadius: BorderRadius.all(20)
                                ),
                            child: new Text(
                                "重新获取",
                                style: CTextStyle.PLargeMediumWhite.merge(new TextStyle(height: 1))
                                )
                            )
                        )
                }
                        )
                    );
            }
            else
            {
                content = new Container(
                    padding: EdgeInsets.only(top: 120, bottom: 40),
                    child: new Column(
                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
                        children: new List <Widget> {
                    new Column(
                        children: new List <Widget> {
                        new Container(
                            margin: EdgeInsets.only(bottom: 16),
                            alignment: Alignment.center,
                            child: Image.asset(
                                name: "image/unity-icon-logo",
                                width: 128,
                                height: 128,
                                fit: BoxFit.cover
                                )
                            ),
                        new Container(
                            alignment: Alignment.center,
                            child: Image.asset(
                                name: "image/unity-text-logo",
                                width: 149,
                                height: 24,
                                fit: BoxFit.cover
                                )
                            )
                    }
                        ),
                    new Text(
                        "当前版本过低,请升级后使用",
                        style: CTextStyle.PXLargeMedium
                        ),
                    new Container(
                        padding: EdgeInsets.symmetric(horizontal: 16),
                        child: new CustomButton(
                            onPressed: () => {
                        Application.OpenURL(url: this.url);
                    },
                            child: new Container(
                                height: 48,
                                alignment: Alignment.center,
                                decoration: new BoxDecoration(
                                    color: CColors.PrimaryBlue,
                                    borderRadius: BorderRadius.all(24)
                                    ),
                                child: new Text(
                                    "获取最新版本",
                                    style: CTextStyle.PLargeMediumWhite.merge(new TextStyle(height: 1))
                                    )
                                )
                            )
                        )
                }
                        )
                    );
            }

            return(new Container(
                       color: CColors.White,
                       child: new CustomSafeArea(
                           child: new Container(
                               color: CColors.White,
                               child: content
                               )
                           )
                       ));
        }