示例#1
0
        public override Widget build(BuildContext context)
        {
            if (this.notification == null)
            {
                return(new Container());
            }

            var type  = this.notification.type;
            var types = new List <string> {
                "project_liked",
                "project_message_commented",
                "project_participate_comment",
                "project_message_liked",
                "project_message_participate_liked",
                "followed",
                "team_followed"
            };

            if (!types.Contains(item: type))
            {
                return(new Container());
            }

            return(new GestureDetector(
                       onTap: () => this.onTap(),
                       child: new Container(
                           color: CColors.White,
                           child: new Row(
                               crossAxisAlignment: CrossAxisAlignment.start,
                               children: new List <Widget> {
                new Container(
                    padding: EdgeInsets.only(16, 16, 16),
                    child: new GestureDetector(
                        onTap: () => this.pushToUserDetail(obj: this.user.id),
                        child: Avatar.User(user: this.user, 48)
                        )
                    ),
                new Expanded(
                    child: new Container(
                        padding: EdgeInsets.only(0, 16, 16, 16),
                        decoration: new BoxDecoration(
                            border: this.isLast
                                            ? null
                                            : new Border(bottom: new BorderSide(CColors.Separator2))
                            ),
                        child: new Column(
                            mainAxisAlignment: MainAxisAlignment.start,
                            crossAxisAlignment: CrossAxisAlignment.start,
                            children: new List <Widget> {
                    this._buildNotificationTitle(), this._buildNotificationTime()
                }
                            )
                        )
                    )
            }
                               )
                           )
                       ));
        }
        List <Widget> _buildAvatars(List <string> bloggerIds)
        {
            var list  = new List <Widget>();
            var items = new List <Widget>();

            bloggerIds.ForEach(bloggerId => {
                var index    = bloggerIds.IndexOf(bloggerId);
                var rankData = this.rankDict.ContainsKey(key: bloggerId)
                    ? this.rankDict[key: bloggerId]
                    : new RankData();
                if (this.userDict.ContainsKey(key: rankData.itemId))
                {
                    var user = this.userDict[key: rankData.itemId];
                    var left = 0;
                    if (index == 1)
                    {
                        left = 36;
                    }
                    else if (index == 2)
                    {
                        left = 72;
                    }
                    items.Add(new Positioned(
                                  Avatar.User(user: user, 44, true),
                                  left: left
                                  )
                              );
                }
            });
            items.Reverse();
            var width = 0;

            if (bloggerIds.Count == 1)
            {
                width = 44;
            }
            else if (bloggerIds.Count == 2)
            {
                width = 84;
            }
            else if (bloggerIds.Count == 3)
            {
                width = 124;
            }
            var avatar = new Container(
                height: 44,
                width: width,
                child: new Stack(children: items)
                );

            list.Add(avatar);
            list.Add(new Padding(
                         padding: EdgeInsets.only(top: 16),
                         child: new Text("查看更多", style: CTextStyle.PRegularBody2)
                         )
                     );

            return(list);
        }
示例#3
0
 static Widget _buildLecture(User host)
 {
     return(new Container(
                padding: EdgeInsets.symmetric(horizontal: 16),
                margin: EdgeInsets.only(bottom: 24),
                color: CColors.White,
                child: new Column(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: new List <Widget> {
         new Row(
             children: new List <Widget> {
             new Container(
                 margin: EdgeInsets.only(right: 8),
                 child: Avatar.User(host.id, host, 48)
                 ),
             new Column(
                 mainAxisAlignment: MainAxisAlignment.center,
                 crossAxisAlignment: CrossAxisAlignment.start,
                 children: new List <Widget> {
                 new Container(
                     child: new Text(
                         host.fullName,
                         style: new TextStyle(
                             color: CColors.TextBody,
                             fontFamily: "Roboto-Medium",
                             fontSize: 16
                             )
                         )
                     ),
                 host.title.isNotEmpty()
                                     ? new Container(
                     child: new Text(
                         host.title,
                         maxLines: 1,
                         overflow: TextOverflow.ellipsis,
                         style: CTextStyle.PRegularBody3
                         )
                     )
                                     : new Container()
             }
                 )
         }
             ),
         new Container(
             margin: EdgeInsets.only(top: 8),
             child: new Text(
                 host.description,
                 style: new TextStyle(
                     color: CColors.TextBody3,
                     fontFamily: "Roboto-Regular",
                     fontSize: 16
                     )
                 )
             )
     }
                    )
                ));
 }
