void _showShareView(IEvent eventObj)
 {
     ActionSheetUtils.showModalActionSheet(
         new ShareView(
             projectType: ProjectType.iEvent,
             onPressed: type => {
         AnalyticsManager.ClickShare(shareType: type, "Event", "Event_" + eventObj.id,
                                     title: eventObj.title);
         var linkUrl = $"{Config.apiAddress}/events/{eventObj.id}";
         var path    = CStringUtils.CreateMiniPath(id: eventObj.id, title: eventObj.title);
         if (type == ShareType.clipBoard)
         {
             this.widget.actionModel.copyText(obj: linkUrl);
             CustomDialogUtils.showToast("复制链接成功", iconData: Icons.check_circle_outline);
         }
         else
         {
             var imageUrl = CImageUtils.SizeTo200ImageUrl(imageUrl: eventObj.avatar);
             CustomDialogUtils.showCustomDialog(
                 child: new CustomLoadingDialog()
                 );
             this.widget.actionModel.shareToWechat(
                 arg1: type,
                 arg2: eventObj.title,
                 arg3: eventObj.shortDescription,
                 arg4: linkUrl,
                 arg5: imageUrl,
                 arg6: path)
             .Then(onResolved: CustomDialogUtils.hiddenCustomDialog)
             .Catch(_ => CustomDialogUtils.hiddenCustomDialog());
         }
     }
             )
         );
 }
예제 #2
0
 void _sendComment(string type, string parentMessageId = "", string upperMessageId = "",
                   string replyUserName = null)
 {
     if (!this.widget.viewModel.isLoggedIn)
     {
         this.widget.actionModel.pushToLogin();
     }
     else
     {
         AnalyticsManager.ClickComment(
             type: type,
             channelId: this._article.channelId,
             title: this._article.title,
             commentId: parentMessageId
             );
         ActionSheetUtils.showModalActionSheet(new CustomInput(
                                                   replyUserName: replyUserName,
                                                   text => {
             ActionSheetUtils.hiddenModalPopup();
             this.widget.actionModel.sendComment(
                 arg1: this._article.channelId,
                 arg2: text,
                 Snowflake.CreateNonce(),
                 arg4: parentMessageId,
                 arg5: upperMessageId
                 );
         })
                                               );
     }
 }
예제 #3
0
        void _pickImage()
        {
            var items = new List <ActionSheetItem> {
                new ActionSheetItem(
                    "拍照",
                    onTap: () => PickImagePlugin.PickImage(
                        source: ImageSource.camera,
                        pickImage => {
                    this._pickedImage = pickImage;
                    this.setState(() => { });
                }
                        )
                    ),
                new ActionSheetItem(
                    "从相册选择",
                    onTap: () => PickImagePlugin.PickImage(
                        source: ImageSource.gallery,
                        pickImage => {
                    this._pickedImage = pickImage;
                    this.setState(() => { });
                }
                        )
                    ),
                new ActionSheetItem("取消", type: ActionType.cancel)
            };

            ActionSheetUtils.showModalActionSheet(new ActionSheet(
                                                      title: "修改头像",
                                                      items: items
                                                      ));
        }
예제 #4
0
 Widget _buildArticleTabBar()
 {
     return(new ArticleTabBar(
                this._article.like && this.widget.viewModel.isLoggedIn,
                this.widget.viewModel.isLoggedIn &&
                this._article.favorites.isNotNullAndEmpty(),
                () => this._sendComment("Article"),
                () => this._sendComment("Article"),
                () => {
         if (!this.widget.viewModel.isLoggedIn)
         {
             this.widget.actionModel.pushToLogin();
         }
         else
         {
             if (!this._article.like)
             {
                 this.widget.actionModel.likeArticle(arg: this._article.id);
             }
         }
     },
                () => {
         if (!this.widget.viewModel.isLoggedIn)
         {
             this.widget.actionModel.pushToLogin();
         }
         else
         {
             ActionSheetUtils.showModalActionSheet(new FavoriteSheetConnector(articleId: this._article.id));
         }
     },
                shareCallback: this.share
                ));
 }
예제 #5
0
        public static void cancelBlockUser(
            bool isLoggedIn,
            VoidCallback pushToLogin,
            VoidCallback cancelBlockUserAction,
            VoidCallback mainRouterPop = null
            )
        {
            if (!isLoggedIn)
            {
                pushToLogin();
                return;
            }

            ActionSheetUtils.showModalActionSheet(new ActionSheet(
                                                      title: "确定取消屏蔽该用户吗?",
                                                      items: new List <ActionSheetItem> {
                new ActionSheetItem(
                    "确定",
                    type: ActionType.destructive,
                    () => {
                    cancelBlockUserAction();
                    mainRouterPop?.Invoke();
                }
                    ),
                new ActionSheetItem("取消", type: ActionType.cancel)
            }
                                                      ));
        }
예제 #6
0
        public static void blockProject(
            bool isLoggedIn,
            VoidCallback pushToLogin,
            VoidCallback pushToBlock,
            VoidCallback mainRouterPop = null
            )
        {
            if (!isLoggedIn)
            {
                pushToLogin();
                return;
            }

            ActionSheetUtils.showModalActionSheet(new ActionSheet(
                                                      title: "确定屏蔽当前内容吗?",
                                                      items: new List <ActionSheetItem> {
                new ActionSheetItem(
                    "确定",
                    type: ActionType.destructive,
                    () => {
                    pushToBlock();
                    if (mainRouterPop != null)
                    {
                        mainRouterPop();
                    }
                }
                    ),
                new ActionSheetItem("取消", type: ActionType.cancel)
            }
                                                      ));
        }
예제 #7
0
 void _onFollow(UserType userType, string teamId)
 {
     if (this.widget.viewModel.isLoggedIn)
     {
         if (userType == UserType.follow)
         {
             ActionSheetUtils.showModalActionSheet(
                 new ActionSheet(
                     title: "确定不再关注?",
                     items: new List <ActionSheetItem> {
                 new ActionSheetItem("确定", type: ActionType.normal,
                                     () => {
                     this.widget.actionModel.startUnFollowTeam(obj: teamId);
                     this.widget.actionModel.unFollowTeam(arg: teamId);
                 }),
                 new ActionSheetItem("取消", type: ActionType.cancel)
             }
                     )
                 );
         }
         if (userType == UserType.unFollow)
         {
             this.widget.actionModel.startFollowTeam(obj: teamId);
             this.widget.actionModel.followTeam(arg: teamId);
         }
     }
     else
     {
         this.widget.actionModel.pushToLogin();
     }
 }
