void _onShare(Article article) { var linkUrl = CStringUtils.JointProjectShareLink(projectId: article.id); ShareManager.showArticleShareView( true, isLoggedIn: this.widget.viewModel.isLoggedIn, () => { Clipboard.setData(new ClipboardData(text: linkUrl)); CustomDialogUtils.showToast("复制链接成功", iconData: Icons.check_circle_outline); }, () => this.widget.actionModel.pushToLogin(), () => this.widget.actionModel.pushToBlock(obj: article.id), () => this.widget.actionModel.pushToReport(arg1: article.id, arg2: ReportType.article), type => { CustomDialogUtils.showCustomDialog( child: new CustomLoadingDialog() ); string imageUrl = CImageUtils.SizeTo200ImageUrl(article.thumbnail.url); this.widget.actionModel.shareToWechat(arg1: type, arg2: article.title, arg3: article.subTitle, arg4: linkUrl, arg5: imageUrl) .Then(onResolved: CustomDialogUtils.hiddenCustomDialog) .Catch(_ => CustomDialogUtils.hiddenCustomDialog()); } ); }
void _showShareView(IEvent eventObj) { ActionSheetUtils.showModalActionSheet( new ShareView( projectType: ProjectType.iEvent, onPressed: type => { AnalyticsManager.ClickShare(shareType: type, "Event", "Event_" + eventObj.id, title: eventObj.title); var linkUrl = $"{Config.unity_cn_url}/events/{eventObj.id}"; var path = CStringUtils.CreateMiniPath(id: eventObj.id, title: eventObj.title); if (type == ShareType.clipBoard) { this.widget.actionModel.copyText(obj: linkUrl); CustomDialogUtils.showToast("复制链接成功", iconData: Icons.check_circle_outline); } else { var imageUrl = CImageUtils.SizeTo200ImageUrl(imageUrl: eventObj.avatar); CustomDialogUtils.showCustomDialog( child: new CustomLoadingDialog() ); this.widget.actionModel.shareToWechat( arg1: type, arg2: eventObj.title, arg3: eventObj.shortDescription, arg4: linkUrl, arg5: imageUrl, arg6: path) .Then(onResolved: CustomDialogUtils.hiddenCustomDialog) .Catch(_ => CustomDialogUtils.hiddenCustomDialog()); } } ) ); }
Widget _buildArticleCard(BuildContext context, int index) { var article = this.viewModel.articleHistory[index : index]; var linkUrl = CStringUtils.JointProjectShareLink(projectId: article.id); return(CustomDismissible.builder( Key.key(value: article.id), new ArticleCard( article: article, () => this.actionModel.pushToArticleDetail(obj: article.id), () => ShareManager.showArticleShareView( true, isLoggedIn: this.viewModel.isLoggedIn, () => { Clipboard.setData(new ClipboardData(text: linkUrl)); CustomDialogUtils.showToast("复制链接成功", Icons.check_circle_outline); }, () => this.actionModel.pushToLogin(), () => this.actionModel.pushToBlock(article.id), () => this.actionModel.pushToReport(article.id, ReportType.article), type => { CustomDialogUtils.showCustomDialog( child: new CustomLoadingDialog() ); string imageUrl = CImageUtils.SizeTo200ImageUrl(article.thumbnail.url); this.actionModel.shareToWechat(arg1: type, arg2: article.title, arg3: article.subTitle, arg4: linkUrl, arg5: imageUrl) .Then(onResolved: CustomDialogUtils.hiddenCustomDialog) .Catch(_ => CustomDialogUtils.hiddenCustomDialog()); } ), fullName: article.fullName, index == 0, new ObjectKey(value: article.id) ), new CustomDismissibleDrawerDelegate(), secondaryActions: new List <Widget> { new GestureDetector( onTap: () => this.actionModel.deleteArticleHistory(obj: article.id), child: new Container( color: CColors.Separator2, width: 80, alignment: Alignment.center, child: new Container( width: 44, height: 44, alignment: Alignment.center, decoration: new BoxDecoration( CColors.White, borderRadius: BorderRadius.circular(22) ), child: new Icon(Icons.delete_outline, size: 28, color: CColors.Error) ) ) ) }, controller: this._controller )); }
Widget _buildUserCard(BuildContext context, int index) { var articleId = this.widget.viewModel.likeArticleIds[index : index]; var articleDict = this.widget.viewModel.articleDict; if (!articleDict.ContainsKey(key: articleId)) { return(new Container()); } var article = articleDict[key : articleId]; var linkUrl = CStringUtils.JointProjectShareLink(projectId: article.id); var fullName = ""; if (article.ownerType == OwnerType.user.ToString()) { if (this.widget.viewModel.userDict.ContainsKey(key: article.userId)) { fullName = this.widget.viewModel.userDict[key : article.userId].fullName ?? this.widget.viewModel.userDict[key : article.userId].name; } } if (article.ownerType == OwnerType.team.ToString()) { if (this.widget.viewModel.teamDict.ContainsKey(key: article.teamId)) { fullName = this.widget.viewModel.teamDict[key : article.teamId].name; } } return(new ArticleCard( article: article, () => this.widget.actionModel.pushToArticleDetail(obj: article.id), () => ShareManager.showArticleShareView( false, isLoggedIn: this.widget.viewModel.isLoggedIn, () => { Clipboard.setData(new ClipboardData(text: linkUrl)); CustomDialogUtils.showToast("复制链接成功", iconData: Icons.check_circle_outline); }, () => this.widget.actionModel.pushToLogin(), () => this.widget.actionModel.pushToBlock(obj: article.id), () => this.widget.actionModel.pushToReport(obj: article.id), type => { CustomDialogUtils.showCustomDialog( child: new CustomLoadingDialog() ); string imageUrl = CImageUtils.SizeTo200ImageUrl(imageUrl: article.thumbnail.url); this.widget.actionModel.shareToWechat(arg1: type, arg2: article.title, arg3: article.subTitle, arg4: linkUrl, arg5: imageUrl) .Then(onResolved: CustomDialogUtils.hiddenCustomDialog) .Catch(_ => CustomDialogUtils.hiddenCustomDialog()); } ), fullName: fullName, new ObjectKey(value: article.id) )); }
Widget _buildArticleCard(BuildContext context, int index) { var article = this.viewModel.articleHistory[index : index]; var linkUrl = CStringUtils.JointProjectShareLink(projectId: article.id); return(CustomDismissible.builder( Key.key(value: article.id), new ArticleCard( article: article, () => this.actionModel.pushToArticleDetail(obj: article.id), () => ShareManager.showArticleShareView( true, isLoggedIn: this.viewModel.isLoggedIn, () => { Clipboard.setData(new ClipboardData(text: linkUrl)); CustomDialogUtils.showToast("复制链接成功", iconData: Icons.check_circle_outline); }, () => this.actionModel.pushToLogin(), () => this.actionModel.pushToBlock(obj: article.id), () => this.actionModel.pushToReport(arg1: article.id, arg2: ReportType.article), type => { CustomDialogUtils.showCustomDialog( child: new CustomLoadingDialog() ); string imageUrl = CImageUtils.SizeTo200ImageUrl(imageUrl: article.thumbnail.url); this.actionModel.shareToWechat(arg1: type, arg2: article.title, arg3: article.subTitle, arg4: linkUrl, arg5: imageUrl) .Then(onResolved: CustomDialogUtils.hiddenCustomDialog) .Catch(_ => CustomDialogUtils.hiddenCustomDialog()); } ), fullName: article.fullName, new ObjectKey(value: article.id) ), new CustomDismissibleDrawerDelegate(), secondaryActions: new List <Widget> { new DeleteActionButton( 80, onTap: () => this.actionModel.deleteArticleHistory(obj: article.id) ) }, controller: this._controller )); }
Widget _buildShareWidget(RankData game) { return(new CustomButton( onPressed: () => ActionSheetUtils.showModalActionSheet( new ShareView( projectType: ProjectType.iEvent, onPressed: type => { // AnalyticsManager.ClickShare(type, "Event", "Event_" + eventObj.id, eventObj.title); var linkUrl = CStringUtils.JointTinyGameShareLink(gameId: game.id);; if (type == ShareType.clipBoard) { this.widget.actionModel.copyText(obj: linkUrl); CustomDialogUtils.showToast("复制链接成功", iconData: Icons.check_circle_outline); } else { var imageUrl = CImageUtils.SizeTo200ImageUrl(imageUrl: game.image); CustomDialogUtils.showCustomDialog( child: new CustomLoadingDialog() ); this.widget.actionModel.shareToWechat( arg1: type, arg2: game.resetTitle, arg3: game.resetSubLabel, arg4: linkUrl, arg5: imageUrl , null) .Then(onResolved: CustomDialogUtils.hiddenCustomDialog) .Catch(_ => CustomDialogUtils.hiddenCustomDialog()); } } ) ), child: new Container( color: CColors.Transparent, child: new Icon( icon: Icons.outline_share, size: 24, color: CColors.Icon ) ) )); }
void _share(Article article) { ActionSheetUtils.showModalActionSheet(new ShareView( projectType: ProjectType.article, onPressed: type => { var linkUrl = CStringUtils.JointProjectShareLink(projectId: article.id); if (type == ShareType.clipBoard) { Clipboard.setData(new ClipboardData(text: linkUrl)); CustomDialogUtils.showToast("复制链接成功", iconData: Icons.check_circle_outline); } else if (type == ShareType.block) { ReportManager.block( isLoggedIn: this.widget.viewModel.isLoggedIn, () => this.widget.actionModel.pushToLogin(), () => this.widget.actionModel.pushToBlock(article.id), () => this.widget.actionModel.mainRouterPop() ); } else if (type == ShareType.report) { ReportManager.report( isLoggedIn: this.widget.viewModel.isLoggedIn, () => this.widget.actionModel.pushToLogin(), () => this.widget.actionModel.pushToReport(arg1: article.id, arg2: ReportType.article) ); } else { CustomDialogUtils.showCustomDialog( child: new CustomLoadingDialog() ); string imageUrl = CImageUtils.SizeTo200ImageUrl(article.thumbnail.url); this.widget.actionModel.shareToWechat(type, article.title, article.subTitle, linkUrl, imageUrl).Then(CustomDialogUtils.hiddenCustomDialog) .Catch(_ => CustomDialogUtils.hiddenCustomDialog()); } } )); }
void share() { var userId = ""; if (this._article.ownerType == OwnerType.user.ToString()) { userId = this._article.userId; } if (this._article.ownerType == OwnerType.team.ToString()) { userId = this._article.teamId; } var linkUrl = CStringUtils.JointProjectShareLink(projectId: this._article.id); ShareManager.showArticleShareView( this.widget.viewModel.loginUserId != userId, isLoggedIn: this.widget.viewModel.isLoggedIn, () => { Clipboard.setData(new ClipboardData(text: linkUrl)); CustomDialogUtils.showToast("复制链接成功", Icons.check_circle_outline); }, () => this.widget.actionModel.pushToLogin(), () => this.widget.actionModel.pushToBlock(this._article.id), () => this.widget.actionModel.pushToReport(this._article.id, ReportType.article), type => { CustomDialogUtils.showCustomDialog( child: new CustomLoadingDialog() ); string imageUrl = CImageUtils.SizeTo200ImageUrl(this._article.thumbnail.url); this.widget.actionModel.shareToWechat(arg1: type, arg2: this._article.title, arg3: this._article.subTitle, arg4: linkUrl, arg5: imageUrl) .Then(onResolved: CustomDialogUtils.hiddenCustomDialog) .Catch(_ => CustomDialogUtils.hiddenCustomDialog()); }, () => this.widget.actionModel.mainRouterPop() ); }
Widget _buildHeadTop(IEvent eventObj, BuildContext context) { Widget shareWidget = new CustomButton( onPressed: () => ActionSheetUtils.showModalActionSheet(new ShareView( projectType: ProjectType.iEvent, onPressed: type => { AnalyticsManager.ClickShare(type, "Event", "Event_" + eventObj.id, eventObj.title); var linkUrl = CStringUtils.JointEventShareLink(eventId: eventObj.id); if (type == ShareType.clipBoard) { this.widget.actionModel.copyText(linkUrl); CustomDialogUtils.showToast("复制链接成功", Icons.check_circle_outline); } else { var imageUrl = CImageUtils.SizeTo200ImageUrl(eventObj.avatar); CustomDialogUtils.showCustomDialog( child: new CustomLoadingDialog() ); this.widget.actionModel.shareToWechat(type, eventObj.title, eventObj.shortDescription, linkUrl, imageUrl, null).Then(CustomDialogUtils.hiddenCustomDialog) .Catch(_ => CustomDialogUtils.hiddenCustomDialog()); } })), child: new Container( color: CColors.Transparent, child: new Icon(Icons.share, size: 24, color: this._showNavBarShadow ? CColors.White : CColors.Icon)) ); Widget titleWidget = new Container(); if (this._isHaveTitle) { titleWidget = new Text( eventObj.title, style: CTextStyle.PXLargeMedium, maxLines: 1, overflow: TextOverflow.ellipsis, textAlign: TextAlign.center ); } return(new AnimatedContainer( height: 44 + CCommonUtils.getSafeAreaTopPadding(context: context), duration: TimeSpan.Zero, padding: EdgeInsets.only(8, right: 8, top: CCommonUtils.getSafeAreaTopPadding(context: context)), decoration: new BoxDecoration( CColors.White, border: new Border( bottom: new BorderSide(this._isHaveTitle ? CColors.Separator2 : CColors.Transparent)), gradient: this._showNavBarShadow ? new LinearGradient( colors: new List <Color> { new Color(0x80000000), new Color(0x0) }, begin: Alignment.topCenter, end: Alignment.bottomCenter ) : null ), child: new Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: new List <Widget> { new CustomButton( onPressed: () => this.widget.actionModel.mainRouterPop(), child: new Icon( Icons.arrow_back, size: 24, color: this._showNavBarShadow ? CColors.White : CColors.Icon ) ), new Expanded( child: new Stack( fit: StackFit.expand, children: new List <Widget> { new PositionedTransition( rect: this._animation, child: titleWidget ) } ) ), shareWidget } ) )); }
Widget _buildArticleCard(int index) { var articleId = this.widget.viewModel.favoriteDetailArticleIds[index : index]; var articleDict = this.widget.viewModel.articleDict; if (!articleDict.ContainsKey(key: articleId)) { return(new Container()); } var article = articleDict[key : articleId]; var linkUrl = CStringUtils.JointProjectShareLink(projectId: article.id); var fullName = ""; if (article.ownerType == OwnerType.user.ToString()) { if (this.widget.viewModel.userDict.ContainsKey(key: article.userId)) { fullName = this.widget.viewModel.userDict[key : article.userId].fullName ?? this.widget.viewModel.userDict[key : article.userId].name; } } if (article.ownerType == OwnerType.team.ToString()) { if (this.widget.viewModel.teamDict.ContainsKey(key: article.teamId)) { fullName = this.widget.viewModel.teamDict[key : article.teamId].name; } } return(CustomDismissible.builder( Key.key(value: article.id), new ArticleCard( article: article, () => this.widget.actionModel.pushToArticleDetail(obj: article.id), () => ShareManager.showArticleShareView( false, isLoggedIn: this.widget.viewModel.isLoggedIn, () => { Clipboard.setData(new ClipboardData(text: linkUrl)); CustomDialogUtils.showToast("复制链接成功", iconData: Icons.check_circle_outline); }, () => this.widget.actionModel.pushToLogin(), () => this.widget.actionModel.pushToBlock(obj: article.id), () => this.widget.actionModel.pushToReport(obj: article.id), type => { CustomDialogUtils.showCustomDialog( child: new CustomLoadingDialog() ); string imageUrl = CImageUtils.SizeTo200ImageUrl(imageUrl: article.thumbnail.url); this.widget.actionModel.shareToWechat(arg1: type, arg2: article.title, arg3: article.subTitle, arg4: linkUrl, arg5: imageUrl) .Then(onResolved: CustomDialogUtils.hiddenCustomDialog) .Catch(_ => CustomDialogUtils.hiddenCustomDialog()); } ), fullName: fullName, key: new ObjectKey(value: article.id) ), new CustomDismissibleDrawerDelegate(), secondaryActions: new List <Widget> { new DeleteActionButton( 80, onTap: () => { ActionSheetUtils.showModalActionSheet( new ActionSheet( title: "确定不再收藏?", items: new List <ActionSheetItem> { new ActionSheetItem( "确定", type: ActionType.normal, () => { this.widget.actionModel.unFavoriteArticle(arg1: article.id, arg2: article.favorite.id); } ), new ActionSheetItem("取消", type: ActionType.cancel) } ) ); } ) }, controller: this._dismissibleController )); }
Widget _buildArticleList(BuildContext context) { Widget content; var recommendArticleIds = this.widget.viewModel.recommendArticleIds; if (!this._hasBeenLoadedData || this.widget.viewModel.articlesLoading && recommendArticleIds.isEmpty()) { content = ListView.builder( physics: new NeverScrollableScrollPhysics(), itemCount: 6, itemBuilder: (cxt, index) => new ArticleLoading() ); } else if (0 == recommendArticleIds.Count) { content = new Container( padding: EdgeInsets.only(bottom: CConstant.TabBarHeight + CCommonUtils.getSafeAreaBottomPadding(context: context)), child: new BlankView( "哎呀,暂无推荐文章", "image/default-article", true, () => { this.widget.actionModel.startFetchArticles(); this.widget.actionModel.fetchArticles(arg: initOffset); } ) ); } else { content = new SmartRefresher( controller: this._refreshController, enablePullDown: true, enablePullUp: this.widget.viewModel.hottestHasMore, onRefresh: this._onRefresh, hasBottomMargin: true, child: ListView.builder( physics: new AlwaysScrollableScrollPhysics(), itemCount: recommendArticleIds.Count, itemBuilder: (cxt, index) => { var articleId = recommendArticleIds[index: index]; if (this.widget.viewModel.blockArticleList.Contains(item: articleId)) { return(new Container()); } if (!this.widget.viewModel.articleDict.ContainsKey(key: articleId)) { return(new Container()); } if (!this.widget.viewModel.hottestHasMore && recommendArticleIds.Count > 0 && index + 1 == recommendArticleIds.Count) { return(new EndView(hasBottomMargin: true)); } var article = this.widget.viewModel.articleDict[key: articleId]; var fullName = ""; var userId = ""; if (article.ownerType == OwnerType.user.ToString()) { userId = article.userId; if (this.widget.viewModel.userDict.ContainsKey(key: article.userId)) { fullName = this.widget.viewModel.userDict[key: article.userId].fullName ?? this.widget.viewModel.userDict[key: article.userId].name; } } if (article.ownerType == OwnerType.team.ToString()) { userId = article.teamId; if (this.widget.viewModel.teamDict.ContainsKey(key: article.teamId)) { fullName = this.widget.viewModel.teamDict[key: article.teamId].name; } } var linkUrl = CStringUtils.JointProjectShareLink(projectId: article.id); return(new ArticleCard( article: article, () => { this.widget.actionModel.pushToArticleDetail(obj: articleId); AnalyticsManager.ClickEnterArticleDetail("Home_Article", articleId: article.id, articleTitle: article.title); }, () => ShareManager.showArticleShareView( this.widget.viewModel.currentUserId != userId, isLoggedIn: this.widget.viewModel.isLoggedIn, () => { Clipboard.setData(new ClipboardData(text: linkUrl)); CustomDialogUtils.showToast("复制链接成功", iconData: Icons.check_circle_outline); }, () => this.widget.actionModel.pushToLogin(), () => this.widget.actionModel.pushToBlock(obj: article.id), () => this.widget.actionModel.pushToReport(arg1: article.id, arg2: ReportType.article), type => { CustomDialogUtils.showCustomDialog( child: new CustomLoadingDialog() ); string imageUrl = CImageUtils.SizeTo200ImageUrl(article.thumbnail.url); this.widget.actionModel.shareToWechat(arg1: type, arg2: article.title, arg3: article.subTitle, arg4: linkUrl, arg5: imageUrl) .Then(onResolved: CustomDialogUtils.hiddenCustomDialog) .Catch(_ => CustomDialogUtils.hiddenCustomDialog()); } ), fullName: fullName, key: new ObjectKey(value: article.id) )); } ) ); } if (this.widget.viewModel.isLoggedIn) { return(new Container( color: CColors.Background, child: new CustomScrollbar(child: content) )); } return(new NotificationListener <ScrollNotification>( onNotification: this._onNotification, child: new Container( color: CColors.Background, child: new CustomScrollbar(child: content) ) )); }
Widget _buildUserContent(BuildContext context) { var articleIds = this.widget.viewModel.user.articleIds; var favoriteIds = this.widget.viewModel.favoriteTagIdDict.ContainsKey(key: this.widget.viewModel.user.id) ? this.widget.viewModel.favoriteTagIdDict[key : this.widget.viewModel.user.id] : null; var articlesHasMore = this.widget.viewModel.user.articlesHasMore ?? false; var userFavoriteHasMore = this.widget.viewModel.userFavoriteHasMore; var userArticleLoading = this.widget.viewModel.userArticleLoading && articleIds == null; var userFavoriteLoading = this.widget.viewModel.userFavoriteLoading && favoriteIds == null; int itemCount; if (userArticleLoading && this._selectedIndex == 0) { itemCount = 3; } else if (userFavoriteLoading && this._selectedIndex == 1) { itemCount = 3; } else { if (articleIds == null && this._selectedIndex == 0) { itemCount = 3; } else if (favoriteIds == null && this._selectedIndex == 1) { itemCount = 3; } else { if (this._selectedIndex == 0) { var articleCount = articlesHasMore ? articleIds.Count : articleIds.Count + 1; itemCount = 2 + (articleIds.Count == 0 ? 1 : articleCount); } else { var favoriteCount = userFavoriteHasMore ? favoriteIds.Count : favoriteIds.Count + 1; itemCount = 2 + (favoriteIds.Count == 0 ? 1 : favoriteCount); } } } var headerHeight = imageBaseHeight + 44 + CCommonUtils.getSafeAreaTopPadding(context: context); return(new Container( color: CColors.Background, child: new CustomScrollbar( new SmartRefresher( controller: this._refreshController, enablePullDown: false, enablePullUp: this._selectedIndex == 0 ? articlesHasMore : userFavoriteHasMore, onRefresh: this._onRefresh, onNotification: this._onNotification, child: ListView.builder( physics: new AlwaysScrollableScrollPhysics(), itemCount: itemCount, itemBuilder: (cxt, index) => { if (index == 0) { return Transform.scale( scale: this._factor, child: this._buildUserInfo(context) ); } if (index == 1) { return this._buildUserArticleTitle(); } if (userArticleLoading && index == 2 && this._selectedIndex == 0) { var height = MediaQuery.of(context: context).size.height - headerHeight; return new Container( height: height, child: new GlobalLoading() ); } if (userFavoriteLoading && index == 2 && this._selectedIndex == 1) { var height = MediaQuery.of(context: context).size.height - headerHeight; return new Container( height: height, child: new GlobalLoading() ); } if ((articleIds == null || articleIds.Count == 0) && index == 2 && this._selectedIndex == 0) { var height = MediaQuery.of(context: context).size.height - headerHeight; return new Container( height: height, child: new BlankView( "哎呀,暂无已发布的文章", "image/default-article" ) ); } if ((favoriteIds == null || favoriteIds.Count == 0) && index == 2 && this._selectedIndex == 1) { var height = MediaQuery.of(context: context).size.height - headerHeight; return new Container( height: height, child: new BlankView( "哎呀,暂无已收藏的文章", "image/default-article" ) ); } if (index == itemCount - 1 && !articlesHasMore && this._selectedIndex == 0) { return new EndView(); } if (index == itemCount - 1 && !userFavoriteHasMore && this._selectedIndex == 1) { return new EndView(); } if (this._selectedIndex == 1) { var favoriteId = favoriteIds[index - 2]; return this._buildFavoriteCard(favoriteId: favoriteId); } var articleId = articleIds[index - 2]; if (!this.widget.viewModel.articleDict.ContainsKey(key: articleId)) { return new Container(); } var article = this.widget.viewModel.articleDict[key: articleId]; var linkUrl = CStringUtils.JointProjectShareLink(projectId: article.id); var fullName = ""; if (article.ownerType == OwnerType.user.ToString()) { if (this.widget.viewModel.userDict.ContainsKey(key: article.userId)) { fullName = this.widget.viewModel.userDict[key: article.userId].fullName ?? this.widget.viewModel.userDict[key: article.userId].name; } } if (article.ownerType == OwnerType.team.ToString()) { if (this.widget.viewModel.teamDict.ContainsKey(key: article.teamId)) { fullName = this.widget.viewModel.teamDict[key: article.teamId].name; } } return new ArticleCard( article: article, () => this.widget.actionModel.pushToArticleDetail(obj: article.id), () => ShareManager.showArticleShareView( this.widget.viewModel.currentUserId != article.userId, isLoggedIn: this.widget.viewModel.isLoggedIn, () => { Clipboard.setData(new ClipboardData(text: linkUrl)); CustomDialogUtils.showToast("复制链接成功", Icons.check_circle_outline); }, () => this.widget.actionModel.pushToLogin(), () => this.widget.actionModel.pushToBlock(article.id), () => this.widget.actionModel.pushToReport(article.id, ReportType.article), type => { CustomDialogUtils.showCustomDialog( child: new CustomLoadingDialog() ); string imageUrl = CImageUtils.SizeTo200ImageUrl(article.thumbnail.url); this.widget.actionModel.shareToWechat(arg1: type, arg2: article.title, arg3: article.subTitle, arg4: linkUrl, arg5: imageUrl) .Then(onResolved: CustomDialogUtils.hiddenCustomDialog) .Catch(_ => CustomDialogUtils.hiddenCustomDialog()); }, () => this.widget.actionModel.mainRouterPop() ), fullName, key: new ObjectKey(value: article.id) ); } ) ) ) )); }
Widget _buildAlbumCard(BuildContext context, int index) { if (index == 0) { if (this.widget.viewModel.loading) { return(new Container( height: MediaQuery.of(context).size.height - 202 - MediaQuery.of(context).padding.top, child: new Center( child: new GlobalLoading(color: CColors.White) ) )); } if (this.widget.viewModel.articleList.isEmpty()) { return(new Container( height: MediaQuery.of(context).size.height - 202 - MediaQuery.of(context).padding.top, child: new BlankView( "暂无文章", "image/default-article", true, () => { this.widget.actionModel.startFetchDetailList(); this.widget.actionModel.fetchDetailList(this._pageNumber); }, new BoxDecoration( color: CColors.White, borderRadius: BorderRadius.only(12, 12) )) )); } return(new Container( height: 16, decoration: new BoxDecoration(color: CColors.White, borderRadius: BorderRadius.only(12, 12)) )); } var article = this.widget.viewModel.articleDict[this.widget.viewModel.articleList[index - 1]]; if (!this.widget.viewModel.articleDict.ContainsKey(key: article.id)) { return(new Container()); } var fullName = ""; var userId = ""; if (article.ownerType == OwnerType.user.ToString()) { userId = article.userId; if (this.widget.viewModel.userDict.ContainsKey(key: article.userId)) { fullName = this.widget.viewModel.userDict[key : article.userId].fullName ?? this.widget.viewModel.userDict[key : article.userId].name; } } if (article.ownerType == OwnerType.team.ToString()) { userId = article.teamId; if (this.widget.viewModel.teamDict.ContainsKey(key: article.teamId)) { fullName = this.widget.viewModel.teamDict[key : article.teamId].name; } } var linkUrl = CStringUtils.JointProjectShareLink(projectId: article.id); return(new ArticleCard( article: article, () => { this.widget.actionModel.pushToArticleDetail(obj: article.id); AnalyticsManager.ClickEnterArticleDetail("Home_Article", articleId: article.id, articleTitle: article.title); }, () => ShareManager.showArticleShareView( false, isLoggedIn: this.widget.viewModel.isLoggedIn, () => { Clipboard.setData(new ClipboardData(text: linkUrl)); CustomDialogUtils.showToast("复制链接成功", iconData: Icons.check_circle_outline); }, () => this.widget.actionModel.pushToLogin(), () => this.widget.actionModel.pushToBlock(obj: article.id), () => this.widget.actionModel.pushToReport(arg1: article.id, arg2: ReportType.article), type => { CustomDialogUtils.showCustomDialog( child: new CustomLoadingDialog() ); string imageUrl = CImageUtils.SizeTo200ImageUrl(imageUrl: article.thumbnail.url); this.widget.actionModel.shareToWechat(arg1: type, arg2: article.title, arg3: article.subTitle, arg4: linkUrl, arg5: imageUrl) .Then(onResolved: CustomDialogUtils.hiddenCustomDialog) .Catch(_ => CustomDialogUtils.hiddenCustomDialog()); } ), fullName: fullName, new ObjectKey(value: article.id) )); }
Widget _buildArticleCard(string articleId) { if (this.widget.viewModel.blockArticleList.Contains(item: articleId)) { return(new Container()); } if (!this.widget.viewModel.articleDict.ContainsKey(key: articleId)) { return(new Container()); } var article = this.widget.viewModel.articleDict[key: articleId]; var fullName = ""; var userId = ""; if (article.ownerType == OwnerType.user.ToString()) { userId = article.userId; if (this.widget.viewModel.userDict.ContainsKey(key: article.userId)) { fullName = this.widget.viewModel.userDict[key : article.userId].fullName ?? this.widget.viewModel.userDict[key : article.userId].name; } } if (article.ownerType == OwnerType.team.ToString()) { userId = article.teamId; if (this.widget.viewModel.teamDict.ContainsKey(key: article.teamId)) { fullName = this.widget.viewModel.teamDict[key : article.teamId].name; } } var linkUrl = CStringUtils.JointProjectShareLink(projectId: article.id); return(new ArticleCard( article: article, () => { this.widget.actionModel.pushToArticleDetail(obj: articleId); AnalyticsManager.ClickEnterArticleDetail("Home_Article", articleId: article.id, articleTitle: article.title); }, () => ShareManager.showArticleShareView( this.widget.viewModel.currentUserId != userId, isLoggedIn: this.widget.viewModel.isLoggedIn, () => { Clipboard.setData(new ClipboardData(text: linkUrl)); CustomDialogUtils.showToast("复制链接成功", iconData: Icons.check_circle_outline); }, () => this.widget.actionModel.pushToLogin(), () => this.widget.actionModel.pushToBlock(obj: article.id), () => this.widget.actionModel.pushToReport(arg1: article.id, arg2: ReportType.article), type => { CustomDialogUtils.showCustomDialog( child: new CustomLoadingDialog() ); string imageUrl = CImageUtils.SizeTo200ImageUrl(imageUrl: article.thumbnail.url); this.widget.actionModel.shareToWechat(arg1: type, arg2: article.title, arg3: article.subTitle, arg4: linkUrl, arg5: imageUrl) .Then(onResolved: CustomDialogUtils.hiddenCustomDialog) .Catch(_ => CustomDialogUtils.hiddenCustomDialog()); } ), fullName: fullName, new ObjectKey(value: article.id) )); }