コード例 #1
0
ファイル: TeamCard.cs プロジェクト: xuxudefeng/ConnectAppCN
        public override Widget build(BuildContext context)
        {
            if (this.team == 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.Team(team: this.team, 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.team.name,
                            style: CTextStyle.PMediumBody,
                            maxLines: 1,
                            overflow: TextOverflow.ellipsis
                            )
                    }
                                )
                            )
                        )
                }
                        )
                    ),
                new SizedBox(width: 8),
                new FollowButton(
                    userType: this.userType,
                    onFollow: this.onFollow
                    )
            }
                               )
                           )
                       ));
        }
コード例 #2
0
        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
                           )
                       ));
        }
コード例 #3
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)
                    )
            }
                           )
                       ));
        }
コード例 #4
0
ファイル: TeamCard.cs プロジェクト: zuoyanshun/ConnectAppCN
        public override Widget build(BuildContext context)
        {
            if (this.team == 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.Team(team: this.team, 48),
                    new Expanded(
                        child: new Container(
                            margin: 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.team.name,
                                    style: new TextStyle(
                                        height: 1,
                                        fontSize: this.isSearchCard ? 16 : 14,
                                        fontFamily: "Roboto-Medium",
                                        color: CColors.TextBody
                                        ),
                                    maxLines: 1,
                                    overflow: TextOverflow.ellipsis
                                    )
                                ),
                            CImageUtils.GenBadgeImage(
                                badges: this.team.badges,
                                null,
                                EdgeInsets.only(4)
                                )
                        }
                            )
                    }
                                )
                            )
                        )
                }
                        )
                    ),
                new FollowButton(
                    userType: this.userType,
                    onFollow: this.onFollow
                    )
            }
                               )
                           )
                       ));
        }
コード例 #5
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)
                    )
            }
                           )
                       ));
        }
コード例 #6
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
            }
                           )
                       ));
        }
コード例 #7
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()
                }
                        )
                    )
            }
                               )
                           )
                       ));
        }
コード例 #8
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)
                        )
                    )
            }
                           )
                       ));
        }