예제 #8
0
 Widget _buildLogoutBtn()
 {
     return(new CustomButton(
                padding: EdgeInsets.zero,
                onPressed: () => {
         ActionSheetUtils.showModalActionSheet(new ActionSheet(
                                                   title: "确定退出当前账号吗?",
                                                   items: new List <ActionSheetItem> {
             new ActionSheetItem("退出", type: ActionType.destructive,
                                 () => {
                 AnalyticsManager.ClickLogout();
                 this.widget.actionModel.logout();
                 JPushPlugin.deleteJPushAlias();
             }),
             new ActionSheetItem("取消", type: ActionType.cancel)
         }
                                                   ));
     },
                child: new Container(
                    height: 60,
                    color: CColors.White,
                    child: new Row(
                        mainAxisAlignment: MainAxisAlignment.center,
                        crossAxisAlignment: CrossAxisAlignment.center,
                        children: new List <Widget> {
         new Text(
             "退出登录",
             style: CTextStyle.PLargeError
             )
     }
                        )
                    )
                ));
 }
예제 #9
0
 Widget _buildArticleTabBar()
 {
     return(new ArticleTabBar(
                this._article.like && this.widget.viewModel.isLoggedIn,
                this._article.favorite != null && this.widget.viewModel.isLoggedIn,
                () => this._sendComment("Article"),
                () => this._sendComment("Article"),
                () => {
         if (!this.widget.viewModel.isLoggedIn)
         {
             this.widget.actionModel.pushToLogin();
         }
         else
         {
             if (!this._article.like)
             {
                 this.widget.actionModel.likeArticle(arg: this._article.id);
             }
         }
     },
                () => {
         if (!this.widget.viewModel.isLoggedIn)
         {
             this.widget.actionModel.pushToLogin();
         }
         else
         {
             if (this._article.favorite == null)
             {
                 ActionSheetUtils.showModalActionSheet(new FavoriteSheetConnector(articleId: this._article.id));
             }
             else
             {
                 ActionSheetUtils.showModalActionSheet(
                     new ActionSheet(
                         title: "确定不再收藏?",
                         items: new List <ActionSheetItem> {
                     new ActionSheetItem(
                         "确定",
                         type: ActionType.normal,
                         () => {
                         this.widget.actionModel.unFavoriteArticle(arg: this._article.favorite.id);
                     }
                         ),
                     new ActionSheetItem("取消", type: ActionType.cancel)
                 }
                         )
                     );
             }
         }
     },
                shareCallback: this.share
                ));
 }
예제 #10
0
        public static void showReportView(
            bool isLoggedIn,
            string userName,
            ReportType reportType,
            VoidCallback pushToLogin,
            VoidCallback pushToReport,
            VoidCallback pushToBlock       = null,
            VoidCallback blockUserCallback = null
            )
        {
            var items = new List <ActionSheetItem> {
                new ActionSheetItem(
                    $"屏蔽该用户 {userName}",
                    type: ActionType.destructive,
                    () => blockUser(
                        isLoggedIn: isLoggedIn,
                        userName: userName,
                        pushToLogin: pushToLogin,
                        blockUserAction: blockUserCallback
                        )
                    ),
                new ActionSheetItem(
                    "举报",
                    type: ActionType.normal,
                    () => report(
                        isLoggedIn: isLoggedIn,
                        pushToLogin: pushToLogin,
                        pushToReport: pushToReport
                        )
                    ),
                new ActionSheetItem("取消", type: ActionType.cancel)
            };

            if (reportType == ReportType.article)
            {
                items.Insert(0,
                             new ActionSheetItem(
                                 "屏蔽",
                                 type: ActionType.normal,
                                 () => blockProject(
                                     isLoggedIn: isLoggedIn,
                                     pushToLogin: pushToLogin,
                                     pushToBlock: pushToBlock
                                     )
                                 )
                             );
            }

            ActionSheetUtils.showModalActionSheet(new ActionSheet(
                                                      items: items
                                                      ));
        }
예제 #11
0
        void _onFollow(Article article, UserType userType)
        {
            if (this.widget.viewModel.isLoggedIn)
            {
                if (userType == UserType.follow)
                {
                    ActionSheetUtils.showModalActionSheet(
                        new ActionSheet(
                            title: "确定不再关注?",
                            items: new List <ActionSheetItem> {
                        new ActionSheetItem("确定", type: ActionType.normal, () => {
                            if (article.ownerType == OwnerType.user.ToString())
                            {
                                this.widget.actionModel.startUnFollowUser(obj: article.userId);
                                this.widget.actionModel.unFollowUser(arg: article.userId);
                            }

                            if (article.ownerType == OwnerType.team.ToString())
                            {
                                this.widget.actionModel.startUnFollowTeam(obj: article.teamId);
                                this.widget.actionModel.unFollowTeam(arg: article.teamId);
                            }
                        }),
                        new ActionSheetItem("取消", type: ActionType.cancel)
                    }
                            )
                        );
                }

                if (userType == UserType.unFollow)
                {
                    if (article.ownerType == OwnerType.user.ToString())
                    {
                        this.widget.actionModel.startFollowUser(obj: article.userId);
                        this.widget.actionModel.followUser(arg: article.userId);
                    }

                    if (article.ownerType == OwnerType.team.ToString())
                    {
                        this.widget.actionModel.startFollowTeam(obj: article.teamId);
                        this.widget.actionModel.followTeam(arg: article.teamId);
                    }
                }
            }
            else
            {
                this.widget.actionModel.pushToLogin();
            }
        }
예제 #12
0
        List <Widget> _buildSecondaryActions(FavoriteTag favoriteTag)
        {
            if (!this.widget.viewModel.isLoggedIn)
            {
                return(new List <Widget>());
            }

            if (this.widget.viewModel.currentUserId != this.widget.viewModel.user.id)
            {
                return(new List <Widget>());
            }

            if (favoriteTag.type == "default")
            {
                return(new List <Widget>());
            }

            return(new List <Widget> {
                new DeleteActionButton(
                    80,
                    EdgeInsets.only(24, right: 12),
                    () => {
                    ActionSheetUtils.showModalActionSheet(
                        new ActionSheet(
                            title: "确定删除收藏夹及收藏夹中的内容?",
                            items: new List <ActionSheetItem> {
                        new ActionSheetItem(
                            "确定",
                            type: ActionType.normal,
                            () => this.widget.actionModel.deleteFavoriteTag(arg: favoriteTag.id)
                            ),
                        new ActionSheetItem("取消", type: ActionType.cancel)
                    }
                            )
                        );
                }
                    ),
                new EditActionButton(
                    80,
                    EdgeInsets.only(12, right: 24),
                    () => this.widget.actionModel.pushToCreateFavorite(obj: favoriteTag.id)
                    )
            });
        }