示例#4
0
        Widget _buildContentHead()
        {
            var user = this.eventObj.user ?? new User();

            return(new Container(
                       padding: EdgeInsets.symmetric(horizontal: 16),
                       margin: EdgeInsets.only(top: 16, bottom: 20),
                       child: new Column(
                           crossAxisAlignment: CrossAxisAlignment.start,
                           children: new List <Widget> {
                new Text(
                    this.eventObj.title ?? "",
                    this.titleKey,
                    style: CTextStyle.H4
                    ),
                new Container(
                    margin: EdgeInsets.only(top: 20),
                    child: new Row(
                        children: new List <Widget> {
                    new Container(
                        margin: EdgeInsets.only(right: 8),
                        child: new GestureDetector(
                            onTap: () => this.pushToUserDetail(user.id),
                            child: Avatar.User(user, 32)
                            )
                        ),
                    new Column(
                        mainAxisAlignment: MainAxisAlignment.center,
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: new List <Widget> {
                        new GestureDetector(
                            onTap: () => this.pushToUserDetail(user.id),
                            child: new Text(
                                user.fullName ?? "",
                                style: CTextStyle.PMediumBody
                                )
                            ),
                        new Text(
                            $"{DateConvert.DateStringFromNow(this.eventObj.createdTime ?? DateTime.Now)}发布",
                            style: CTextStyle.PSmallBody3
                            )
                    }
                        )
                }
                        )
                    )
            }
                           )
                       ));
        }
示例#5
0
        public override Widget build(BuildContext context)
        {
            if (this.user == null)
            {
                return(new Container());
            }

            return(new GestureDetector(
                       onTap: this.onTap,
                       child: new Container(
                           padding: EdgeInsets.symmetric(horizontal: 16),
                           color: CColors.White,
                           height: 72,
                           child: new Row(
                               children: new List <Widget> {
                new Expanded(
                    child: new Row(
                        children: new List <Widget> {
                    Avatar.User(user: this.user, 48),
                    new Expanded(
                        child: new Container(
                            margin: EdgeInsets.only(12),
                            child: new Column(
                                mainAxisAlignment: MainAxisAlignment.center,
                                crossAxisAlignment: CrossAxisAlignment.start,
                                children: new List <Widget> {
                        new Text(
                            data: this.user.fullName,
                            style: CTextStyle.PMediumBody,
                            maxLines: 1,
                            overflow: TextOverflow.ellipsis
                            ),
                        this._buildUserTitle()
                    }
                                )
                            )
                        )
                }
                        )
                    ),
                new SizedBox(width: 8),
                new FollowButton(
                    userType: this.userType,
                    onFollow: this.onFollow
                    )
            }
                               )
                           )
                       ));
        }
        Widget _buildHeader()
        {
            var user = this.widget.viewModel.user;

            return(new CoverImage(
                       user.coverImage,
                       246,
                       new Column(
                           mainAxisAlignment: MainAxisAlignment.center,
                           children: new List <Widget> {
                Avatar.User(
                    user: user,
                    120
                    )
            }
                           )
                       ));
        }
示例#7
0
        public override Widget build(BuildContext context)
        {
            if (this.message == null)
            {
                return(new Container());
            }

            var author = this.message.author != null ? this.message.author : new User();

            var messageContent =
                MessageUtils.AnalyzeMessage(this.message.content, this.message.mentions, this.message.mentionEveryone);

            return(new Container(
                       padding: EdgeInsets.symmetric(6),
                       child: new Row(
                           crossAxisAlignment: CrossAxisAlignment.start,
                           children: new List <Widget> {
                Avatar.User(this.message.author.id, this.message.author, 24),
                new Expanded(
                    child: new Container(
                        margin: EdgeInsets.only(8),
                        child: new Container(
                            child: new RichText(
                                softWrap: true,
                                text: new TextSpan(
                                    children: new List <TextSpan> {
                    new TextSpan(
                        $"{author.fullName}:".Replace(' ', '\u00a0'),
                        CTextStyle.PMediumBlue
                        ),
                    new TextSpan(
                        $" {messageContent}",
                        CTextStyle.PRegularBody
                        )
                }
                                    )
                                )
                            )
                        )
                    )
            }
                           )
                       ));
        }
