Widget _buildCommentAvatarName(bool isMe) { var textStyle = CTextStyle.PMediumBody3.apply(heightFactor: 0, heightDelta: 1); return(new Container( height: 24, child: new Row( children: new List <Widget> { new Expanded( child: new GestureDetector( onTap: () => this.pushToUserDetail(obj: this.message.author.id), child: new Row( children: new List <Widget> { new Flexible( child: new Text( this.message.author.fullName, style: textStyle, maxLines: 1, overflow: TextOverflow.ellipsis ) ), CImageUtils.GenBadgeImage( badges: this.message.author.badges, license: this.userLicense, EdgeInsets.only(4) ) } ) ) ), !isMe ? new CustomButton( padding: EdgeInsets.only(16, 0, 0, 8), onPressed: this.moreCallBack, child: new Icon( icon: Icons.ellipsis, size: 20, color: CColors.BrownGrey ) ) : (Widget) new Container() } ) )); }
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 ) ) ) } ) )); }
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 ) } ) ) } ) ) } ) )); }
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 ) } ) ) )); }
Widget _buildTeamInfo(BuildContext context) { var team = this.widget.viewModel.team; return(new CoverImage( coverImage: team.coverImage, height: imageBaseHeight + CCommonUtils.getSafeAreaTopPadding(context: context), 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() } ) ) } ) ) )); }
Widget _buildUserInfo(BuildContext context) { var user = this.widget.viewModel.user ?? new User(); Widget titleWidget; if (user.title != null && user.title.isNotEmpty()) { titleWidget = new Text( data: user.title, style: new TextStyle( fontSize: 14, fontFamily: "Roboto-Regular", color: CColors.BgGrey ), maxLines: 1, overflow: TextOverflow.ellipsis ); } else { titleWidget = new Container(); } return(new CoverImage( coverImage: user.coverImage, imageBaseHeight + CCommonUtils.getSafeAreaTopPadding(context: context), 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( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, children: new List <Widget> { new Row( crossAxisAlignment: CrossAxisAlignment.start, children: new List <Widget> { new Flexible( child: new Text( user.fullName ?? user.name, style: CTextStyle.H4White.merge( new TextStyle(height: 1)), maxLines: 1, overflow: TextOverflow.ellipsis ) ), CImageUtils.GenBadgeImage( badges: user.badges, CCommonUtils.GetUserLicense( userId: user.id, userLicenseMap: this.widget.viewModel.userLicenseDict ), EdgeInsets.only(4, 6) ) } ), 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() } ) ) } ) ) )); }
Widget _buildLoginInNavigationBar() { var user = this.widget.viewModel.userDict[key : this.widget.viewModel.user.userId]; Widget titleWidget; if (user.title != null && user.title.isNotEmpty()) { titleWidget = new Text( data: user.title, style: new TextStyle( fontSize: 14, fontFamily: "Roboto-Regular", color: CColors.BgGrey ), maxLines: 1, overflow: TextOverflow.ellipsis ); } else { titleWidget = new Container(); } var content = new Container( height: 184 + CCommonUtils.getSafeAreaTopPadding(context: this.context), padding: EdgeInsets.only(16, CCommonUtils.getSafeAreaTopPadding(context: this.context), bottom: 16), child: new Column( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: new List <Widget> { _buildQrScanWidget(), new Row( children: new List <Widget> { new Container( margin: EdgeInsets.only(right: 12), child: Avatar.User( user: user, 64, true ) ), new Expanded( child: new Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, children: new List <Widget> { new Row( crossAxisAlignment: CrossAxisAlignment.start, children: new List <Widget> { new Flexible( child: new Text( user.fullName ?? user.name, style: CTextStyle.H4White.merge(new TextStyle(height: 1)), maxLines: 1, overflow: TextOverflow.ellipsis ) ), CImageUtils.GenBadgeImage( badges: user.badges, CCommonUtils.GetUserLicense( userId: user.id, userLicenseMap: this.widget.viewModel.userLicenseDict ), EdgeInsets.only(4, 6) ) } ), titleWidget } ) ), new Container( padding: EdgeInsets.only(12, right: 16), child: new Icon( icon: Icons.chevron_right, size: 24, color: CColors.LightBlueGrey ) ) } ) } ) ); return(new GestureDetector( onTap: () => this.widget.actionModel.pushToUserDetail(obj: user.id), child: new Stack( children: new List <Widget> { Positioned.fill(new Stack( children: new List <Widget> { new Stack( children: new List <Widget> { new Container(color: new Color(0xFF212121)), new Positioned( top: 30, right: 30, child: new Icon(Icons.UnityLogo, size: 210, color: new Color(0xFF2b2b2b))) }) })), content }) )); }
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 } ) )); }
Widget _buildLoginInNavigationBar() { var user = this.widget.viewModel.userDict[key : this.widget.viewModel.user.userId]; Widget titleWidget; if (user.title != null && user.title.isNotEmpty()) { titleWidget = new Container( padding: EdgeInsets.only(top: 4), child: new Text( data: user.title, style: new TextStyle( fontSize: 14, fontFamily: "Roboto-Regular", color: CColors.Grey80 ), maxLines: 1, overflow: TextOverflow.ellipsis ) ); } else { titleWidget = new Container(); } return(new Stack( children: new List <Widget> { new Container( color: CColors.BgGrey, padding: EdgeInsets.only(bottom: 56), child: new GestureDetector( onTap: () => this.widget.actionModel.pushToUserDetail(obj: user.id), child: new Container( padding: EdgeInsets.only( top: CCommonUtils.getSafeAreaTopPadding(context: this.context)), decoration: new BoxDecoration( color: CColors.Black, new DecorationImage( new AssetImage("image/default-background-cover"), fit: BoxFit.cover ) ), child: new Column( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: new List <Widget> { this._buildQrScanWidget(true), new Container( padding: EdgeInsets.only(16, 16, 16, 64), child: new Row( children: new List <Widget> { new Container( margin: EdgeInsets.only(right: 12), child: Avatar.User( user: user, 64, 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( user.fullName ?? user.name, style: CTextStyle.H4White .defaultHeight(), maxLines: 1, overflow: TextOverflow.ellipsis ) ), CImageUtils.GenBadgeImage( badges: user.badges, CCommonUtils.GetUserLicense( userId: user.id, userLicenseMap: this.widget.viewModel .userLicenseDict ), EdgeInsets.only(4, 6) ) } ), titleWidget } ) ), new Padding( padding: EdgeInsets.symmetric(horizontal: 4), child: new Text( "个人主页", style: new TextStyle( fontSize: 14, fontFamily: "Roboto-Regular", color: CColors.Grey80 ) ) ), new Icon( icon: Icons.baseline_forward_arrow, size: 16, color: CColors.LightBlueGrey ) } ) ) } ) ) ) ), new Align( alignment: Alignment.bottomCenter, child: new Container( margin: EdgeInsets.only(16, 0, 16, 16), height: 80, decoration: new BoxDecoration( color: CColors.White, borderRadius: BorderRadius.all(8), boxShadow: new List <BoxShadow> { new BoxShadow( CColors.Black.withOpacity(0.2f), blurRadius: 8 ) } ), child: new Row( children: new List <Widget> { new Expanded( child: new CustomButton( onPressed: () => { if (this.widget.viewModel.isLoggedIn && user.id.isNotEmpty()) { this.widget.actionModel.pushToUserFollowing(arg1: user.id, 0); } }, child: new Column( mainAxisAlignment: MainAxisAlignment.center, children: new List <Widget> { new Text( CStringUtils.CountToString((user.followingUsersCount ?? 0) + (user.followingTeamsCount ?? 0), "0"), style: CTextStyle.Bold20 ), new Container(height: 4), new Text( "关注", style: CTextStyle.PSmallBody3.defaultHeight() ) } ) ) ), new Container(height: 32, width: 1, color: CColors.Separator.withOpacity(0.5f)), new Expanded( child: new CustomButton( onPressed: () => { if (this.widget.viewModel.isLoggedIn && user.id.isNotEmpty()) { this.widget.actionModel.pushToUserFollower(obj: user.id); } }, child: new Column( mainAxisAlignment: MainAxisAlignment.center, children: new List <Widget> { new Text( CStringUtils.CountToString(user.followCount ?? 0, "0"), style: CTextStyle.Bold20 ), new Container(height: 4), new Text( "粉丝", style: CTextStyle.PSmallBody3.defaultHeight() ) } ) ) ), new Container(height: 32, width: 1, color: CColors.Separator.withOpacity(0.5f)), new Expanded( child: new CustomButton( onPressed: () => { // if (this.widget.viewModel.isLoggedIn && user.id.isNotEmpty()) { // this.widget.actionModel.pushToUserLike(obj: user.id); // } }, child: new Column( mainAxisAlignment: MainAxisAlignment.center, children: new List <Widget> { new Text( CStringUtils.CountToString(user.appArticleLikedCount ?? 0, "0"), style: CTextStyle.Bold20 ), new Container(height: 4), new Text( "赞", style: CTextStyle.PSmallBody3.defaultHeight() ) } ) ) ) } ) ) ) } )); }
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) ) ) } ) )); }