예제 #13
0
 public static void showArticleShareView(
     bool showReportAndBlock,
     bool isLoggedIn,
     VoidCallback pushToCopy,
     VoidCallback pushToLogin,
     VoidCallback pushToBlock,
     VoidCallback pushToReport,
     OnShareType shareToWechat,
     VoidCallback mainRouterPop = null
     )
 {
     ActionSheetUtils.showModalActionSheet(new ShareView(
                                               projectType: ProjectType.article,
                                               showReportAndBlock: showReportAndBlock,
                                               onPressed: type => {
         if (type == ShareType.clipBoard)
         {
             pushToCopy?.Invoke();
         }
         else if (type == ShareType.block)
         {
             ReportManager.blockProject(
                 isLoggedIn: isLoggedIn,
                 pushToLogin: pushToLogin,
                 pushToBlock: pushToBlock,
                 mainRouterPop: mainRouterPop
                 );
         }
         else if (type == ShareType.report)
         {
             ReportManager.report(
                 isLoggedIn: isLoggedIn,
                 pushToLogin: pushToLogin,
                 pushToReport: pushToReport
                 );
         }
         else
         {
             shareToWechat?.Invoke(type: type);
         }
     }
                                               ));
 }
예제 #14
0
 Widget _buildShareWidget(RankData game)
 {
     return(new CustomButton(
                onPressed: () => ActionSheetUtils.showModalActionSheet(
                    new ShareView(
                        projectType: ProjectType.iEvent,
                        onPressed: type => {
         // AnalyticsManager.ClickShare(type, "Event", "Event_" + eventObj.id, eventObj.title);
         var linkUrl = CStringUtils.JointTinyGameShareLink(gameId: game.id);;
         if (type == ShareType.clipBoard)
         {
             this.widget.actionModel.copyText(obj: linkUrl);
             CustomDialogUtils.showToast("复制链接成功", iconData: Icons.check_circle_outline);
         }
         else
         {
             var imageUrl = CImageUtils.SizeTo200ImageUrl(imageUrl: game.image);
             CustomDialogUtils.showCustomDialog(
                 child: new CustomLoadingDialog()
                 );
             this.widget.actionModel.shareToWechat(
                 arg1: type,
                 arg2: game.resetTitle,
                 arg3: game.resetSubLabel,
                 arg4: linkUrl,
                 arg5: imageUrl
                 , null)
             .Then(onResolved: CustomDialogUtils.hiddenCustomDialog)
             .Catch(_ => CustomDialogUtils.hiddenCustomDialog());
         }
     }
                        )
                    ),
                child: new Container(
                    color: CColors.Transparent,
                    child: new Icon(
                        icon: Icons.outline_share,
                        size: 24,
                        color: CColors.Icon
                        )
                    )
                ));
 }
예제 #15
0
 void _share(Article article)
 {
     ActionSheetUtils.showModalActionSheet(new ShareView(
                                               projectType: ProjectType.article,
                                               onPressed: type => {
         var linkUrl = CStringUtils.JointProjectShareLink(projectId: article.id);
         if (type == ShareType.clipBoard)
         {
             Clipboard.setData(new ClipboardData(text: linkUrl));
             CustomDialogUtils.showToast("复制链接成功", iconData: Icons.check_circle_outline);
         }
         else if (type == ShareType.block)
         {
             ReportManager.block(
                 isLoggedIn: this.widget.viewModel.isLoggedIn,
                 () => this.widget.actionModel.pushToLogin(),
                 () => this.widget.actionModel.pushToBlock(article.id),
                 () => this.widget.actionModel.mainRouterPop()
                 );
         }
         else if (type == ShareType.report)
         {
             ReportManager.report(
                 isLoggedIn: this.widget.viewModel.isLoggedIn,
                 () => this.widget.actionModel.pushToLogin(),
                 () => this.widget.actionModel.pushToReport(arg1: article.id, arg2: ReportType.article)
                 );
         }
         else
         {
             CustomDialogUtils.showCustomDialog(
                 child: new CustomLoadingDialog()
                 );
             string imageUrl = CImageUtils.SizeTo200ImageUrl(article.thumbnail.url);
             this.widget.actionModel.shareToWechat(type, article.title, article.subTitle,
                                                   linkUrl,
                                                   imageUrl).Then(CustomDialogUtils.hiddenCustomDialog)
             .Catch(_ => CustomDialogUtils.hiddenCustomDialog());
         }
     }
                                               ));
 }
예제 #16
0
        void _onPressed()
        {
            if (!UserInfoManager.isLogin())
            {
                this.widget.actionModel.pushToLogin();
                return;
            }

            if (this.widget.viewModel.isCollect)
            {
                ActionSheetUtils.showModalActionSheet(
                    new ActionSheet(
                        title: "确定取消收藏?",
                        items: new List <ActionSheetItem> {
                    new ActionSheetItem("确定", type: ActionType.normal,
                                        () => {
                        var tagId = this.widget.viewModel.favoriteTag.id;
                        if (this.widget.viewModel.collectChangeMap.isNotEmpty() &&
                            this.widget.viewModel.collectChangeMap.ContainsKey(tagId))
                        {
                            tagId = this.widget.viewModel.collectChangeMap[tagId];
                        }

                        this.widget.actionModel.cancelCollectFavoriteTag(
                            tagId,
                            this.widget.viewModel.favoriteTag.quoteTagId ?? "");
                    }),
                    new ActionSheetItem("取消", type: ActionType.cancel)
                }
                        )
                    );
            }
            else
            {
                this.widget.actionModel.collectFavoriteTag(
                    this.widget.viewModel.favoriteTag.quoteTagId.isEmpty()
                        ? this.widget.viewModel.favoriteTag.id
                        : this.widget.viewModel.favoriteTag.quoteTagId, this.widget.viewModel.favoriteTag.id);
            }
        }
예제 #17
0
 void _onComment(Article article)
 {
     if (!this.widget.viewModel.isLoggedIn)
     {
         this.widget.actionModel.pushToLogin();
     }
     else
     {
         ActionSheetUtils.showModalActionSheet(new CustomInput(
                                                   doneCallBack: text => {
             ActionSheetUtils.hiddenModalPopup();
             this.widget.actionModel.sendComment(
                 arg1: article.id,
                 arg2: article.channelId,
                 arg3: text,
                 Snowflake.CreateNonce(),
                 ""
                 );
         })
                                               );
     }
 }
예제 #18
0
 void _deleteAllHistory()
 {
     ActionSheetUtils.showModalActionSheet(new ActionSheet(
                                               title: "确定删除浏览历史?",
                                               items: new List <ActionSheetItem> {
         new ActionSheetItem(
             "删除",
             ActionType.destructive,
             () => {
             if (this._selectedIndex == 0)
             {
                 this.widget.actionModel.deleteAllArticleHistory();
             }
             else
             {
                 this.widget.actionModel.deleteAllEventHistory();
             }
         }),
         new ActionSheetItem("取消", ActionType.cancel)
     }
                                               ));
 }
