예제 #1
0
        Widget _buildAvatar(User user)
        {
            var httpsUrl = user.avatar;

            // fix Android 9 http request error
            if (httpsUrl.Contains("http://"))
            {
                httpsUrl = httpsUrl.Replace("http://", "https://");
            }

            var image = this._pickedImage.isEmpty()
                ? Image.network(src: httpsUrl)
                : Image.memory(Convert.FromBase64String(s: this._pickedImage));
            var child = user.avatar.isEmpty() && this._pickedImage.isEmpty()
                ? new Container(
                child: new _Placeholder(
                    user.id ?? "",
                    user.fullName ?? "",
                    120
                    )
                )
                : new Container(
                width: 120,
                height: 120,
                color: CColors.AvatarLoading,
                child: image
                );

            return(new Container(
                       width: 120,
                       height: 120,
                       decoration: new BoxDecoration(
                           borderRadius: BorderRadius.circular(60),
                           border: Border.all(
                               color: CColors.White,
                               2
                               )
                           ),
                       child: new ClipRRect(
                           borderRadius: BorderRadius.circular(60),
                           child: new Stack(
                               children: new List <Widget> {
                child,
                new Positioned(
                    bottom: 0,
                    left: 0,
                    right: 0,
                    child: new Container(
                        height: 32,
                        color: Color.fromRGBO(0, 0, 0, 0.3f),
                        child: new Container(
                            color: CColors.Transparent,
                            child: new Icon(icon: Icons.camera_alt, size: 20, color: CColors.White))
                        )
                    )
            })
                           )
                       ));
        }
예제 #2
0
        Widget _buildRoleItem()
        {
            var jobRoleName = this.widget.viewModel.jobRole.name ?? "";
            var name        = this._jobRole.ContainsKey(key: jobRoleName)
                ? this._jobRole[key : jobRoleName]
                              : jobRoleName;

            return(new Container(
                       color: CColors.White,
                       height: 60,
                       padding: EdgeInsets.symmetric(horizontal: 16),
                       child: new Row(
                           children: new List <Widget> {
                new Expanded(
                    flex: 1,
                    child: new Text("身份", style: CTextStyle.PLargeBody4)
                    ),
                new Expanded(
                    flex: 3,
                    child: new GestureDetector(
                        onTap: () => this.widget.actionModel.pushToJobRole(),
                        child: new Container(
                            color: CColors.Transparent,
                            child: new Stack(
                                fit: StackFit.expand,
                                children: new List <Widget> {
                    name.isEmpty()
                                                ? new Container(
                        alignment: Alignment.centerLeft,
                        child: new Text("请选择对应的身份", style: CTextStyle.PLargeBody4)
                        )
                                                : new Container(
                        alignment: Alignment.centerLeft,
                        child: new Text(data: name, style: CTextStyle.PLargeBody)
                        ),
                    new Positioned(
                        top: 0,
                        right: 0,
                        bottom: 0,
                        child: new Icon(
                            icon: Icons.chevron_right,
                            size: 24,
                            color: Color.fromRGBO(199, 203, 207, 1)
                            )
                        )
                }
                                )
                            )
                        )
                    )
            }
                           )
                       ));
        }