示例#8
0
        public override Widget build(BuildContext context)
        {
            if (this.member == null)
            {
                return(new Container());
            }

            return(new GestureDetector(
                       onTap: this.onTap,
                       child: new Container(
                           color: CColors.White,
                           height: 72,
                           padding: EdgeInsets.symmetric(12, 16),
                           child: new Row(
                               children: new List <Widget> {
                Avatar.User(user: this.member.user, 48),
                new Expanded(
                    child: new Container(
                        padding: EdgeInsets.symmetric(0, 16),
                        child: new Column(
                            mainAxisAlignment: MainAxisAlignment.center,
                            crossAxisAlignment: CrossAxisAlignment.start,
                            children: new List <Widget> {
                    this._buildMemberName(),
                    this._buildMemberTitle()
                }
                            )
                        )
                    ),
                new FollowButton(
                    userType: this.userType,
                    onFollow: this.onFollow
                    )
            }
                               )
                           )
                       ));
        }
        Widget _buildNotificationAvatar()
        {
            Widget             avatar;
            GestureTapCallback onTap;

            if (this.user == null)
            {
                avatar = Avatar.Team(team: this.team, 48);
                onTap  = () => this.pushToTeamDetail(obj: this.team.id);
            }
            else
            {
                avatar = Avatar.User(user: this.user, 48);
                onTap  = () => this.pushToUserDetail(obj: this.user.id);
            }

            return(new Container(
                       padding: EdgeInsets.only(16, 16, 16),
                       child: new GestureDetector(
                           onTap: onTap,
                           child: avatar
                           )
                       ));
        }
示例#10
0
 Widget _buildAvatar(User user, string imageName, float avatarSize = 64, bool isFirst = false)
 {
     return(new GestureDetector(
                onTap: () => this.onPress?.Invoke(text: user.id),
                child: new Container(
                    color: CColors.Transparent,
                    child: new Column(
                        children: new List <Widget> {
         new Stack(
             children: new List <Widget> {
             Avatar.User(user: user, size: avatarSize, true),
             new Positioned(
                 right: 0,
                 bottom: 0,
                 child: Image.asset(
                     name: imageName,
                     width: isFirst ? 22 : 18,
                     height: isFirst ?  27 : 22
                     )
                 )
         }
             ),
         new Padding(
             padding: EdgeInsets.only(8, 10, 8),
             child: new Text(
                 data: user.fullName,
                 maxLines: 1,
                 overflow: TextOverflow.ellipsis,
                 style: CTextStyle.PMediumWhite
                 )
             )
     }
                        )
                    )
                ));
 }