예제 #19
0
        public static void showBlockUserView(
            bool isLoggedIn,
            bool hasBeenBlocked,
            VoidCallback pushToLogin,
            VoidCallback blockUserCallback       = null,
            VoidCallback cancelBlockUserCallback = null
            )
        {
            var items = new List <ActionSheetItem> {
                new ActionSheetItem(
                    hasBeenBlocked ? "取消屏蔽该用户" : "屏蔽该用户",
                    type: ActionType.destructive,
                    () => {
                    if (hasBeenBlocked)
                    {
                        cancelBlockUser(
                            isLoggedIn: isLoggedIn,
                            pushToLogin: pushToLogin,
                            cancelBlockUserAction: cancelBlockUserCallback
                            );
                    }
                    else
                    {
                        blockUser(
                            isLoggedIn: isLoggedIn,
                            pushToLogin: pushToLogin,
                            blockUserAction: blockUserCallback
                            );
                    }
                }
                    ),
                new ActionSheetItem("取消", type: ActionType.cancel)
            };

            ActionSheetUtils.showModalActionSheet(new ActionSheet(
                                                      items: items
                                                      ));
        }
예제 #20
0
        List <Widget> _buildSecondaryActions(Article article)
        {
            if (!this.widget.viewModel.isLoggedIn)
            {
                return(new List <Widget>());
            }

            if (!this.widget.viewModel.userId.Equals(value: this.widget.viewModel.currentUserId))
            {
                return(new List <Widget>());
            }

            return(new List <Widget> {
                new DeleteActionButton(
                    80,
                    onTap: () => {
                    ActionSheetUtils.showModalActionSheet(
                        new ActionSheet(
                            title: "确定不再收藏?",
                            items: new List <ActionSheetItem> {
                        new ActionSheetItem(
                            "确定",
                            type: ActionType.normal,
                            () => {
                            var currentFavorite = article.favorites.Find(
                                favorite => favorite.tagId == this.widget.viewModel.tagId);
                            this.widget.actionModel.unFavoriteArticle(arg1: article.id,
                                                                      arg2: currentFavorite.id);
                        }
                            ),
                        new ActionSheetItem("取消", type: ActionType.cancel)
                    }
                            )
                        );
                }
                    )
            });
        }
예제 #21
0
        public static void showReportView(
            bool isLoggedIn,
            ReportType reportType,
            VoidCallback pushToLogin,
            VoidCallback pushToReport,
            VoidCallback pushToBlock = null
            )
        {
            var items = new List <ActionSheetItem> {
                new ActionSheetItem(
                    "举报",
                    type: ActionType.normal,
                    () => report(
                        isLoggedIn: isLoggedIn,
                        pushToLogin: pushToLogin,
                        pushToReport: pushToReport
                        )
                    ),
                new ActionSheetItem("取消", type: ActionType.cancel)
            };

            if (reportType == ReportType.article)
            {
                items.Insert(0, new ActionSheetItem(
                                 "屏蔽",
                                 type: ActionType.normal,
                                 () => block(
                                     isLoggedIn: isLoggedIn,
                                     pushToLogin: pushToLogin, pushToBlock: pushToBlock
                                     )
                                 ));
            }

            ActionSheetUtils.showModalActionSheet(new ActionSheet(
                                                      items: items
                                                      ));
        }
예제 #22
0
        List <Widget> _buildComments()
        {
            if (this._channelComments.Count == 0)
            {
                return(new List <Widget>());
            }

            var comments = new List <Widget> {
                new Container(
                    color: CColors.White,
                    padding: EdgeInsets.only(16, 16, 16),
                    child: new Text(
                        "评论",
                        style: CTextStyle.H5,
                        textAlign: TextAlign.left
                        )
                    )
            };

            var messageDict = this.widget.viewModel.channelMessageDict[this._channelId];

            foreach (var commentId in this._channelComments)
            {
                if (!messageDict.ContainsKey(commentId))
                {
                    break;
                }

                var  message    = messageDict[commentId];
                bool isPraised  = _isPraised(message, this.widget.viewModel.loginUserId);
                var  parentName = "";
                if (message.parentMessageId.isNotEmpty())
                {
                    if (messageDict.ContainsKey(message.parentMessageId))
                    {
                        var parentMessage = messageDict[message.parentMessageId];
                        parentName = parentMessage.author.fullName;
                    }
                }

                var card = new CommentCard(
                    message,
                    isPraised,
                    parentName,
                    () => ReportManager.showReportView(this.widget.viewModel.isLoggedIn,
                                                       commentId,
                                                       ReportType.comment, this.widget.actionModel.pushToLogin, this.widget.actionModel.pushToReport
                                                       ),
                    replyCallBack: () => {
                    if (!this.widget.viewModel.isLoggedIn)
                    {
                        this.widget.actionModel.pushToLogin();
                    }
                    else
                    {
                        AnalyticsManager.ClickComment("Article_Comment", this._article.channelId,
                                                      this._article.title, commentId);
                        ActionSheetUtils.showModalActionSheet(new CustomInput(
                                                                  message.author.fullName.isEmpty() ? "" : message.author.fullName,
                                                                  text => {
                            ActionSheetUtils.hiddenModalPopup();
                            this.widget.actionModel.sendComment(this._channelId,
                                                                text,
                                                                Snowflake.CreateNonce(),
                                                                commentId
                                                                );
                        })
                                                              );
                    }
                },
                    praiseCallBack: () => {
                    if (!this.widget.viewModel.isLoggedIn)
                    {
                        this.widget.actionModel.pushToLogin();
                    }
                    else
                    {
                        if (isPraised)
                        {
                            this.widget.actionModel.removeLikeComment(message);
                        }
                        else
                        {
                            this.widget.actionModel.likeComment(message);
                        }
                    }
                });
                comments.Add(card);
            }

            return(comments);
        }
