コード例 #1
0
        List <Widget> _buildSecondaryActions(FavoriteTag favoriteTag)
        {
            if (favoriteTag.type == "default")
            {
                return(new List <Widget>());
            }

            return(new List <Widget> {
                new DeleteActionButton(
                    80,
                    EdgeInsets.only(24, right: 12),
                    () => {
                    ActionSheetUtils.showModalActionSheet(
                        new ActionSheet(
                            title: "确定删除收藏夹及收藏夹中的内容?",
                            items: new List <ActionSheetItem> {
                        new ActionSheetItem(
                            "确定",
                            type: ActionType.normal,
                            () => this.widget.actionModel.deleteFavoriteTag(arg: favoriteTag.id)
                            ),
                        new ActionSheetItem("取消", type: ActionType.cancel)
                    }
                            )
                        );
                }
                    ),
                new EditActionButton(
                    80,
                    EdgeInsets.only(12, right: 24),
                    () => this.widget.actionModel.pushToCreateFavorite(obj: favoriteTag.id)
                    )
            });
        }
コード例 #2
0
        public void AddFavoriteTag(FavoriteTag tag)
        {
            var favoriteTags = TagGroups[3];

            favoriteTags.Items.Add(CreateNodeForFavoriteTag(tag));
            SetHeader(favoriteTags);
        }
コード例 #3
0
        public void RemoveFavoriteTag(FavoriteTag tag)
        {
            var      favoriteTags = TagGroups[3];
            TagGroup thisNode     = favoriteTags.Items.Cast <TagGroup>().First(node => node.Name.Equals(tag.Tag));

            favoriteTags.Items.Remove(thisNode);
            SetHeader(thisNode);
        }
コード例 #4
0
 public FavoriteCard(
     FavoriteTag favoriteTag,
     bool isShowCheckBox      = false,
     GestureTapCallback onTap = null,
     bool checkBoxValue       = false,
     Key key = null
     ) : base(key: key)
 {
     this.favoriteTag    = favoriteTag;
     this.isShowCheckBox = isShowCheckBox;
     this.onTap          = onTap;
     this.checkBoxValue  = checkBoxValue;
 }
コード例 #5
0
        private static TagGroup CreateNodeForFavoriteTag(FavoriteTag favoriteTag)
        {
            var subItem = new TagGroup {
                Name = favoriteTag.Tag
            };
            var autoItems = LocalDatabase.AutoTags.Local.Where(t => t.Tag == favoriteTag.Tag && t.Item != null);

            foreach (var item in autoItems)
            {
                subItem.Items.Add(item.Item);
            }
            var userItems = LocalDatabase.UserTags.Local.Where(t => t.Tag == favoriteTag.Tag && t.Item != null);

            foreach (var item in userItems)
            {
                subItem.Items.Add(item.Item);
            }
            subItem.Header = $"{favoriteTag.Tag} ({subItem.Items.Count} items)";
            return(subItem);
        }