示例#11
0
        Widget _buildContentHead()
        {
            Widget _avatar = this._article.ownerType == OwnerType.user.ToString()
                ? Avatar.User(user: this._user, 32)
                : Avatar.Team(team: this._team, 32);

            string name;
            Widget badge;
            string description;

            if (this._article.ownerType == "user")
            {
                // user
                name  = this._user.fullName ?? this._user.name;
                badge = CImageUtils.GenBadgeImage(
                    badges: this._user.badges,
                    CCommonUtils.GetUserLicense(
                        userId: this._user.id,
                        userLicenseMap: this.widget.viewModel.userLicenseDict
                        ),
                    EdgeInsets.only(4)
                    );
                description = this._user.title;
            }
            else
            {
                // team
                name  = this._team.name;
                badge = CImageUtils.GenBadgeImage(
                    badges: this._team.badges,
                    CCommonUtils.GetUserLicense(
                        userId: this._team.id
                        ),
                    EdgeInsets.only(4)
                    );
                description = "";
            }

            var    time = this._article.publishedTime;
            Widget descriptionWidget;

            if (description.isNotEmpty())
            {
                descriptionWidget = new Text(
                    data: description,
                    style: CTextStyle.PSmallBody3
                    );
            }
            else
            {
                descriptionWidget = new Container();
            }

            return(new Container(
                       color: CColors.White,
                       padding: EdgeInsets.only(16, 16, 16),
                       child: new Column(
                           crossAxisAlignment: CrossAxisAlignment.start,
                           children: new List <Widget> {
                new TipMenu(
                    new List <TipMenuItem> {
                    new TipMenuItem(
                        "复制",
                        () => Clipboard.setData(new ClipboardData(text: this._article.title))
                        )
                },
                    new Container(
                        color: CColors.Transparent,
                        child: new Text(
                            data: this._article.title,
                            style: CTextStyle.H3
                            )
                        )
                    ),
                new Container(
                    margin: EdgeInsets.only(top: 8),
                    child: new Text(
                        $"阅读 {this._article.viewCount} · {DateConvert.DateStringFromNow(dt: time)}",
                        style: CTextStyle.PSmallBody4
                        )
                    ),
                new Row(
                    children: new List <Widget> {
                    new Expanded(
                        child: new GestureDetector(
                            onTap: () => {
                        if (this._article.ownerType == OwnerType.user.ToString())
                        {
                            this.widget.actionModel.pushToUserDetail(obj: this._user.id);
                        }

                        if (this._article.ownerType == OwnerType.team.ToString())
                        {
                            this.widget.actionModel.pushToTeamDetail(obj: this._team.id);
                        }
                    },
                            child: new Container(
                                margin: EdgeInsets.only(top: 24, right: 16, bottom: 24),
                                color: CColors.Transparent,
                                child: new Row(
                                    mainAxisSize: MainAxisSize.min,
                                    children: new List <Widget> {
                        new Container(
                            margin: EdgeInsets.only(right: 8),
                            child: _avatar
                            ),
                        new Expanded(
                            child: new Column(
                                mainAxisAlignment: MainAxisAlignment.center,
                                crossAxisAlignment: CrossAxisAlignment.start,
                                children: new List <Widget> {
                            new Row(
                                children: new List <Widget> {
                                new Flexible(
                                    child: new Text(
                                        data: name,
                                        style: CTextStyle.PRegularBody.merge(
                                            new TextStyle(height: 1)),
                                        maxLines: 1,
                                        overflow: TextOverflow.ellipsis
                                        )
                                    ),
                                badge
                            }
                                ),
                            descriptionWidget
                        }
                                )
                            )
                    }
                                    )
                                )
                            )
                        ),
                    this._buildFollowButton()
                }
                    ),
                this._article.subTitle.isEmpty()
                            ? new Container()
                            : (Widget) new TipMenu(
                    new List <TipMenuItem> {
                    new TipMenuItem(
                        "复制",
                        () => Clipboard.setData(new ClipboardData(text: this._article.subTitle))
                        )
                },
                    new Container(
                        margin: EdgeInsets.only(bottom: 24),
                        decoration: new BoxDecoration(
                            color: CColors.Separator2,
                            borderRadius: BorderRadius.all(4)
                            ),
                        padding: EdgeInsets.only(16, 12, 16, 12),
                        width: Screen.width - 32,
                        child: new Text($"{this._article.subTitle}", style: CTextStyle.PLargeBody4)
                        )
                    )
            }
                           )
                       ));
        }
示例#12
0
        Widget _buildLecture(User host)
        {
            if (host == null)
            {
                return(new Container());
            }

            return(new Container(
                       padding: EdgeInsets.symmetric(horizontal: 16),
                       margin: EdgeInsets.only(bottom: 24),
                       color: CColors.White,
                       child: new Column(
                           crossAxisAlignment: CrossAxisAlignment.start,
                           children: new List <Widget> {
                new GestureDetector(
                    onTap: () => this.pushToUserDetail(obj: host.id),
                    child: new Row(
                        children: new List <Widget> {
                    new Container(
                        margin: EdgeInsets.only(right: 8),
                        child: Avatar.User(user: host, 48)
                        ),
                    new Flexible(
                        child: new Column(
                            mainAxisAlignment: MainAxisAlignment.center,
                            crossAxisAlignment: CrossAxisAlignment.start,
                            children: new List <Widget> {
                        new Row(
                            children: new List <Widget> {
                            new Flexible(
                                child: new Text(
                                    host.fullName ?? host.name ?? "",
                                    maxLines: 1,
                                    style: new TextStyle(
                                        color: CColors.TextBody,
                                        height: 1,
                                        fontFamily: "Roboto-Medium",
                                        fontSize: 16
                                        ),
                                    overflow: TextOverflow.ellipsis
                                    )
                                ),
                            CImageUtils.GenBadgeImage(
                                badges: host.badges,
                                CCommonUtils.GetUserLicense(
                                    userId: host.id,
                                    userLicenseMap: this.userLicenseDict
                                    ),
                                EdgeInsets.only(4)
                                )
                        }
                            ),
                        host.title.isNotEmpty()
                                                    ? new Container(
                            child: new Text(
                                data: host.title,
                                maxLines: 1,
                                overflow: TextOverflow.ellipsis,
                                style: CTextStyle.PRegularBody3
                                )
                            )
                                                    : new Container()
                    }
                            )
                        )
                }
                        )
                    ),
                new Container(
                    margin: EdgeInsets.only(top: 8),
                    child: new Text(
                        data: host.description,
                        style: new TextStyle(
                            color: CColors.TextBody3,
                            fontFamily: "Roboto-Regular",
                            fontSize: 16
                            )
                        )
                    )
            }
                           )
                       ));
        }
