コード例 #1
0
 private void _handleDelete(LeaveBehindItem item)
 {
     setState(() => { leaveBehindItems.Remove(item); });
     _scaffoldKey.currentState.showSnackBar(new SnackBar(
                                                content: new Text($"You deleted item {item.index}"),
                                                action: new SnackBarAction(
                                                    label: "UNDO",
                                                    onPressed: () => { handleUndo(item); }
                                                    )
                                                ));
 }
コード例 #2
0
 private int lowerBound(List <LeaveBehindItem> items, LeaveBehindItem item)
 {
     items.Sort();
     for (int i = 0; i < items.Count; i++)
     {
         if (item.CompareTo(items[i]) >= 0)
         {
             return(i);
         }
     }
     return(items.Count - 1);
 }
コード例 #3
0
 public _LeaveBehindListItem(
     Key key = null,
     LeaveBehindItem item              = null,
     onArchiveFunc onArchive           = null,
     onDeleteFunc onDelete             = null,
     DismissDirection?dismissDirection = null,
     bool?confirmDismiss = null
     ) : base(key: key)
 {
     this.item             = item;
     this.onArchive        = onArchive;
     this.onDelete         = onDelete;
     this.dismissDirection = dismissDirection;
     this.confirmDismiss   = confirmDismiss;
 }
コード例 #4
0
        private void handleUndo(LeaveBehindItem item)
        {
            int insertionIndex = lowerBound(leaveBehindItems, item);

            setState(() => { leaveBehindItems.Insert(insertionIndex, item); });
        }