예제 #1
0
        Widget _buildContent()
        {
            var followArticleIds     = this.widget.viewModel.followArticleIds;
            var followings           = this.widget.viewModel.followings;
            var hotArticleIds        = this.widget.viewModel.hotArticleIds;
            var followArticleLoading = this.widget.viewModel.followArticlesLoading &&
                                       followArticleIds.isEmpty() &&
                                       hotArticleIds.isEmpty();
            var followingLoading = this.widget.viewModel.followingLoading &&
                                   followings.isEmpty();
            Widget content;

            if (followArticleLoading || followingLoading)
            {
                content = new FollowArticleLoading();
            }
            else
            {
                var isHot        = this.widget.viewModel.hotArticlePage > 0;
                var itemCount    = isHot ? hotArticleIds.Count : followArticleIds.Count;
                var enablePullUp = isHot
                    ? this.widget.viewModel.hotArticleHasMore
                    : this.widget.viewModel.followArticleHasMore;
                content = new CustomListView(
                    controller: this._refreshController,
                    enablePullDown: true,
                    enablePullUp: enablePullUp,
                    onRefresh: up => this._onRefresh(up: up, isHot: isHot),
                    hasBottomMargin: true,
                    itemCount: itemCount,
                    itemBuilder: (cxt, index) => this._buildFollowArticleCard(context: cxt, index: index, isFollow: !isHot),
                    headerWidget: followings.isEmpty() ? null : this._buildFollowingList(),
                    footerWidget: enablePullUp ? null : new EndView(hasBottomMargin: true),
                    hasScrollBar: false
                    );
            }

            return(new Container(
                       color: CColors.Background,
                       child: new CustomScrollbar(child: content)
                       ));
        }
예제 #2
0
        Widget _buildContent()
        {
            var followArticleIds     = this.widget.viewModel.followArticleIds;
            var followings           = this.widget.viewModel.followings;
            var hotArticleIds        = this.widget.viewModel.hotArticleIds;
            var followArticleLoading = this.widget.viewModel.followArticlesLoading &&
                                       followArticleIds.isEmpty() &&
                                       hotArticleIds.isEmpty();
            var followingLoading = this.widget.viewModel.followingLoading &&
                                   followings.isEmpty();
            Widget content;

            if (followArticleLoading || followingLoading)
            {
                content = new FollowArticleLoading();
            }
            else if (followArticleIds.isEmpty())
            {
                var itemCount = followings.isEmpty()
                    ? hotArticleIds.Count
                    : hotArticleIds.Count + 1;
                if (!this.widget.viewModel.hotArticleHasMore)
                {
                    itemCount = itemCount + 1;
                }

                content = new SmartRefresher(
                    controller: this._refreshController,
                    enablePullDown: true,
                    enablePullUp: this.widget.viewModel.hotArticleHasMore,
                    onRefresh: up => this._onRefresh(up: up, true),
                    child: ListView.builder(
                        physics: new AlwaysScrollableScrollPhysics(),
                        itemCount: itemCount,
                        itemBuilder: (cxt, index) => this._buildFollowArticleCard(context: cxt, index: index, false)
                        )
                    );
            }
            else
            {
                var itemCount = followings.isEmpty()
                    ? followArticleIds.Count
                    : followArticleIds.Count + 1;
                if (!this.widget.viewModel.followArticleHasMore)
                {
                    itemCount = itemCount + 1;
                }

                content = new SmartRefresher(
                    controller: this._refreshController,
                    enablePullDown: true,
                    enablePullUp: this.widget.viewModel.followArticleHasMore,
                    onRefresh: up => this._onRefresh(up: up, false),
                    child: ListView.builder(
                        physics: new AlwaysScrollableScrollPhysics(),
                        itemCount: itemCount,
                        itemBuilder: (cxt, index) => this._buildFollowArticleCard(context: cxt, index: index)
                        )
                    );
            }

            return(new Container(
                       color: CColors.Background,
                       child: new CustomScrollbar(child: content)
                       ));
        }