示例#13
0
        Widget _buildContentHead()
        {
            var user = this.eventObj.user ?? new User();

            return(new Container(
                       padding: EdgeInsets.symmetric(horizontal: 16),
                       margin: EdgeInsets.only(top: 16, bottom: 20),
                       child: new Column(
                           crossAxisAlignment: CrossAxisAlignment.start,
                           children: new List <Widget> {
                new Text(
                    this.eventObj.title ?? "",
                    this.titleKey,
                    style: CTextStyle.H4
                    ),
                new Container(
                    margin: EdgeInsets.only(top: 20),
                    child: new Row(
                        children: new List <Widget> {
                    new Container(
                        margin: EdgeInsets.only(right: 8),
                        child: new GestureDetector(
                            onTap: () => this.pushToUserDetail(user.id),
                            child: Avatar.User(user, 32)
                            )
                        ),
                    new Expanded(
                        child: new Column(
                            mainAxisAlignment: MainAxisAlignment.center,
                            crossAxisAlignment: CrossAxisAlignment.start,
                            children: new List <Widget> {
                        new GestureDetector(
                            onTap: () => this.pushToUserDetail(user.id),
                            child: new Row(
                                children: new List <Widget> {
                            new Flexible(
                                child: new Text(
                                    user.fullName ?? user.name ?? "",
                                    style: CTextStyle.PMediumBody.merge(
                                        new TextStyle(height: 1)),
                                    maxLines: 1,
                                    overflow: TextOverflow.ellipsis
                                    )
                                ),
                            CImageUtils.GenBadgeImage(
                                badges: user.badges,
                                CCommonUtils.GetUserLicense(
                                    userId: user.id,
                                    userLicenseMap: this.userLicenseDict
                                    ),
                                EdgeInsets.only(4)
                                )
                        }
                                )
                            ),
                        new Text(
                            $"{DateConvert.DateStringFromNow(this.eventObj.createdTime ?? DateTime.Now)}发布",
                            style: CTextStyle.PSmallBody3
                            )
                    }
                            )
                        )
                }
                        )
                    )
            }
                           )
                       ));
        }
示例#14
0
        Widget _buildContentHead()
        {
            Widget _avatar = this._article.ownerType == OwnerType.user.ToString()
                ? Avatar.User(this._user.id, this._user, 32)
                : Avatar.Team(this._team.id, this._team, 32);

            var text        = this._article.ownerType == "user" ? this._user.fullName : this._team.name;
            var description = this._article.ownerType == "user" ? this._user.title : "";
            var time        = this._article.lastPublishedTime == null
                ? this._article.publishedTime
                : this._article.lastPublishedTime;
            Widget descriptionWidget = new Container();

            if (description.isNotEmpty())
            {
                descriptionWidget = new Text(
                    description,
                    style: CTextStyle.PSmallBody3
                    );
            }

            return(new Container(
                       color: CColors.White,
                       padding: EdgeInsets.only(16, 16, 16),
                       child: new Column(
                           crossAxisAlignment: CrossAxisAlignment.start,
                           children: new List <Widget> {
                new Text(
                    this._article.title,
                    style: CTextStyle.H3
                    ),
                new Container(
                    margin: EdgeInsets.only(top: 8),
                    child: new Text(
                        $"阅读 {this._article.viewCount} · {DateConvert.DateStringFromNow(time)}",
                        style: CTextStyle.PSmallBody4
                        )
                    ),
                new Container(
                    margin: EdgeInsets.only(top: 24, bottom: 24),
                    child: new Row(
                        children: new List <Widget> {
                    new Container(
                        margin: EdgeInsets.only(right: 8),
                        child: _avatar
                        ),
                    new Column(
                        mainAxisAlignment: MainAxisAlignment.center,
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: new List <Widget> {
                        new Text(
                            text,
                            style: CTextStyle.PRegularBody
                            ),
                        descriptionWidget
                    }
                        )
                }
                        )
                    ),
                this._article.subTitle.isEmpty()
                            ? new Container()
                            : new Container(
                    margin: EdgeInsets.only(bottom: 24),
                    decoration: new BoxDecoration(
                        CColors.Separator2,
                        borderRadius: BorderRadius.all(4)
                        ),
                    padding: EdgeInsets.only(16, 12, 16, 12),
                    width: Screen.width - 32,
                    child: new Text($"{this._article.subTitle}", style: CTextStyle.PLargeBody4)
                    )
            }
                           )
                       ));
        }