예제 #23
0
        Widget _buildFollowButton(bool isTop = false)
        {
            if (this.widget.viewModel.isLoggedIn &&
                this.widget.viewModel.currentUserId == this.widget.viewModel.team.id)
            {
                return(new Container());
            }

            bool               isFollow      = false;
            string             followText    = "关注";
            Color              followBgColor = CColors.PrimaryBlue;
            GestureTapCallback onTap         = () => {
                this.widget.actionModel.startFollowTeam();
                this.widget.actionModel.followTeam(arg: this.widget.viewModel.team.id);
            };

            if (this.widget.viewModel.isLoggedIn &&
                this.widget.viewModel.followMap.ContainsKey(key: this.widget.viewModel.team.id))
            {
                isFollow      = true;
                followText    = "已关注";
                followBgColor = CColors.Transparent;
                onTap         = () => {
                    ActionSheetUtils.showModalActionSheet(
                        new ActionSheet(
                            title: "确定不再关注?",
                            items: new List <ActionSheetItem> {
                        new ActionSheetItem("确定", type: ActionType.normal, () => {
                            this.widget.actionModel.startUnFollowTeam();
                            this.widget.actionModel.unFollowTeam(arg: this.widget.viewModel.team.id);
                        }),
                        new ActionSheetItem("取消", type: ActionType.cancel)
                    }
                            )
                        );
                };
            }

            Widget buttonChild;
            bool   isEnable;

            if (this.widget.viewModel.team.followTeamLoading ?? false)
            {
                buttonChild = new CustomActivityIndicator(
                    loadingColor: isTop ? LoadingColor.black : LoadingColor.white,
                    size: LoadingSize.small
                    );
                isEnable = false;
            }
            else
            {
                buttonChild = new Text(
                    data: followText,
                    style: isTop
                        ? new TextStyle(
                        fontSize: 14,
                        fontFamily: "Roboto-Medium",
                        color: isFollow ? new Color(0xFF959595) : CColors.PrimaryBlue
                        )
                        : CTextStyle.PMediumWhite
                    );
                isEnable = true;
            }

            if (isTop)
            {
                return(new CustomButton(
                           padding: EdgeInsets.zero,
                           child: new Container(
                               width: 60,
                               height: 28,
                               alignment: Alignment.center,
                               decoration: new BoxDecoration(
                                   color: CColors.Transparent,
                                   borderRadius: BorderRadius.circular(14),
                                   border: isFollow
                                ? Border.all(color: CColors.Disable2)
                                : Border.all(color: CColors.PrimaryBlue)
                                   ),
                               child: buttonChild
                               ),
                           onPressed: () => {
                    if (!isEnable)
                    {
                        return;
                    }

                    if (this.widget.viewModel.isLoggedIn)
                    {
                        onTap();
                    }
                    else
                    {
                        this.widget.actionModel.pushToLogin();
                    }
                }
                           ));
            }

            return(new CustomButton(
                       padding: EdgeInsets.zero,
                       child: new Container(
                           width: 100,
                           height: 32,
                           alignment: Alignment.center,
                           decoration: new BoxDecoration(
                               color: followBgColor,
                               borderRadius: BorderRadius.all(4),
                               border: isFollow ? Border.all(CColors.White) : null
                               ),
                           child: buttonChild
                           ),
                       onPressed: () => {
                if (!isEnable)
                {
                    return;
                }

                if (this.widget.viewModel.isLoggedIn)
                {
                    onTap();
                }
                else
                {
                    this.widget.actionModel.pushToLogin();
                }
            }
                       ));
        }
예제 #24
0
        Widget _buildArticleCard(int index)
        {
            var articleId   = this.widget.viewModel.favoriteDetailArticleIds[index : index];
            var articleDict = this.widget.viewModel.articleDict;

            if (!articleDict.ContainsKey(key: articleId))
            {
                return(new Container());
            }

            var article  = articleDict[key : articleId];
            var linkUrl  = CStringUtils.JointProjectShareLink(projectId: article.id);
            var fullName = "";

            if (article.ownerType == OwnerType.user.ToString())
            {
                if (this.widget.viewModel.userDict.ContainsKey(key: article.userId))
                {
                    fullName = this.widget.viewModel.userDict[key : article.userId].fullName
                               ?? this.widget.viewModel.userDict[key : article.userId].name;
                }
            }

            if (article.ownerType == OwnerType.team.ToString())
            {
                if (this.widget.viewModel.teamDict.ContainsKey(key: article.teamId))
                {
                    fullName = this.widget.viewModel.teamDict[key : article.teamId].name;
                }
            }

            return(CustomDismissible.builder(
                       Key.key(value: article.id),
                       new ArticleCard(
                           article: article,
                           () => this.widget.actionModel.pushToArticleDetail(obj: article.id),
                           () => ShareManager.showArticleShareView(
                               false,
                               isLoggedIn: this.widget.viewModel.isLoggedIn,
                               () => {
                Clipboard.setData(new ClipboardData(text: linkUrl));
                CustomDialogUtils.showToast("复制链接成功", iconData: Icons.check_circle_outline);
            },
                               () => this.widget.actionModel.pushToLogin(),
                               () => this.widget.actionModel.pushToBlock(obj: article.id),
                               () => this.widget.actionModel.pushToReport(obj: article.id),
                               type => {
                CustomDialogUtils.showCustomDialog(
                    child: new CustomLoadingDialog()
                    );
                string imageUrl = CImageUtils.SizeTo200ImageUrl(imageUrl: article.thumbnail.url);
                this.widget.actionModel.shareToWechat(arg1: type, arg2: article.title,
                                                      arg3: article.subTitle, arg4: linkUrl, arg5: imageUrl)
                .Then(onResolved: CustomDialogUtils.hiddenCustomDialog)
                .Catch(_ => CustomDialogUtils.hiddenCustomDialog());
            }
                               ),
                           fullName: fullName,
                           key: new ObjectKey(value: article.id)
                           ),
                       new CustomDismissibleDrawerDelegate(),
                       secondaryActions: new List <Widget> {
                new DeleteActionButton(
                    80,
                    onTap: () => {
                    ActionSheetUtils.showModalActionSheet(
                        new ActionSheet(
                            title: "确定不再收藏?",
                            items: new List <ActionSheetItem> {
                        new ActionSheetItem(
                            "确定",
                            type: ActionType.normal,
                            () => {
                            this.widget.actionModel.unFavoriteArticle(arg1: article.id,
                                                                      arg2: article.favorite.id);
                        }
                            ),
                        new ActionSheetItem("取消", type: ActionType.cancel)
                    }
                            )
                        );
                }
                    )
            },
                       controller: this._dismissibleController
                       ));
        }
        Widget _buildHeadTop(IEvent eventObj, BuildContext context)
        {
            Widget shareWidget = new CustomButton(
                onPressed: () => ActionSheetUtils.showModalActionSheet(new ShareView(
                                                                           projectType: ProjectType.iEvent,
                                                                           onPressed: type => {
                AnalyticsManager.ClickShare(type, "Event", "Event_" + eventObj.id, eventObj.title);

                var linkUrl = CStringUtils.JointEventShareLink(eventId: eventObj.id);
                if (type == ShareType.clipBoard)
                {
                    this.widget.actionModel.copyText(linkUrl);
                    CustomDialogUtils.showToast("复制链接成功", Icons.check_circle_outline);
                }
                else
                {
                    var imageUrl = CImageUtils.SizeTo200ImageUrl(eventObj.avatar);
                    CustomDialogUtils.showCustomDialog(
                        child: new CustomLoadingDialog()
                        );
                    this.widget.actionModel.shareToWechat(type, eventObj.title, eventObj.shortDescription,
                                                          linkUrl,
                                                          imageUrl, null).Then(CustomDialogUtils.hiddenCustomDialog)
                    .Catch(_ => CustomDialogUtils.hiddenCustomDialog());
                }
            })),
                child: new Container(
                    color: CColors.Transparent,
                    child: new Icon(Icons.share, size: 24,
                                    color: this._showNavBarShadow ? CColors.White : CColors.Icon))
                );

            Widget titleWidget = new Container();

            if (this._isHaveTitle)
            {
                titleWidget = new Text(
                    eventObj.title,
                    style: CTextStyle.PXLargeMedium,
                    maxLines: 1,
                    overflow: TextOverflow.ellipsis,
                    textAlign: TextAlign.center
                    );
            }

            return(new AnimatedContainer(
                       height: 44 + CCommonUtils.getSafeAreaTopPadding(context: context),
                       duration: TimeSpan.Zero,
                       padding: EdgeInsets.only(8, right: 8, top: CCommonUtils.getSafeAreaTopPadding(context: context)),
                       decoration: new BoxDecoration(
                           CColors.White,
                           border: new Border(
                               bottom: new BorderSide(this._isHaveTitle ? CColors.Separator2 : CColors.Transparent)),
                           gradient: this._showNavBarShadow
                        ? new LinearGradient(
                               colors: new List <Color> {
                new Color(0x80000000),
                new Color(0x0)
            },
                               begin: Alignment.topCenter,
                               end: Alignment.bottomCenter
                               )
                        : null
                           ),
                       child: new Row(
                           mainAxisAlignment: MainAxisAlignment.spaceBetween,
                           children: new List <Widget> {
                new CustomButton(
                    onPressed: () => this.widget.actionModel.mainRouterPop(),
                    child: new Icon(
                        Icons.arrow_back,
                        size: 24,
                        color: this._showNavBarShadow ? CColors.White : CColors.Icon
                        )
                    ),
                new Expanded(
                    child: new Stack(
                        fit: StackFit.expand,
                        children: new List <Widget> {
                    new PositionedTransition(
                        rect: this._animation,
                        child: titleWidget
                        )
                }
                        )
                    ),
                shareWidget
            }
                           )
                       ));
        }
