public override Widget build(BuildContext context) { if (this._topPadding != MediaQuery.of(context).padding.top&& Application.platform != RuntimePlatform.Android) { this._topPadding = MediaQuery.of(context).padding.top; } Widget content; if (this.widget.viewModel.userLoading && this.widget.viewModel.user == null) { content = new GlobalLoading(); } else if (this.widget.viewModel.user == null || this.widget.viewModel.user.errorCode == "ResourceNotFound") { content = new BlankView( "用户不存在", "image/default-following" ); } else { content = this._buildUserContent(context: context); } return(new Container( color: CColors.White, child: new CustomSafeArea( top: false, bottom: false, child: new Stack( children: new List <Widget> { content, this._buildNavigationBar(), new Positioned( left: 0, top: 44 + this._topPadding, right: 0, child: new Offstage( offstage: !this._isShowTop, child: this._buildUserArticleTitle() ) ) } ) ) )); }
public override Widget build(BuildContext context) { var members = this.widget.viewModel.members; Widget content; if (this.widget.viewModel.memberLoading && members.isEmpty()) { content = new GlobalLoading(); } else if (members.Count <= 0) { content = new BlankView( "暂无更多公司成员", "image/default-following" ); } else { var enablePullUp = this.widget.viewModel.membersHasMore; content = new CustomListView( controller: this._refreshController, enablePullDown: true, enablePullUp: enablePullUp, onRefresh: this._onRefresh, itemCount: members.Count, itemBuilder: this._buildMemberCard, footerWidget: enablePullUp ? null : CustomListViewConstant.defaultFooterWidget ); } return(new Container( color: CColors.White, child: new CustomSafeArea( bottom: false, child: new Container( color: CColors.Background, child: new Column( children: new List <Widget> { this._buildNavigationBar(), new Expanded( child: content ) } ) ) ) )); }
public override Widget build(BuildContext context) { var gameIds = this.widget.viewModel.gameIds; Widget content; if (this.widget.viewModel.gameLoading && gameIds.isEmpty()) { content = new GlobalLoading(); } else if (gameIds.Count <= 0) { content = new BlankView( "暂无游戏", "image/default-article", true, () => { this.widget.actionModel.startFetchGame(); this.widget.actionModel.fetchGame(arg: firstPageNumber); } ); } else { var enablePullUp = this.widget.viewModel.gameHasMore; content = new CustomListView( controller: this._refreshController, enablePullDown: true, enablePullUp: enablePullUp, onRefresh: this._onRefresh, itemCount: gameIds.Count, itemBuilder: this._buildGameCard, footerWidget: enablePullUp ? null : CustomListViewConstant.defaultFooterWidget ); } return new Container( color: CColors.White, child: new CustomSafeArea( bottom: false, child: new Container( color: CColors.Background, child: new Column( children: new List<Widget> { this._buildNavigationBar(), new Expanded( child: content ) } ) ) ) ); }
public void EnPassantTest() { ChessBoard b = CreateBoardWithPositions( Pos("a5"), ChessPieceType.Pawn, 1, Pos("e1"), ChessPieceType.King, 1, Pos("b7"), ChessPieceType.Pawn, 2, Pos("e8"), ChessPieceType.King, 2); ApplyMove(b, Move("e1", "e2")); // move black pawn forward twice ApplyMove(b, Move("b7", "b5")); var possMoves = b.GetPossibleMoves() as IEnumerable <ChessMove>; var enPassantExpected = GetMovesAtPosition(possMoves, Pos("a5")); enPassantExpected.Should().HaveCount(2, "pawn can move forward one or en passant").And .Contain(Move("a5", "a6")).And.Contain(Move("a5", "b6")); // Apply the en passant ApplyMove(b, Move("a5", "b6")); BlankView.PrintView(Console.Out, b); var pawn = b.GetPieceAtPosition(Pos("b6")); pawn.Player.Should().Be(1, "pawn performed en passant move"); pawn.PieceType.Should().Be(ChessPieceType.Pawn); var captured = b.GetPieceAtPosition(Pos("b5")); captured.Player.Should().Be(0, "the pawn that moved to b5 was captured by en passant"); b.Value.Should().Be(1); GetAllPiecesForPlayer(b, 1).Should().HaveCount(2, "white controls a pawn and king"); GetAllPiecesForPlayer(b, 2).Should().HaveCount(1, "black only controls a king"); // Undo the move and check the board state b.UndoLastMove(); b.Value.Should().Be(0); pawn = b.GetPieceAtPosition(Pos("a5")); pawn.Player.Should().Be(1); captured = b.GetPieceAtPosition(Pos("b5")); captured.Player.Should().Be(2); var empty = b.GetPieceAtPosition(Pos("b6")); empty.Player.Should().Be(0); GetAllPiecesForPlayer(b, 1).Should().HaveCount(2, "white controls a pawn and king"); GetAllPiecesForPlayer(b, 2).Should().HaveCount(2, "black controls a pawn and king"); }
public override Widget build(BuildContext context) { var favoriteTag = this.widget.viewModel.favoriteTag; Widget content; if (this.widget.viewModel.favoriteDetailLoading && favoriteTag == null) { content = new GlobalLoading(); } else if (favoriteTag == null) { content = new BlankView( "暂无我的收藏详情", "image/default-following", true, () => { this.widget.actionModel.startFetchFavoriteDetail(); this.widget.actionModel.fetchFavoriteDetail(arg1: this.widget.viewModel.tagId, 0); } ); } else { content = new NotificationListener <ScrollNotification>( child: this._buildFavoriteContent(), onNotification: this._onNotification ); } return(new Container( color: CColors.White, child: new CustomSafeArea( bottom: false, child: new Column( children: new List <Widget> { this._buildNavigationBar(), new Expanded( child: content ) } ) ) )); }
public override Widget build(BuildContext context) { base.build(context: context); var myFavorites = this.widget.viewModel.myFavoriteIds; Widget content; if (this.widget.viewModel.myFavoriteLoading && myFavorites.isEmpty()) { content = new GlobalLoading(); } else if (myFavorites.Count <= 0) { content = new BlankView( "暂无我的收藏列表", "image/default-following", true, () => { this.widget.actionModel.startFetchMyFavorite(); this.widget.actionModel.fetchMyFavorite(0); } ); } else { var enablePullUp = this.widget.viewModel.myFavoriteHasMore; content = new Container( color: CColors.Background, child: new CustomListView( controller: this._refreshController, enablePullDown: true, enablePullUp: enablePullUp, onRefresh: this._onRefresh, itemCount: myFavorites.Count, itemBuilder: this._buildFavoriteCard, footerWidget: enablePullUp ? null : CustomListViewConstant.defaultFooterWidget ) ); } return(new Container( color: CColors.White, child: content )); }
public override Widget build(BuildContext context) { Widget content; if (this.widget.viewModel.userLoading && this.widget.viewModel.user == null) { content = new GlobalLoading(); } else if (this.widget.viewModel.user == null || this.widget.viewModel.user.errorCode == "ResourceNotFound") { content = new BlankView( "用户不存在", "image/default-following" ); } else { content = this._buildUserContent(context: context); } return(new Container( color: CColors.White, child: new CustomSafeArea( top: false, bottom: false, child: new Stack( children: new List <Widget> { content, this._buildNavigationBar(context: context), new Positioned( left: 0, top: navBarHeight + CCommonUtils.getSafeAreaTopPadding(context: context), right: 0, child: new Offstage( offstage: !this._isShowTop, child: this._buildUserArticleTitle() ) ) } ) ) )); }
public override Widget build(BuildContext context) { var game = this.widget.viewModel.game; Widget content; if (this.widget.viewModel.gameDetailLoading && game == null) { content = new GlobalLoading(); } else if (game == null) { content = new BlankView( "暂无该游戏", "image/default-article" ); } else { content = ListView.builder( itemCount: 3, itemBuilder: this._buildGameItem ); } return(new Container( color: CColors.White, child: new CustomSafeArea( bottom: false, child: new Container( color: CColors.White, child: new Column( children: new List <Widget> { this._buildNavigationBar(), new Expanded( child: content ) } ) ) ) )); }
public void Castling4() { ChessBoard b = CreateBoardWithPositions( Pos("e8"), ChessPieceType.King, 2, Pos("e1"), ChessPieceType.King, 1, Pos("h1"), ChessPieceType.RookKing, 1); //create a board with possible castling position ApplyMove(b, Move("e1", "g1")); //castling king normally cant move this way ApplyMove(b, Move("e8", "e7")); var poss = b.GetPossibleMoves() as IEnumerable <ChessMove>; //var possible = b.GetPossibleMoves(); // possible.Should().BeEmpty(); var Rooking = GetMovesAtPosition(poss, Pos("f1")); Rooking.Should().HaveCount(12, "After Castling"); // BlankView.PrintView(Console.Out, b); //view the board to see the castling var King = b.GetPieceAtPosition(Pos("g1")); //king should position at g1 var RookKing = b.GetPieceAtPosition(Pos("f1")); // rook should position at f1 King.Player.Should().Be(1, "King Castling"); //verify player of the castling king RookKing.Player.Should().Be(1, "RookKing Castling"); //verify player of the castling rook King.PieceType.Should().Be(ChessPieceType.King); RookKing.PieceType.Should().Be(ChessPieceType.RookKing); b.UndoLastMove(); // undo twice undo kings move b.UndoLastMove(); //undo castling King = b.GetPieceAtPosition(Pos("e1")); King.Player.Should().Be(1); RookKing = b.GetPieceAtPosition(Pos("h1")); RookKing.Player.Should().Be(1); GetAllPiecesForPlayer(b, 1).Should().HaveCount(2, "white controls a King and RookKing"); GetAllPiecesForPlayer(b, 2).Should().HaveCount(1, "black controls a King"); }
public override Widget build(BuildContext context) { Widget content; var followingTeams = this.widget.viewModel.followingTeams; if (this.widget.viewModel.followingTeamLoading && followingTeams.isEmpty()) { content = new GlobalLoading(); } else if (followingTeams.Count <= 0) { content = new BlankView( "没有关注的公司,去首页看看吧", "image/default-following" ); } else { var enablePullUp = this.widget.viewModel.followingTeamsHasMore; var itemCount = enablePullUp ? followingTeams.Count + 1 : followingTeams.Count + 2; content = new CustomScrollbar( new SmartRefresher( controller: this._refreshController, enablePullDown: true, enablePullUp: enablePullUp, onRefresh: this._onRefresh, child: ListView.builder( physics: new AlwaysScrollableScrollPhysics(), itemCount: itemCount, itemBuilder: this._buildTeamCard ) ) ); } return(new Container( color: CColors.Background, child: content )); }
public void CastlingTest7() { ChessBoard b = CreateBoardWithPositions( Pos("e1"), ChessPieceType.King, 1, Pos("a1"), ChessPieceType.RookQueen, 1); var possMoves = b.GetPossibleMoves() as IEnumerable <ChessMove>; var castlingExpected = GetMovesAtPosition(possMoves, Pos("e1")); castlingExpected.Should().HaveCount(6, "king can move (1) left, (2) right, (3) up, (4) diagonal left, (5) diagonal right, or (6) castling") .And.Contain(Move("e1", "d1")) .And.Contain(Move("e1", "f1")) .And.Contain(Move("e1", "e2")) .And.Contain(Move("e1", "d2")) .And.Contain(Move("e1", "f2")) .And.Contain(Move("e1", "c1")); // Apply the castling ApplyMove(b, Move("e1", "c1")); BlankView.PrintView(Console.Out, b); var king = b.GetPieceAtPosition(Pos("c1")); king.Player.Should().Be(1, "king performed castling move"); king.PieceType.Should().Be(ChessPieceType.King); var rook = b.GetPieceAtPosition(Pos("d1")); rook.Player.Should().Be(1, "the queenside rook should take place next to the king on his right"); // Undo the move and check the board state b.UndoLastMove(); king = b.GetPieceAtPosition(Pos("e1")); king.Player.Should().Be(1); rook = b.GetPieceAtPosition(Pos("a1")); rook.Player.Should().Be(1); var empty = b.GetPieceAtPosition(Pos("b1")); empty.Player.Should().Be(0); }
public override Widget build(BuildContext context) { Widget content; var followingTeams = this.widget.viewModel.followingTeams; if (this.widget.viewModel.followingTeamLoading && followingTeams.isEmpty()) { content = new GlobalLoading(); } else if (followingTeams.Count <= 0) { content = new BlankView( "没有关注的公司,去首页看看吧", "image/default-following" ); } else { var enablePullUp = this.widget.viewModel.followingTeamsHasMore; content = new CustomListView( controller: this._refreshController, enablePullDown: true, enablePullUp: enablePullUp, onRefresh: this._onRefresh, itemCount: followingTeams.Count, itemBuilder: this._buildTeamCard, headerWidget: CustomListViewConstant.defaultHeaderWidget, footerWidget: enablePullUp ? null : CustomListViewConstant.defaultFooterWidget ); } return(new Container( color: CColors.Background, child: content )); }
public override Widget build(BuildContext context) { Widget content; if (this.widget.viewModel.searchFollowingUserLoading) { content = new GlobalLoading(); } else if (this.widget.viewModel.searchFollowingKeyword.Length > 0) { if (this.widget.viewModel.searchFollowingUsers.Count > 0) { var enablePullUp = this.widget.viewModel.searchFollowingUserHasMore; content = new Container( color: CColors.Background, child: new CustomListView( controller: this._refreshController, enablePullDown: false, enablePullUp: enablePullUp, onRefresh: this._onRefreshSearchFollowing, itemCount: this.widget.viewModel.searchFollowingUsers.Count, itemBuilder: (cxt, index) => { var searchUser = this.widget.viewModel.searchFollowingUsers[index: index]; return(new UserCard( user: searchUser, CCommonUtils.GetUserLicense(userId: searchUser.id, userLicenseMap: this.widget.viewModel.userLicenseDict), () => this.widget.actionModel.pushToUserDetail(obj: searchUser.id), key: new ObjectKey(value: searchUser.id) )); }, headerWidget: CustomListViewConstant.defaultHeaderWidget, footerWidget: enablePullUp ? null : CustomListViewConstant.defaultFooterWidget ) ); } else { content = new BlankView( "哎呀,换个关键词试试吧", "image/default-search" ); } } else if (this.widget.viewModel.followingUserLoading && this.widget.viewModel.followingUsers.isEmpty()) { content = new GlobalLoading(); } else if (this.widget.viewModel.followingUsers.Count <= 0) { content = new BlankView( "没有关注的人,去首页看看吧", "image/default-following" ); } else { var followingUsers = this.widget.viewModel.followingUsers; var enablePullUp = this.widget.viewModel.followingUsersHasMore; content = new CustomListView( controller: this._refreshController, enablePullDown: true, enablePullUp: enablePullUp, onRefresh: this._onRefreshFollowing, itemCount: followingUsers.Count, itemBuilder: this._buildUserCard, headerWidget: CustomListViewConstant.defaultHeaderWidget, footerWidget: enablePullUp ? null : CustomListViewConstant.defaultFooterWidget ); } return(new Container( color: CColors.Background, child: content )); }
Widget _buildChatList() { Widget child = new Container(); if (this.widget.viewModel.messageLoading) { child = new GlobalLoading(); } else { if (this.widget.viewModel.messageList.Count <= 0) { child = new BlankView("暂无聊天内容", null); } else { child = new SmartRefresher( controller: this._refreshController, enablePullDown: this.widget.viewModel.hasMore, enablePullUp: false, onRefresh: this._onRefresh, child: ListView.builder( padding: EdgeInsets.only(16, right: 16, bottom: 10), physics: new AlwaysScrollableScrollPhysics(), itemCount: this.widget.viewModel.messageList.Count, itemBuilder: (cxt, index) => { var messageId = this.widget.viewModel.messageList[ this.widget.viewModel.messageList.Count - index - 1]; var messageDict = new Dictionary <string, Message>(); if (this.widget.viewModel.channelMessageDict.ContainsKey( this.widget.viewModel.channelId)) { messageDict = this.widget.viewModel.channelMessageDict[this.widget.viewModel.channelId]; } var message = new Message(); if (messageDict.ContainsKey(messageId)) { message = messageDict[messageId]; } return(new ChatMessage( message )); } ) ); } } return(new Flexible( child: new GestureDetector( onTap: () => this._focusNode.unfocus(), child: new Container( color: CColors.White, child: child ) ) )); }
Widget _buildArticleList() { Widget content = new Container(); if (this.widget.viewModel.articlesLoading && this.widget.viewModel.articleList.isEmpty()) { content = ListView.builder( itemCount: 4, itemBuilder: (cxt, index) => new ArticleLoading() ); } else if (this.widget.viewModel.articleList.Count <= 0) { content = new BlankView("暂无文章", true, () => { this.widget.actionModel.startFetchArticles(); this.widget.actionModel.fetchArticles(initOffset); }); } else { content = new SmartRefresher( controller: this._refreshController, enablePullDown: true, enablePullUp: this.widget.viewModel.hottestHasMore, onRefresh: this.onRefresh, child: ListView.builder( physics: new AlwaysScrollableScrollPhysics(), itemCount: this.widget.viewModel.articleList.Count, itemBuilder: (cxt, index) => { var articleId = this.widget.viewModel.articleList[index]; if (this.widget.viewModel.blockArticleList.Contains(articleId)) { return(new Container()); } var article = this.widget.viewModel.articleDict[articleId]; var fullName = ""; if (article.ownerType == OwnerType.user.ToString()) { if (this.widget.viewModel.userDict.ContainsKey(article.userId)) { fullName = this.widget.viewModel.userDict[article.userId].fullName; } } if (article.ownerType == OwnerType.team.ToString()) { if (this.widget.viewModel.teamDict.ContainsKey(article.teamId)) { fullName = this.widget.viewModel.teamDict[article.teamId].name; } } return(new ArticleCard( article, () => this.widget.actionModel.pushToArticleDetail(articleId), () => ReportManager.showReportView(this.widget.viewModel.isLoggedIn, articleId, ReportType.article, this.widget.actionModel.pushToLogin, this.widget.actionModel.pushToReport, this.widget.actionModel.pushToBlock ), fullName, new ObjectKey(article.id) )); } ) ); } return(new NotificationListener <ScrollNotification>( onNotification: this._onNotification, child: new Container( color: CColors.Background, child: content ) )); }
public override Widget build(BuildContext context) { Widget child = new Container(); if (this.widget.viewModel.searchLoading) { child = new GlobalLoading(); } else if (this.widget.viewModel.searchKeyword.Length > 0) { if (this.widget.viewModel.searchArticles.Count > 0) { var currentPage = this.widget.viewModel.currentPage; var pages = this.widget.viewModel.pages; child = new Container( color: CColors.Background, child: new SmartRefresher( controller: this._refreshController, enablePullDown: false, enablePullUp: currentPage != pages.Count - 1, onRefresh: this._onRefresh, child: ListView.builder( physics: new AlwaysScrollableScrollPhysics(), itemCount: this.widget.viewModel.searchArticles.Count, itemBuilder: (cxt, index) => { var searchArticle = this.widget.viewModel.searchArticles[index]; if (this.widget.viewModel.blockArticleList.Contains(searchArticle.id)) { return(new Container()); } if (searchArticle.ownerType == OwnerType.user.ToString()) { var user = this.widget.viewModel.userDict[searchArticle.userId]; return(RelatedArticleCard.User(searchArticle, user, () => { this.widget.actionModel.pushToArticleDetail(searchArticle.id); })); } var team = this.widget.viewModel.teamDict[searchArticle.teamId]; return(RelatedArticleCard.Team(searchArticle, team, () => { this.widget.actionModel.pushToArticleDetail(searchArticle.id); })); } ) ) ); } else { child = new BlankView("暂无搜索结果"); } } else { child = new ListView( children: new List <Widget> { this._buildSearchHistory(this.widget.viewModel.searchHistoryList), this._buildHotSearch() } ); } return(new Container( color: CColors.White, child: new CustomSafeArea( child: new Container( child: new Column( children: new List <Widget> { this._buildSearchBar(context), new Flexible( child: child ) } ) ) ) )); }
public void ShowBlankScreen(OverlayDetails details) { if (IsActive(this.BlankOverLay) == false) { WriteMessage ("ShowBlankScreen"); var view = new BlankView (details); view.Tag = BlankOverLay; MainWindow.AddSubview(view); HideAll(this.BlankOverLay); } }
public override Widget build(BuildContext context) { Widget content; if (this.widget.viewModel.searchFollowingUserLoading) { content = new GlobalLoading(); } else if (this.widget.viewModel.searchFollowingKeyword.Length > 0) { if (this.widget.viewModel.searchFollowingUsers.Count > 0) { content = new Container( color: CColors.Background, child: new CustomScrollbar( new SmartRefresher( controller: this._refreshController, enablePullDown: false, enablePullUp: this.widget.viewModel.searchFollowingUserHasMore, onRefresh: this._onRefreshSearchFollowing, child: ListView.builder( physics: new AlwaysScrollableScrollPhysics(), itemCount: this.widget.viewModel.searchFollowingUsers.Count, itemBuilder: (cxt, index) => { var searchUser = this.widget.viewModel.searchFollowingUsers[index: index]; return(new UserCard( user: searchUser, () => this.widget.actionModel.pushToUserDetail(obj: searchUser.id), key: new ObjectKey(value: searchUser.id) )); } ) ) ) ); } else { content = new BlankView( "哎呀,换个关键词试试吧", "image/default-search" ); } } else if (this.widget.viewModel.followingUserLoading && this.widget.viewModel.followingUsers.isEmpty()) { content = new GlobalLoading(); } else if (this.widget.viewModel.followingUsers.Count <= 0) { content = new BlankView( "没有关注的人,去首页看看吧", "image/default-following" ); } else { var followingUsers = this.widget.viewModel.followingUsers; var enablePullUp = this.widget.viewModel.followingUsersHasMore; var itemCount = enablePullUp ? followingUsers.Count + 1 : followingUsers.Count + 2; content = new CustomScrollbar( new SmartRefresher( controller: this._refreshController, enablePullDown: true, enablePullUp: enablePullUp, onRefresh: this._onRefreshFollowing, child: ListView.builder( physics: new AlwaysScrollableScrollPhysics(), itemCount: itemCount, itemBuilder: (cxt, index) => { if (index == 0) { return(new CustomDivider(color: CColors.White)); } if (index == followingUsers.Count + 1) { return(new EndView()); } var followingUser = followingUsers[index - 1]; UserType userType = UserType.unFollow; if (!this.widget.viewModel.isLoggedIn) { userType = UserType.unFollow; } else { var followUserLoading = false; if (this.widget.viewModel.userDict.ContainsKey(key: followingUser.id)) { var user = this.widget.viewModel.userDict[key: followingUser.id]; followUserLoading = user.followUserLoading ?? false; } if (this.widget.viewModel.currentUserId == followingUser.id) { userType = UserType.me; } else if (followUserLoading) { userType = UserType.loading; } else if (this.widget.viewModel.followMap.ContainsKey(key: followingUser.id)) { userType = UserType.follow; } } return(new UserCard( user: followingUser, () => this.widget.actionModel.pushToUserDetail(obj: followingUser.id), userType: userType, () => this._onFollow(userType: userType, userId: followingUser.id), new ObjectKey(value: followingUser.id) )); } ) ) ); } return(new Container( color: CColors.Background, child: content )); }
Widget _buildArticleList() { Widget content; var recommendArticleIds = this.widget.viewModel.recommendArticleIds; if (this.widget.viewModel.articlesLoading && recommendArticleIds.isEmpty()) { content = ListView.builder( physics: new NeverScrollableScrollPhysics(), itemCount: 6, itemBuilder: (cxt, index) => new ArticleLoading() ); } else if (recommendArticleIds.Count <= 0) { content = 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, 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()); } 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 = $"{article.thumbnail.url}.200x0x1.jpg"; 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) ) )); }