示例#15
0
        Widget _buildUserInfo()
        {
            var    user        = this.widget.viewModel.user ?? new User();
            Widget titleWidget = new Container();

            if (user.title != null && user.title.isNotEmpty())
            {
                titleWidget = new Text(
                    data: user.title,
                    style: new TextStyle(
                        height: 1.46f,
                        fontSize: 14,
                        fontFamily: "Roboto-Regular",
                        color: CColors.BgGrey
                        ),
                    maxLines: 1,
                    overflow: TextOverflow.ellipsis
                    );
            }

            return(new CoverImage(
                       coverImage: user.coverImage,
                       height: headerHeight,
                       new Container(
                           padding: EdgeInsets.only(16, 0, 16, 24),
                           child: new Column(
                               mainAxisAlignment: MainAxisAlignment.end,
                               children: new List <Widget> {
                new Row(
                    children: new List <Widget> {
                    new Container(
                        margin: EdgeInsets.only(right: 16),
                        child: Avatar.User(
                            user: user,
                            80,
                            true
                            )
                        ),
                    new Expanded(
                        child: new Column(
                            crossAxisAlignment: CrossAxisAlignment.start,
                            children: new List <Widget> {
                        new Text(
                            user.fullName ?? user.name,
                            style: CTextStyle.H4White,
                            maxLines: 1,
                            overflow: TextOverflow.ellipsis
                            ),
                        titleWidget
                    }
                            )
                        )
                }
                    ),
                new Container(
                    margin: EdgeInsets.only(top: 16),
                    child: new Row(
                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
                        children: new List <Widget> {
                    new Row(
                        children: new List <Widget> {
                        _buildFollowCount(
                            "关注",
                            $"{(user.followingUsersCount ?? 0) + (user.followingTeamsCount ?? 0)}",
                            () =>
                            this.widget.actionModel.pushToUserFollowing(
                                arg1: this.widget.viewModel.user.id, 0)
                            ),
                        new SizedBox(width: 16),
                        _buildFollowCount(
                            "粉丝",
                            $"{user.followCount ?? 0}",
                            () =>
                            this.widget.actionModel.pushToUserFollower(
                                obj: this.widget.viewModel.user.id)
                            )
                    }
                        ),
                    this._buildFollowButton()
                }
                        )
                    )
            }
                               )
                           )
                       ));
        }
示例#16
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.apply(heightFactor: 0,
                                                                                     heightDelta: 1)))),

                        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
                        )
                }
                            )
                        )
                    )
            }
                           )
                       ));
        }
示例#17
0
        Widget _buildBlogger(User user, string resetTitle)
        {
            UserType userType = UserType.unFollow;

            if (!this.isLoggedIn)
            {
                userType = UserType.unFollow;
            }
            else
            {
                if (UserInfoManager.getUserInfo().userId == user.id)
                {
                    userType = UserType.me;
                }
                else if (user.followUserLoading ?? false)
                {
                    userType = UserType.loading;
                }
                else if (this.followMap.ContainsKey(key: user.id))
                {
                    userType = UserType.follow;
                }
            }

            return(new GestureDetector(
                       onTap: () => this.onPressItem?.Invoke(text: user.id),
                       child: new Container(
                           width: 160,
                           margin: EdgeInsets.only(right: 16),
                           decoration: new BoxDecoration(
                               color: CColors.White,
                               borderRadius: BorderRadius.all(6)
                               ),
                           child: new ClipRRect(
                               borderRadius: BorderRadius.all(6),
                               child: new Column(
                                   children: new List <Widget> {
                new Container(
                    height: 88,
                    color: CColorUtils.GetSpecificDarkColorFromId(id: user.id),
                    child: new Stack(
                        fit: StackFit.expand,
                        children: new List <Widget> {
                    Image.asset(
                        "image/blogger-avatar-pattern",
                        fit: BoxFit.fill
                        ),
                    Positioned.fill(
                        new Center(
                            child: Avatar.User(user: user, 64, true)
                            )
                        )
                }
                        )
                    ),
                new Padding(
                    padding: EdgeInsets.only(16, 16, 16, 4),
                    child: new Text(data: user.fullName, style: CTextStyle.PXLargeMedium, maxLines: 1)
                    ),
                new Text(
                    $"粉丝{user.followCount ?? 0} • 文章{user.articleCount ?? 0}",
                    style: CTextStyle.PSmallBody4
                    ),
                new Text(resetTitle ?? "", style: CTextStyle.PSmallBody4),
                new Padding(
                    padding: EdgeInsets.only(top: 12),
                    child: new FollowButton(
                        userType: userType,
                        () => this._onFollow(userType: userType, userId: user.id)
                        )
                    )
            }
                                   )
                               )
                           )
                       ));
        }
