Exemple #1
0
        public override Widget build(BuildContext context)
        {
            var fontSize = (int)Math.Ceiling(this.size * 0.5f);
            var name     = CStringUtils.genAvatarName(name: this.title);

            if (CStringUtils.IsLetterOrNumber(name))
            {
                fontSize = (int)Math.Ceiling(this.size * 0.4f);
            }
            return(new Container(
                       width: this.size,
                       height: this.size,
                       alignment: Alignment.center,
                       color: CColorUtils.GetAvatarBackgroundColor(id: this.id),
                       child: new Container(
                           alignment: Alignment.center,
                           child: new Text(
                               CStringUtils.genAvatarName(name: this.title),
                               textAlign: TextAlign.center,
                               style: new TextStyle(
                                   color: CColors.White,
                                   height: 1.15f,
                                   fontFamily: "Roboto-Medium",
                                   fontSize: fontSize
                                   )
                               )
                           )
                       ));
        }