コード例 #1
0
        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
                    )
            }
                           )
                       ));
        }
コード例 #2
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)
                    )
            }
                           )
                       ));
        }
コード例 #3
0
        Widget _buildTeamInfo()
        {
            var team = this.widget.viewModel.team;

            return(new CoverImage(
                       coverImage: team.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.Team(
                            team: team,
                            80,
                            true
                            )
                        ),
                    new Expanded(
                        child: new Column(
                            crossAxisAlignment: CrossAxisAlignment.start,
                            children: new List <Widget> {
                        new Row(
                            crossAxisAlignment: CrossAxisAlignment.start,
                            children: new List <Widget> {
                            new Flexible(
                                child: new Text(
                                    data: team.name,
                                    style: CTextStyle.H4White.merge(
                                        new TextStyle(height: 1)),
                                    maxLines: 1,
                                    overflow: TextOverflow.ellipsis
                                    )
                                ),
                            CImageUtils.GenBadgeImage(
                                badges: team.badges,
                                CCommonUtils.GetUserLicense(
                                    userId: team.id
                                    ),
                                EdgeInsets.only(4, 6)
                                )
                        }
                            )
                    }
                            )
                        )
                }
                    ),
                new Container(
                    margin: EdgeInsets.only(top: 16),
                    child: new Row(
                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
                        children: new List <Widget> {
                    new Row(
                        children: new List <Widget> {
                        _buildFollowCount(
                            "粉丝",
                            $"{team.stats?.followCount ?? 0}",
                            () => {
                            if (this.widget.viewModel.isLoggedIn)
                            {
                                this.widget.actionModel.pushToTeamFollower(
                                    obj: this.widget.viewModel.team.id);
                            }
                            else
                            {
                                this.widget.actionModel.pushToLogin();
                            }
                        }
                            ),
                        new SizedBox(width: 16),
                        _buildFollowCount(
                            "成员",
                            $"{team.stats?.membersCount ?? 0}",
                            () => this.widget.actionModel.pushToTeamMember(
                                obj: this.widget.viewModel.team.id)
                            )
                    }
                        ),
                    this._buildFollowButton()
                }
                        )
                    )
            }
                               )
                           )
                       ));
        }
コード例 #4
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)
                    )
            }
                           )
                       ));
        }
コード例 #5
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
                            )
                    }
                            )
                        )
                }
                        )
                    )
            }
                           )
                       ));
        }
コード例 #6
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
                            )
                        )
                    )
            }
                           )
                       ));
        }
コード例 #7
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
                        )
                }
                            )
                        )
                    )
            }
                           )
                       ));
        }
コード例 #8
0
        Widget _buildAvatar()
        {
            Widget rightWidget;

            if (this.userType == UserType.me || this.userType == UserType.follow)
            {
                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
                );

            var badge = this.type == OwnerType.user
                ? CImageUtils.GenBadgeImage(
                badges: this.user.badges,
                license: this.license,
                EdgeInsets.only(4)
                )
                : CImageUtils.GenBadgeImage(
                badges: this.team.badges,
                null,
                EdgeInsets.only(4)
                );

            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: 16),
                            child: new Column(
                                crossAxisAlignment: CrossAxisAlignment.start,
                                children: new List <Widget> {
                    new Row(
                        children: new List <Widget> {
                        new Flexible(
                            child: new Text(
                                this.type == OwnerType.user
                                                                ? this.user.fullName ?? this.user.name ?? "佚名"
                                                                : this.team.name,
                                style: CTextStyle.PLargeBody.merge(
                                    new TextStyle(height: 1)),
                                maxLines: 1,
                                overflow: TextOverflow.ellipsis
                                )
                            ),
                        badge
                    }
                        ),
                    titleWidget
                }
                                )
                            )
                        )
                    ),
                rightWidget
            }
                           )
                       ));
        }
コード例 #9
0
        public override Widget build(BuildContext context)
        {
            if (this.message == null)
            {
                return(new Container());
            }

            var reply = this.message.parentMessageId.isEmpty()
                ? new GestureDetector(
                onTap: this.replyCallBack,
                child: new Container(
                    margin: EdgeInsets.only(15),
                    child: new Text(
                        $"回复 {CStringUtils.CountToString(count: 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 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(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(this.message.reactions.Count)}",
                                        style: this.isPraised
                                                                            ? CTextStyle.PRegularBlue
                                                                            : CTextStyle.PRegularBody4
                                        )
                                    )),
                            reply
                        }
                                )
                            )
                    }
                        ),
                    new Container(
                        margin: EdgeInsets.only(top: 12),
                        height: 1,
                        color: CColors.Separator2
                        )
                }
                            )
                        )
                    )
            }
                           )
                       ));
        }
コード例 #10
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()
                }
                        )
                    )
            }
                               )
                           )
                       ));
        }
コード例 #11
0
        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);
        }
コード例 #12
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.all(6),
                           decoration: new BoxDecoration(
                               color: CColors.White,
                               borderRadius: BorderRadius.all(6),
                               boxShadow: new List <BoxShadow> {
                new BoxShadow(
                    CColors.Black.withOpacity(0.08f),
                    blurRadius: 10,
                    spreadRadius: 1.0f
                    )
            }
                               ),
                           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> {
                    user.coverImage.isNotEmpty()
                                                ? Image.network(user.coverImage, fit: BoxFit.fill)
                                                : 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)
                        )
                    )
            }
                                   )
                               )
                           )
                       ));
        }
コード例 #13
0
ファイル: UserCard.cs プロジェクト: zuoyanshun/ConnectAppCN
        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
                    )
            }
                               )
                           )
                       ));
        }
コード例 #14
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)
                        )
                    )
            }
                           )
                       ));
        }
コード例 #15
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
                        )
                    )
            }
                               )
                           )
                       ));
        }