示例#18
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
                                        )
                                    }
                                )
                            )
                        )
                    }
                )
            );
        }
示例#19
0
        Widget _buildAvatar()
        {
            Widget rightWidget;

            if (this.userType == UserType.me)
            {
                var time = this.article.publishedTime;
                rightWidget = new Text(
                    $"{DateConvert.DateStringFromNow(dt: time)}",
                    style: CTextStyle.PSmallBody5
                    );
            }
            else
            {
                rightWidget = new FollowButton(
                    userType: this.userType,
                    onFollow: this.followCallBack
                    );
            }

            var avatar = this.type == OwnerType.user
                ? Avatar.User(
                user: this.user,
                38
                )
                : Avatar.Team(
                team: this.team,
                38
                );
            Widget titleWidget = new Container();

            if (this.user.title != null && this.user.title.isNotEmpty() && this.type == OwnerType.user)
            {
                titleWidget = new Text(
                    data: this.user.title,
                    style: CTextStyle.PSmallBody4,
                    maxLines: 1,
                    overflow: TextOverflow.ellipsis
                    );
            }

            return(new Container(
                       padding: EdgeInsets.only(16, 16, 16),
                       child: new Row(
                           mainAxisAlignment: MainAxisAlignment.spaceBetween,
                           children: new List <Widget> {
                new GestureDetector(
                    child: avatar,
                    onTap: this.avatarCallBack
                    ),
                new Expanded(
                    child: new GestureDetector(
                        onTap: this.avatarCallBack,
                        child: new Container(
                            color: CColors.Transparent,
                            margin: EdgeInsets.only(8, right: 8),
                            child: new Column(
                                crossAxisAlignment: CrossAxisAlignment.start,
                                children: new List <Widget> {
                    new Text(
                        this.type == OwnerType.user
                                                    ? this.user.fullName ?? this.user.name ?? "佚名"
                                                    : this.team.name,
                        style: CTextStyle.PLargeBody,
                        maxLines: 1,
                        overflow: TextOverflow.ellipsis
                        ),
                    titleWidget
                }
                                )
                            )
                        )
                    ),
                rightWidget
            }
                           )
                       ));
        }
示例#20
0
        public override Widget build(BuildContext context)
        {
            if (this.user == null)
            {
                return(new Container());
            }

            return(new GestureDetector(
                       onTap: this.onTap,
                       child: new Container(
                           padding: EdgeInsets.symmetric(horizontal: 16),
                           color: CColors.White,
                           height: 72,
                           child: new Row(
                               children: new List <Widget> {
                new Expanded(
                    child: new Row(
                        children: new List <Widget> {
                    Avatar.User(user: this.user, 48),
                    new Expanded(
                        child: new Container(
                            padding: EdgeInsets.only(12, right: 16),
                            child: new Column(
                                mainAxisAlignment: MainAxisAlignment.center,
                                crossAxisAlignment: CrossAxisAlignment.start,
                                children: new List <Widget> {
                        new Row(
                            children: new List <Widget> {
                            new Flexible(
                                child: new Text(
                                    data: this.user.fullName,
                                    style: new TextStyle(
                                        fontSize: this.isSearchCard ? 16 : 14,
                                        height: 1,
                                        fontFamily: "Roboto-Medium",
                                        color: CColors.TextBody
                                        ),
                                    maxLines: 1,
                                    overflow: TextOverflow.ellipsis
                                    )
                                ),
                            CImageUtils.GenBadgeImage(
                                badges: this.user.badges,
                                license: this.license,
                                EdgeInsets.only(4)
                                )
                        }
                            ),
                        this._buildUserTitle()
                    }
                                )
                            )
                        )
                }
                        )
                    ),
                new FollowButton(
                    userType: this.userType,
                    onFollow: this.onFollow
                    )
            }
                               )
                           )
                       ));
        }