예제 #26
0
        IEnumerable <Widget> _buildComments(BuildContext context)
        {
            List <string> channelComments = new List <string>();

            if (this.widget.viewModel.channelMessageList.ContainsKey(this._article.channelId))
            {
                channelComments = this.widget.viewModel.channelMessageList[this._article.channelId];
            }
            var mediaQuery = MediaQuery.of(context);
            var comments   = new List <Widget> {
                new Container(
                    color: CColors.White,
                    width: mediaQuery.size.width,
                    padding: EdgeInsets.only(16, 16, 16),
                    child: new Text(
                        "评论",
                        style: CTextStyle.H5,
                        textAlign: TextAlign.left
                        )
                    )
            };

            var titleHeight = CTextUtils.CalculateTextHeight(
                "评论",
                CTextStyle.H5,
                mediaQuery.size.width - 16 * 2, // 16 is horizontal padding
                null
                ) + 16;                         // 16 is top padding

            var height = mediaQuery.size.height - navBarHeight - 44 - mediaQuery.padding.vertical;

            if (channelComments.Count == 0)
            {
                var blankView = new Container(
                    height: height - titleHeight,
                    child: new BlankView(
                        "快来写下第一条评论吧",
                        "image/default-comment"
                        )
                    );
                comments.Add(item: blankView);
                return(comments);
            }

            var   messageDict    = this.widget.viewModel.channelMessageDict[this._article.channelId];
            float contentHeights = 0;

            foreach (var commentId in channelComments)
            {
                if (!messageDict.ContainsKey(commentId))
                {
                    break;
                }

                var  message    = messageDict[commentId];
                bool isPraised  = _isPraised(message, this.widget.viewModel.loginUserId);
                var  parentName = "";
                if (message.parentMessageId.isNotEmpty())
                {
                    if (messageDict.ContainsKey(message.parentMessageId))
                    {
                        var parentMessage = messageDict[message.parentMessageId];
                        parentName = parentMessage.author.fullName;
                    }
                }

                var content = MessageUtils.AnalyzeMessage(message.content, message.mentions,
                                                          message.mentionEveryone) + (parentName.isEmpty() ? "" : $"回复@{parentName}");
                var contentHeight = CTextUtils.CalculateTextHeight(
                    content,
                    CTextStyle.PLargeBody,
                    // 16 is horizontal padding, 24 is avatar size, 8 is content left margin to avatar
                    mediaQuery.size.width - 16 * 2 - 24 - 8,
                    null
                    ) + 16 + 24 + 3 + 5 + 22 + 12;
                // 16 is top padding, 24 is avatar size, 3 is content top margin to avatar, 5 is content bottom margin to commentTime
                // 22 is commentTime height, 12 is commentTime bottom margin
                contentHeights += contentHeight;
                var card = new CommentCard(
                    message,
                    isPraised,
                    parentName,
                    () => ReportManager.showReportView(this.widget.viewModel.isLoggedIn,
                                                       commentId,
                                                       ReportType.comment, this.widget.actionModel.pushToLogin, this.widget.actionModel.pushToReport
                                                       ),
                    replyCallBack: () => {
                    if (!this.widget.viewModel.isLoggedIn)
                    {
                        this.widget.actionModel.pushToLogin();
                    }
                    else
                    {
                        AnalyticsManager.ClickComment("Article_Comment", this._article.channelId,
                                                      this._article.title, commentId);
                        ActionSheetUtils.showModalActionSheet(new CustomInput(
                                                                  message.author.fullName.isEmpty() ? "" : message.author.fullName,
                                                                  text => {
                            ActionSheetUtils.hiddenModalPopup();
                            this.widget.actionModel.sendComment(this._article.channelId,
                                                                text,
                                                                Snowflake.CreateNonce(),
                                                                commentId
                                                                );
                        })
                                                              );
                    }
                },
                    praiseCallBack: () => {
                    if (!this.widget.viewModel.isLoggedIn)
                    {
                        this.widget.actionModel.pushToLogin();
                    }
                    else
                    {
                        if (isPraised)
                        {
                            this.widget.actionModel.removeLikeComment(message);
                        }
                        else
                        {
                            this.widget.actionModel.likeComment(message);
                        }
                    }
                });
                comments.Add(card);
            }

            float endHeight = 0;

            if (!this._article.hasMore)
            {
                comments.Add(new Container(
                                 height: 52,
                                 alignment: Alignment.center,
                                 child: new Text(
                                     "一 已经全部加载完毕 一",
                                     style: CTextStyle.PRegularBody4,
                                     textAlign: TextAlign.center
                                     )
                                 ));
                endHeight = 52;
            }
            if (titleHeight + contentHeights + endHeight < height)
            {
                return(new List <Widget> {
                    new Container(
                        height: height,
                        child: new Column(
                            crossAxisAlignment: CrossAxisAlignment.start,
                            children: comments
                            )
                        )
                });
            }
            return(comments);
        }
