Beispiel #1
0
        Widget _buildFavoriteCard(BuildContext context, int index)
        {
            var favoriteId      = this.widget.viewModel.myFavoriteIds[index : index];
            var favoriteTagDict = this.widget.viewModel.favoriteTagDict;

            if (!favoriteTagDict.ContainsKey(key: favoriteId))
            {
                return(new Container());
            }

            var favoriteTag = favoriteTagDict[key : favoriteId];

            return(CustomDismissible.builder(
                       Key.key(value: favoriteTag.id),
                       new FavoriteCard(
                           favoriteTag: favoriteTag,
                           false,
                           () => {
                CustomDismissible.of(context: context)?.close();
                this.widget.actionModel.pushToFavoriteDetail(arg1: this.widget.viewModel.currentUserId,
                                                             arg2: favoriteTag.id);
            }
                           ),
                       new CustomDismissibleDrawerDelegate(),
                       secondaryActions: this._buildSecondaryActions(favoriteTag: favoriteTag),
                       controller: this._controller
                       ));
        }
        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
                       ));
        }
Beispiel #3
0
        public override Widget build(BuildContext context)
        {
            if (this.viewModel.articleHistory.Count == 0)
            {
                return(new BlankView("暂无浏览文章记录"));
            }

            return(new Container(
                       color: CColors.background3,
                       child: ListView.builder(
                           physics: new AlwaysScrollableScrollPhysics(),
                           itemCount: this.viewModel.articleHistory.Count,
                           itemBuilder: (cxt, index) => {
                var model = this.viewModel.articleHistory[index];
                var child = new ArticleCard(
                    model,
                    () => this.actionModel.pushToArticleDetail(model.id),
                    () => ReportManager.showReportView(this.viewModel.isLoggedIn,
                                                       model.id,
                                                       ReportType.article, this.actionModel.pushToLogin, this.actionModel.pushToReport,
                                                       this.actionModel.pushToBlock
                                                       ),
                    model.fullName,
                    new ObjectKey(model.id)
                    );

                return CustomDismissible.builder(
                    Key.key(model.id),
                    child,
                    new CustomDismissibleDrawerDelegate(),
                    secondaryActions: new List <Widget> {
                    new GestureDetector(
                        onTap: () => this.actionModel.deleteArticleHistory(model.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
                    );
            }
                           )
                       ));
        }
Beispiel #4
0
        public override Widget build(BuildContext context)
        {
            if (this.viewModel.eventHistory.Count == 0)
            {
                return(new BlankView("暂无浏览活动记录"));
            }

            return(new Container(
                       color: CColors.Background,
                       child: ListView.builder(
                           physics: new AlwaysScrollableScrollPhysics(),
                           itemCount: this.viewModel.eventHistory.Count,
                           itemExtent: 108,
                           itemBuilder: (cxt, index) => {
                var model = this.viewModel.eventHistory[index];
                var eventType = model.mode == "online" ? EventType.online : EventType.offline;
                return CustomDismissible.builder(
                    Key.key(model.id),
                    new EventCard(
                        model,
                        model.place,
                        () => this.actionModel.pushToEventDetail(model.id, eventType)
                        ),
                    new CustomDismissibleDrawerDelegate(),
                    secondaryActions: new List <Widget> {
                    new GestureDetector(
                        onTap: () => this.actionModel.deleteEventHistory(model.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 _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
                       ));
        }
Beispiel #6
0
        Widget _buildArticleCard(BuildContext context, int index)
        {
            var model = this.viewModel.articleHistory[index];

            return(CustomDismissible.builder(
                       Key.key(model.id),
                       new ArticleCard(
                           model,
                           () => this.actionModel.pushToArticleDetail(model.id),
                           () => ReportManager.showReportView(this.viewModel.isLoggedIn,
                                                              model.id,
                                                              ReportType.article, this.actionModel.pushToLogin, this.actionModel.pushToReport,
                                                              this.actionModel.pushToBlock
                                                              ),
                           model.fullName,
                           index == 0,
                           new ObjectKey(model.id)
                           ),
                       new CustomDismissibleDrawerDelegate(),
                       secondaryActions: new List <Widget> {
                new GestureDetector(
                    onTap: () => this.actionModel.deleteArticleHistory(model.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 _buildEventCard(BuildContext context, int index)
        {
            var model     = this.viewModel.eventHistory[index];
            var eventType = model.mode == "online" ? EventType.online : EventType.offline;

            return(CustomDismissible.builder(
                       Key.key(model.id),
                       new EventCard(
                           model,
                           model.place,
                           () => this.actionModel.pushToEventDetail(model.id, eventType),
                           new ObjectKey(model.id),
                           index == 0
                           ),
                       new CustomDismissibleDrawerDelegate(),
                       secondaryActions: new List <Widget> {
                new GestureDetector(
                    onTap: () => this.actionModel.deleteEventHistory(model.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 _buildEventCard(BuildContext context, int index)
        {
            var model     = this.viewModel.eventHistory[index : index];
            var eventType = model.mode == "online" ? EventType.online : EventType.offline;

            return(CustomDismissible.builder(
                       Key.key(value: model.id),
                       new EventCard(
                           model: model,
                           place: model.place,
                           () => this.actionModel.pushToEventDetail(arg1: model.id, arg2: eventType),
                           new ObjectKey(value: model.id)
                           ),
                       new CustomDismissibleDrawerDelegate(),
                       secondaryActions: new List <Widget> {
                new DeleteActionButton(
                    80,
                    onTap: () => this.actionModel.deleteEventHistory(obj: model.id)
                    )
            },
                       controller: this._controller
                       ));
        }
Beispiel #9
0
        Widget _buildFavoriteCard(string favoriteId)
        {
            var favoriteTagDict = this.widget.viewModel.favoriteTagDict;

            if (!favoriteTagDict.ContainsKey(key: favoriteId))
            {
                return(new Container());
            }

            var favoriteTag = favoriteTagDict[key : favoriteId];

            return(CustomDismissible.builder(
                       Key.key(value: favoriteTag.id),
                       new FavoriteCard(
                           favoriteTag: favoriteTag,
                           false,
                           () => this.widget.actionModel.pushToFavoriteDetail(arg1: this.widget.viewModel.user.id,
                                                                              arg2: favoriteTag.id)
                           ),
                       new CustomDismissibleDrawerDelegate(),
                       secondaryActions: this._buildSecondaryActions(favoriteTag: favoriteTag),
                       controller: this._dismissibleController
                       ));
        }
Beispiel #10
0
        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,
                           new ObjectKey(value: article.id)
                           ),
                       new CustomDismissibleDrawerDelegate(),
                       secondaryActions: this.widget.viewModel.type == FavoriteType.my
                    ? this._buildSecondaryActions(article: article)
                    : null,
                       controller: this._dismissibleController
                       ));
        }