public override Widget build(BuildContext context) { return(new Container( child: new Row( children: new List <Widget> { new Flexible( child: new Container( child: new Text( $"{this.fullName}", style: CTextStyle.PSmallBody3, maxLines: 1, overflow: TextOverflow.ellipsis ) ) ), new Container( child: new Text( $" · {DateConvert.DateStringFromNow(dt: this.time)}", style: CTextStyle.PSmallBody3 ) ), new Container( child: new Text( $" · 阅读 {this.viewCount}", style: CTextStyle.PSmallBody3 ) ) } ) )); }
public override Widget build(BuildContext context) { if (this.article == null) { return(new Container()); } var username = this.user == null ? this.team.name : this.user.fullName; var time = this.article.lastPublishedTime == null ? this.article.publishedTime : this.article.lastPublishedTime; var child = new Container( color: CColors.White, padding: EdgeInsets.all(16), child: new Row( children: new List <Widget> { new Expanded( child: new Container( child: new Column( mainAxisAlignment: MainAxisAlignment.spaceAround, crossAxisAlignment: CrossAxisAlignment.start, children: new List <Widget> { new Text(this.article.title, style: CTextStyle.PLargeTitle, maxLines: 2, overflow: TextOverflow.ellipsis, textAlign: TextAlign.left ), new Text( $"{username} · {DateConvert.DateStringFromNow(time)} · 阅读 {this.article.viewCount}", style: CTextStyle.PSmallBody3, textAlign: TextAlign.left ) } ) ) ), new Container( margin: EdgeInsets.only(8), width: 114, height: 76, child: new PlaceholderImage(this.article.thumbnail.url.EndsWith(".gif") ? this.article.thumbnail.url : $"{this.article.thumbnail.url}.450x0x1.jpg", 114, 76, 4, BoxFit.cover ) ) } ) ); return(new GestureDetector( onTap: this.onTap, child: child )); }
Widget _buildNotificationTime() { var createdTime = this.notification.createdTime; return(new Container( child: new Text( DateConvert.DateStringFromNow(dt: createdTime), style: CTextStyle.PSmallBody4 ) )); }
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 Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, children: new List <Widget> { new GestureDetector( onTap: () => this.pushToUserDetail(user.id), child: new Text( user.fullName ?? "", style: CTextStyle.PMediumBody ) ), new Text( $"{DateConvert.DateStringFromNow(this.eventObj.createdTime ?? DateTime.Now)}发布", style: CTextStyle.PSmallBody3 ) } ) } ) ) } ) )); }
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 ) } ) ) } ) ) } ) )); }
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) ) } ) )); }
Widget _buildContentHead() { Widget _avatar; if (this._article.ownerType == OwnerType.user.ToString()) { _avatar = Avatar.User(this._user.id, this._user, 32); } else { _avatar = 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, right: 16, top: 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 } ) } ) ) } ) )); }
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) ) } ) )); }
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 } ) )); }
public override Widget build(BuildContext context) { if (this.article == null) { return(new Container()); } var time = this.article.lastPublishedTime == null ? this.article.publishedTime : this.article.lastPublishedTime; var imageUrl = this.article.thumbnail.url.EndsWith(".gif") ? this.article.thumbnail.url : $"{this.article.thumbnail.url}.300x0x1.jpg"; var card = new Container( color: CColors.White, child: new Padding( padding: EdgeInsets.all(16), child: new Container( child: new Column( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: new List <Widget> { new Container( child: new Text(this.article.title, style: CTextStyle.H5, maxLines: 2, textAlign: TextAlign.left, overflow: TextOverflow.ellipsis ) ), new Container( margin: EdgeInsets.only(top: 8, bottom: 8), child: new Row( children: new List <Widget> { new Expanded( child: new Text(this.article.subTitle, style: CTextStyle.PRegularBody, maxLines: 3, overflow: TextOverflow.ellipsis ) ), new Container( margin: EdgeInsets.only(8.0f), width: 100, height: 66, child: new PlaceholderImage( imageUrl, 100, 66, 4, BoxFit.cover ) ) } ) ), new Container( child: new Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: new List <Widget> { new Expanded( child: new Text( $"{this.fullName} · {DateConvert.DateStringFromNow(time)} · 阅读 {this.article.viewCount}", style: CTextStyle.PSmallBody3 ) ), new CustomButton( child: new Container( height: 28, child: new Icon( Icons.ellipsis, size: 20, color: CColors.BrownGrey ) ), onPressed: this.moreCallBack ) } ) ) } ) ) ) ); return(new GestureDetector( child: card, onTap: this.onTap )); }
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) ) ) } ) )); }