예제 #27
0
        public override Widget build(BuildContext context)
        {
            this.widget.viewModel.articleDict.TryGetValue(this.widget.viewModel.articleId, out this._article);
            if (this.widget.viewModel.articleDetailLoading && (this._article == null || !this._article.isNotFirst))
            {
                return(new Container(
                           color: CColors.White,
                           child: new CustomSafeArea(
                               child: new Column(
                                   children: new List <Widget> {
                    this._buildNavigationBar(false),
                    new ArticleDetailLoading()
                }
                                   )
                               )
                           ));
            }

            if (this._article == null || this._article.channelId == null)
            {
                return(new Container());
            }

            if (this._article.ownerType == "user")
            {
                if (this._article.userId != null &&
                    this.widget.viewModel.userDict.TryGetValue(this._article.userId, out this._user))
                {
                    this._user = this.widget.viewModel.userDict[this._article.userId];
                }
            }

            if (this._article.ownerType == "team")
            {
                if (this._article.teamId != null &&
                    this.widget.viewModel.teamDict.TryGetValue(this._article.teamId, out this._team))
                {
                    this._team = this.widget.viewModel.teamDict[this._article.teamId];
                }
            }

            if (this._titleHeight == 0f && this._article.title.isNotEmpty())
            {
                this._titleHeight = CTextUtils.CalculateTextHeight(
                    text: this._article.title,
                    textStyle: CTextStyle.H3,
                    MediaQuery.of(context).size.width - 16 * 2, // 16 is horizontal padding
                    null
                    ) + 16;                                     // 16 is top padding
                this.setState(() => { });
            }

            var commentIndex = 0;
            var originItems  = this._article == null ? new List <Widget>() : this._buildItems(context, out commentIndex);

            commentIndex    = this._jumpState == _ArticleJumpToCommentState.active ? commentIndex : 0;
            this._jumpState = _ArticleJumpToCommentState.Inactive;

            var child = new Container(
                color: CColors.Background,
                child: new Column(
                    children: new List <Widget> {
                this._buildNavigationBar(),
                new Expanded(
                    child: new CustomScrollbar(
                        new CenteredRefresher(
                            controller: this._refreshController,
                            enablePullDown: false,
                            enablePullUp: this._article.hasMore,
                            onRefresh: this._onRefresh,
                            onNotification: this._onNotification,
                            children: originItems,
                            centerIndex: commentIndex
                            )
                        )
                    ),
                new ArticleTabBar(this._article.like,
                                  () => {
                    if (!this.widget.viewModel.isLoggedIn)
                    {
                        this.widget.actionModel.pushToLogin();
                    }
                    else
                    {
                        AnalyticsManager.ClickComment("Article", this._article.channelId,
                                                      this._article.title);
                        ActionSheetUtils.showModalActionSheet(new CustomInput(
                                                                  doneCallBack: text => {
                            ActionSheetUtils.hiddenModalPopup();
                            this.widget.actionModel.sendComment(this._article.channelId,
                                                                text,
                                                                Snowflake.CreateNonce(),
                                                                null
                                                                );
                        })
                                                              );
                    }
                },
                                  () => {
                    if (!this.widget.viewModel.isLoggedIn)
                    {
                        this.widget.actionModel.pushToLogin();
                    }
                    else
                    {
                        AnalyticsManager.ClickComment("Article", this._article.channelId,
                                                      this._article.title);
                        ActionSheetUtils.showModalActionSheet(new CustomInput(
                                                                  doneCallBack: text => {
                            ActionSheetUtils.hiddenModalPopup();
                            this.widget.actionModel.sendComment(this._article.channelId,
                                                                text,
                                                                Snowflake.CreateNonce(),
                                                                null
                                                                );
                        })
                                                              );
                    }
                },
                                  () => {
                    if (!this.widget.viewModel.isLoggedIn)
                    {
                        this.widget.actionModel.pushToLogin();
                    }
                    else
                    {
                        if (!this._article.like)
                        {
                            this.widget.actionModel.likeArticle(this._article.id);
                        }
                    }
                },
                                  shareCallback: this.share
                                  )
            }
                    )
                );

            return(new Container(
                       color: CColors.White,
                       child: new CustomSafeArea(
                           child: child
                           )
                       ));
        }
예제 #28
0
        Widget _buildSearchHistory(List <string> searchHistoryList)
        {
            if (searchHistoryList == null || searchHistoryList.Count <= 0)
            {
                return(new Container());
            }

            var widgets = new List <Widget>();

            widgets.Add(
                new Container(
                    margin: EdgeInsets.only(top: 24, bottom: 10),
                    child: new Row(
                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
                        children: new List <Widget> {
                new Text(
                    "搜索历史",
                    style: CTextStyle.PXLargeBody4
                    ),
                new CustomButton(
                    padding: EdgeInsets.only(8, 8, 0, 8),
                    onPressed: () => {
                    ActionSheetUtils.showModalActionSheet(
                        new ActionSheet(
                            title: "确定清除搜索历史记录?",
                            items: new List <ActionSheetItem> {
                        new ActionSheetItem("确定", ActionType.destructive,
                                            () => this.widget.actionModel.deleteAllSearchHistory()),
                        new ActionSheetItem("取消", ActionType.cancel)
                    }
                            )
                        );
                },
                    child: new Text(
                        "清空",
                        style: CTextStyle.PRegularBody4
                        )
                    )
            }
                        )
                    )
                );
            searchHistoryList.ForEach(item => {
                var child = new GestureDetector(
                    onTap: () => { this._searchArticle(item); },
                    child: new Container(
                        height: 44,
                        color: CColors.White,
                        child: new Row(
                            mainAxisAlignment: MainAxisAlignment.spaceBetween,
                            children: new List <Widget> {
                    new Text(
                        item,
                        style: CTextStyle.PLargeBody
                        ),
                    new CustomButton(
                        padding: EdgeInsets.only(8, 8, 0, 8),
                        onPressed: () => this.widget.actionModel.deleteSearchHistory(item),
                        child: new Icon(
                            Icons.close,
                            size: 16,
                            color: Color.fromRGBO(199, 203, 207, 1)
                            )
                        )
                }
                            )
                        )
                    );
                widgets.Add(child);
            });

            return(new Container(
                       padding: EdgeInsets.symmetric(horizontal: 16),
                       color: CColors.White,
                       child: new Column(
                           crossAxisAlignment: CrossAxisAlignment.start,
                           children: widgets
                           )
                       ));
        }
