Ejemplo n.º 1
0
        public override Widget build(BuildContext context)
        {
            if (this.userType == UserType.me)
            {
                return(new Container());
            }

            Widget buttonChild;
            Color  followColor = CColors.PrimaryBlue;

            if (this.userType == UserType.loading)
            {
                followColor = CColors.Disable2;
                buttonChild = new CustomActivityIndicator(
                    size: LoadingSize.xSmall
                    );
            }
            else
            {
                string followText = "关注";
                Color  textColor  = CColors.PrimaryBlue;
                if (this.userType == UserType.follow)
                {
                    followText  = "已关注";
                    followColor = CColors.Disable2;
                    textColor   = new Color(0xFF959595);
                }
                buttonChild = new Text(
                    data: followText,
                    style: new TextStyle(
                        fontSize: 14,
                        fontFamily: "Roboto-Medium",
                        color: textColor
                        )
                    );
            }
            return(new CustomButton(
                       onPressed: () => this.onFollow(),
                       padding: EdgeInsets.zero,
                       child: new Container(
                           width: 60,
                           height: 28,
                           alignment: Alignment.center,
                           decoration: new BoxDecoration(
                               color: CColors.White,
                               borderRadius: BorderRadius.circular(14),
                               border: Border.all(color: followColor)
                               ),
                           child: buttonChild
                           )
                       ));
        }
Ejemplo n.º 2
0
        Widget _buildJoinButton()
        {
            Widget child;

            if (this.channel.joinLoading)
            {
                child = new CustomActivityIndicator(
                    size: LoadingSize.xSmall
                    );
            }
            else
            {
                child = this.channel.joined
                    ? new Text(
                    "已加入",
                    style: CTextStyle.PRegularBody5.copyWith(height: 1)
                    )
                    : new Text(
                    "加入",
                    style: CTextStyle.PRegularBlue.copyWith(height: 1)
                    );
            }

            return(new CustomButton(
                       padding: EdgeInsets.zero,
                       onPressed: this.channel.joined || this.channel.joinLoading
                    ? null
                    : (GestureTapCallback)(() => this.joinChannel()),
                       child: new Container(
                           width: 60,
                           height: 28,
                           decoration: new BoxDecoration(
                               border: Border.all(this.channel.joined ? CColors.Disable2 : CColors.PrimaryBlue),
                               borderRadius: BorderRadius.all(14)
                               ),
                           child: new Center(
                               child: child
                               )
                           )
                       ));
        }
Ejemplo n.º 3
0
        public override Widget build(BuildContext context)
        {
            Widget buttonChild;
            Color  buttonColor = CColors.PrimaryBlue;

            if (this.isLoading)
            {
                buttonColor = CColors.Disable2;
                buttonChild = new CustomActivityIndicator(
                    size: LoadingSize.xSmall
                    );
            }
            else
            {
                string buttonText = "收藏";
                Color  textColor  = CColors.PrimaryBlue;
                if (this.isCollected)
                {
                    buttonText  = $"已收藏";
                    buttonColor = CColors.Disable2;
                    textColor   = new Color(0xFF959595);
                }

                buttonChild = new Text(
                    data: buttonText,
                    style: new TextStyle(
                        fontSize: 14,
                        fontFamily: "Roboto-Medium",
                        color: textColor
                        )
                    );
            }

            return(new Container(
                       color: CColors.Background,
                       child: new Column(
                           crossAxisAlignment: CrossAxisAlignment.start,
                           children: new List <Widget> {
                new Padding(
                    padding: EdgeInsets.all(16),
                    child: new Row(
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: new List <Widget> {
                    new Padding(
                        padding: EdgeInsets.only(top: this.leftWidgetTopPadding),
                        child: this.leftWidget ?? new CoverImages(
                            images: this.images,
                            horizontalGap: 8,
                            verticalGap: 0
                            )
                        ),

                    new SizedBox(width: 16),
                    new Expanded(
                        child: new Column(
                            mainAxisAlignment: MainAxisAlignment.spaceBetween,
                            crossAxisAlignment: CrossAxisAlignment.start,
                            children: new List <Widget> {
                        new Container(
                            margin: EdgeInsets.only(bottom: 4),
                            height: 56,
                            child: new Text(this.title,
                                            maxLines: 2,
                                            overflow: TextOverflow.ellipsis,
                                            style: CTextStyle.H5
                                            )),
                        this.type == LeaderBoardType.column
                                                    ? this.followButton
                                                    : this.isHost
                                                        ? (Widget) new Container()
                                                        : new CustomButton(
                            onPressed: () => this.ClickButtonCallback(),
                            padding: EdgeInsets.zero,
                            child: new Container(
                                width: 60,
                                height: 28,
                                alignment: Alignment.center,
                                decoration: new BoxDecoration(
                                    color: CColors.White,
                                    borderRadius: BorderRadius.circular(14),
                                    border: Border.all(color: buttonColor)
                                    ),
                                child: buttonChild
                                )
                            )
                    }
                            )
                        ),
                    new SizedBox(width: 16)
                }
                        )
                    ),

                new SizedBox(height: 4),
                new Padding(
                    padding: EdgeInsets.only(16, 0, 16),
                    child: new Text(
                        this.subTitle,
                        style: CTextStyle.PSmallBody4
                        )
                    ),
                new SizedBox(height: 16)
            })
                       ));
        }