예제 #1
0
        public override Widget build(BuildContext context) {
            if (this.message == null) {
                return new Container();
            }

            var replyCount = this.message.parentMessageId.isNotEmpty()
                ? (this.message.lowerMessageIds ?? new List<string>()).Count
                : (this.message.replyMessageIds ?? new List<string>()).Count;
            return new Container(
                color: CColors.White,
                padding: EdgeInsets.only(16, 16, 16),
                child: new Row(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: new List<Widget> {
                        new GestureDetector(
                            onTap: () => this.pushToUserDetail(obj: this.message.author.id),
                            child: new Container(
                                height: 24,
                                margin: EdgeInsets.only(right: 8),
                                child: Avatar.User(user: this.message.author, 24)
                            )
                        ),
                        new Expanded(
                            child: new Container(
                                child: new Column(
                                    crossAxisAlignment: CrossAxisAlignment.start,
                                    children: new List<Widget> {
                                        this._buildCommentAvatarName(),
                                        this._buildCommentContent(),
                                        new Row(
                                            mainAxisAlignment: MainAxisAlignment.spaceBetween,
                                            children: new List<Widget> {
                                                new Text(
                                                    $"{DateConvert.DateStringFromNonce(nonce: this.message.nonce)}",
                                                    style: CTextStyle.PSmallBody4
                                                ),
                                                new Container(
                                                    child: new Row(
                                                        children: new List<Widget> {
                                                            new GestureDetector(
                                                                onTap: this.praiseCallBack,
                                                                child: new Container(
                                                                    color: CColors.White,
                                                                    child: new Text(
                                                                        $"点赞 {CStringUtils.CountToString(count: this.message.reactions.Count)}",
                                                                        style: this.isPraised
                                                                            ? CTextStyle.PRegularBlue
                                                                            : CTextStyle.PRegularBody4
                                                                    )
                                                                )
                                                            ),
                                                            new GestureDetector(
                                                                onTap: this.replyCallBack,
                                                                child: new Container(
                                                                    margin: EdgeInsets.only(15),
                                                                    child: new Text(
                                                                        $"回复 {CStringUtils.CountToString(count: replyCount)}",
                                                                        style: CTextStyle.PRegularBody4
                                                                    )
                                                                )
                                                            )
                                                        }
                                                    )
                                                )
                                            }
                                        ),
                                        new Container(
                                            margin: EdgeInsets.only(top: 12),
                                            height: 1,
                                            color: CColors.Separator2
                                        )
                                    }
                                )
                            )
                        )
                    }
                )
            );
        }
예제 #2
0
        public override Widget build(BuildContext context)
        {
            if (this.message == null)
            {
                return(new Container());
            }

            var content = MessageUtils.AnalyzeMessage(this.message.content, this.message.mentions,
                                                      this.message.mentionEveryone);
            Widget _content = this.parentName.isEmpty()
                ? new Container(
                child: new Text(
                    content,
                    style: CTextStyle.PLargeBody
                    ),
                alignment: Alignment.centerLeft
                )
                : new Container(alignment: Alignment.centerLeft, child: new RichText(text: new TextSpan(
                                                                                         "回复@",
                                                                                         children: new List <TextSpan> {
                new TextSpan(
                    $"{this.parentName}",
                    children: new List <TextSpan> {
                    new TextSpan(
                        $": {content}",
                        CTextStyle.PLargeBody
                        )
                },
                    style: CTextStyle.PLargeBlue)
            },
                                                                                         style: CTextStyle.PLargeBody4
                                                                                         )
                                                                                     )
                                );
            var reply = this.message.parentMessageId.isEmpty()
                ? new GestureDetector(
                onTap: this.replyCallBack,
                child: new Container(
                    margin: EdgeInsets.only(left: 10),
                    child: new Text(
                        $"回复 {this.message.replyMessageIds.Count}",
                        style: CTextStyle.PRegularBody4
                        ))
                )
                : new GestureDetector(
                child: new Container()
                );

            return(new Container(
                       color: CColors.White,
                       padding: EdgeInsets.only(16, 16, 16),
                       child: new Row(
                           crossAxisAlignment: CrossAxisAlignment.start,
                           children: new List <Widget> {
                new Container(
                    height: 24,
                    margin: EdgeInsets.only(right: 8),
                    child: Avatar.User(this.message.author.id, this.message.author, 24)
                    ),
                new Expanded(
                    child: new Container(
                        child: new Column(
                            children: new List <Widget> {
                    new Container(
                        height: 24,
                        child: new Row(
                            children: new List <Widget> {
                        new Expanded(
                            child: new Container(
                                alignment: Alignment.centerLeft,
                                child: new Text(this.message.author.fullName,
                                                style: CTextStyle.PMediumBody3))),

                        new CustomButton(
                            padding: EdgeInsets.only(8, 0, 0, 8),
                            onPressed: this.moreCallBack,
                            child: new Icon(Icons.ellipsis, size: 20,
                                            color: CColors.BrownGrey)
                            )
                    }
                            )
                        ),

                    new Container(
                        margin: EdgeInsets.only(top: 3, bottom: 5),
                        child: _content
                        ),

                    new Row(
                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
                        children: new List <Widget> {
                        new Text($"{DateConvert.DateStringFromNonce(this.message.nonce)}",
                                 style: CTextStyle.PSmallBody4),
                        new Container(
                            child: new Row(
                                children: new List <Widget> {
                            new GestureDetector(
                                onTap: this.praiseCallBack,
                                child: new Container(
                                    color: CColors.White,
                                    child: new Text(
                                        $"点赞 {this.message.reactions.Count}",
                                        style: this.isPraised
                                                                            ? CTextStyle.PRegularBlue
                                                                            : CTextStyle.PRegularBody4
                                        )
                                    )),
                            reply
                        }
                                )
                            )
                    }
                        ),
                    new Container(
                        margin: EdgeInsets.only(top: 12),
                        height: 1,
                        color: CColors.Separator2
                        )
                }
                            )
                        )
                    )
            }
                           )
                       ));
        }