예제 #29
0
        List <Widget> _buildComments()
        {
            if (this._channelComments.isEmpty())
            {
                return(new List <Widget>());
            }

            var comments = new List <Widget>();

            if (!this.widget.viewModel.channelMessageDict.ContainsKey(this._channelId))
            {
                return(comments);
            }

            var messageDict = this.widget.viewModel.channelMessageDict[this._channelId];

            foreach (var commentId in this._channelComments)
            {
                if (!messageDict.ContainsKey(commentId))
                {
                    break;
                }

                var  message    = messageDict[commentId];
                bool isPraised  = _isPraised(message, this.widget.viewModel.loginUserId);
                var  parentName = "";
                if (message.parentMessageId.isNotEmpty())
                {
                    if (messageDict.ContainsKey(message.parentMessageId))
                    {
                        var parentMessage = messageDict[message.parentMessageId];
                        parentName = parentMessage.author.fullName;
                    }
                }

                var card = new CommentCard(
                    message,
                    isPraised,
                    parentName,
                    () => ReportManager.showReportView(this.widget.viewModel.isLoggedIn,
                                                       commentId,
                                                       ReportType.comment, this.widget.actionModel.pushToLogin, this.widget.actionModel.pushToReport
                                                       ),
                    replyCallBack: () => {
                    if (!this.widget.viewModel.isLoggedIn)
                    {
                        this.widget.actionModel.pushToLogin();
                    }
                    else
                    {
                        ActionSheetUtils.showModalActionSheet(new CustomInput(
                                                                  message.author.fullName.isEmpty() ? "" : message.author.fullName,
                                                                  text => {
                            ActionSheetUtils.hiddenModalPopup();
                            this.widget.actionModel.sendComment(this._channelId,
                                                                text,
                                                                Snowflake.CreateNonce(),
                                                                commentId
                                                                );
                        })
                                                              );
                    }
                },
                    praiseCallBack: () => {
                    if (!this.widget.viewModel.isLoggedIn)
                    {
                        this.widget.actionModel.pushToLogin();
                    }
                    else
                    {
                        if (isPraised)
                        {
                            this.widget.actionModel.removeLikeComment(commentId);
                        }
                        else
                        {
                            this.widget.actionModel.likeComment(commentId);
                        }
                    }
                });
                comments.Add(card);
            }

            return(comments);
        }
예제 #30
0
        public override Widget build(BuildContext context)
        {
            this.widget.viewModel.articleDict.TryGetValue(this.widget.viewModel.articleId, out this._article);
            if (this.widget.viewModel.articleDetailLoading && (this._article == null || !this._article.isNotFirst))
            {
                return(new Container(
                           color: CColors.White,
                           child: new CustomSafeArea(
                               child: new Column(
                                   children: new List <Widget> {
                    this._buildNavigationBar(),
                    new ArticleDetailLoading()
                }
                                   )
                               )
                           ));
            }

            if (this._article == null || this._article.channelId == null)
            {
                return(new Container());
            }

            if (this._article.ownerType == "user")
            {
                if (this._article.userId != null &&
                    this.widget.viewModel.userDict.TryGetValue(this._article.userId, out this._user))
                {
                    this._user = this.widget.viewModel.userDict[this._article.userId];
                }
            }

            if (this._article.ownerType == "team")
            {
                if (this._article.teamId != null &&
                    this.widget.viewModel.teamDict.TryGetValue(this._article.teamId, out this._team))
                {
                    this._team = this.widget.viewModel.teamDict[this._article.teamId];
                }
            }

            this._channelId   = this._article.channelId;
            this._relArticles = this._article.projects.FindAll(item => item.type == "article");
            if (this.widget.viewModel.channelMessageList.ContainsKey(this._article.channelId))
            {
                this._channelComments = this.widget.viewModel.channelMessageList[this._article.channelId];
            }

            this._contentMap    = this._article.contentMap;
            this._lastCommentId = this._article.currOldestMessageId ?? "";
            this._hasMore       = this._article.hasMore;

            var originItems = this._article == null ? new List <Widget>() : this._buildItems(context);

            var child = new Container(
                color: CColors.background3,
                child: new Column(
                    children: new List <Widget> {
                this._buildNavigationBar(),
                new Expanded(
                    child: new SmartRefresher(
                        controller: this._refreshController,
                        enablePullDown: false,
                        enablePullUp: this._hasMore,
                        onRefresh: this._onRefresh,
                        child: ListView.builder(
                            physics: new AlwaysScrollableScrollPhysics(),
                            itemCount: originItems.Count,
                            itemBuilder: (cxt, index) => originItems[index]
                            )
                        )
                    ),
                new ArticleTabBar(this._article.like,
                                  () => {
                    if (!this.widget.viewModel.isLoggedIn)
                    {
                        this.widget.actionModel.pushToLogin();
                    }
                    else
                    {
                        ActionSheetUtils.showModalActionSheet(new CustomInput(
                                                                  doneCallBack: text => {
                            ActionSheetUtils.hiddenModalPopup();
                            this.widget.actionModel.sendComment(this._article.channelId,
                                                                text,
                                                                Snowflake.CreateNonce(),
                                                                null
                                                                );
                        })
                                                              );
                    }
                },
                                  () => {
                    if (!this.widget.viewModel.isLoggedIn)
                    {
                        this.widget.actionModel.pushToLogin();
                    }
                    else
                    {
                        ActionSheetUtils.showModalActionSheet(new CustomInput(
                                                                  doneCallBack: text => {
                            ActionSheetUtils.hiddenModalPopup();
                            this.widget.actionModel.sendComment(this._article.channelId,
                                                                text,
                                                                Snowflake.CreateNonce(),
                                                                null
                                                                );
                        })
                                                              );
                    }
                },
                                  () => {
                    if (!this.widget.viewModel.isLoggedIn)
                    {
                        this.widget.actionModel.pushToLogin();
                    }
                    else
                    {
                        if (!this._article.like)
                        {
                            this.widget.actionModel.likeArticle(this._article.id);
                        }
                    }
                },
                                  shareCallback: this.share
                                  )
            }
                    )
                );

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