示例#21
0
        Widget _buildContentHead()
        {
            Widget _avatar = this._article.ownerType == OwnerType.user.ToString()
                ? Avatar.User(user: this._user, 32)
                : Avatar.Team(team: this._team, 32);

            var text = this._article.ownerType == "user"
                ? this._user.fullName ?? this._user.name
                : this._team.name;
            var    description       = this._article.ownerType == "user" ? this._user.title : "";
            var    time              = this._article.publishedTime;
            Widget descriptionWidget = new Container();

            if (description.isNotEmpty())
            {
                descriptionWidget = new Text(
                    data: description,
                    style: CTextStyle.PSmallBody3
                    );
            }

            return(new Container(
                       color: CColors.White,
                       padding: EdgeInsets.only(16, 16, 16),
                       child: new Column(
                           crossAxisAlignment: CrossAxisAlignment.start,
                           children: new List <Widget> {
                new Text(
                    data: this._article.title,
                    style: CTextStyle.H3
                    ),
                new Container(
                    margin: EdgeInsets.only(top: 8),
                    child: new Text(
                        $"阅读 {this._article.viewCount} · {DateConvert.DateStringFromNow(dt: time)}",
                        style: CTextStyle.PSmallBody4
                        )
                    ),
                new Row(
                    children: new List <Widget> {
                    new Expanded(
                        child: new GestureDetector(
                            onTap: () => {
                        if (this._article.ownerType == OwnerType.user.ToString())
                        {
                            this.widget.actionModel.pushToUserDetail(obj: this._user.id);
                        }

                        if (this._article.ownerType == OwnerType.team.ToString())
                        {
                            this.widget.actionModel.pushToTeamDetail(obj: this._team.id);
                        }
                    },
                            child: new Container(
                                margin: EdgeInsets.only(top: 24, bottom: 24),
                                color: CColors.Transparent,
                                child: new Row(
                                    mainAxisSize: MainAxisSize.min,
                                    children: new List <Widget> {
                        new Container(
                            margin: EdgeInsets.only(right: 8),
                            child: _avatar
                            ),
                        new Column(
                            mainAxisAlignment: MainAxisAlignment.center,
                            crossAxisAlignment: CrossAxisAlignment.start,
                            children: new List <Widget> {
                            new Text(
                                data: text,
                                style: CTextStyle.PRegularBody
                                ),
                            descriptionWidget
                        }
                            )
                    }
                                    )
                                )
                            )
                        ),
                    new SizedBox(width: 8),
                    this._buildFollowButton()
                }
                    ),
                this._article.subTitle.isEmpty()
                            ? new Container()
                            : new Container(
                    margin: EdgeInsets.only(bottom: 24),
                    decoration: new BoxDecoration(
                        color: CColors.Separator2,
                        borderRadius: BorderRadius.all(4)
                        ),
                    padding: EdgeInsets.only(16, 12, 16, 12),
                    width: Screen.width - 32,
                    child: new Text($"{this._article.subTitle}", style: CTextStyle.PLargeBody4)
                    )
            }
                           )
                       ));
        }
示例#22
0
        public override Widget build(BuildContext context)
        {
            Widget titleWidget;

            if (this.blogger.title.isNotEmpty())
            {
                titleWidget = new Text(
                    data: this.blogger.title,
                    maxLines: 1,
                    overflow: TextOverflow.ellipsis,
                    style: CTextStyle.PRegularBody4
                    );
            }
            else
            {
                titleWidget = new Container();
            }

            return(new GestureDetector(
                       onTap: this.onPress,
                       child: new Container(
                           padding: EdgeInsets.all(16),
                           color: CColors.White,
                           height: 88,
                           child: new Row(
                               children: new List <Widget> {
                new Text(
                    $"{this.index + 1}",
                    style: new TextStyle(
                        height: 1.27f,
                        fontSize: 20,
                        fontFamily: "Roboto-Bold",
                        color: CColors.TextBody5
                        )
                    ),
                new Padding(
                    padding: EdgeInsets.symmetric(horizontal: 16),
                    child: Avatar.User(user: this.blogger, 56)
                    ),
                new Expanded(
                    child: new Column(
                        mainAxisAlignment: MainAxisAlignment.center,
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: new List <Widget> {
                    new Text(
                        data: this.blogger.fullName,
                        maxLines: 1,
                        overflow: TextOverflow.ellipsis,
                        style: new TextStyle(
                            height: 1.33f,
                            fontSize: 16,
                            fontFamily: "Roboto-Medium",
                            color: CColors.TextBody
                            )
                        ),
                    titleWidget
                }
                        )
                    ),
                new Padding(
                    padding: EdgeInsets.only(16),
                    child: new Text(
                        $"文章 {this.blogger.articleCount ?? 0} • 赞 {this.blogger.likeCount ?? 0}",
                        style: CTextStyle.PSmallBody4
                        )
                    )
            }
                               )
                           )
                       ));
        }