Esempio n. 1
0
 private void _onReorder(int oldIndex, int newIndex)
 {
     setState(() =>
     {
         if (newIndex > oldIndex)
         {
             newIndex -= 1;
         }
         _ListItem item = _items[oldIndex];
         _items.RemoveAt(oldIndex);
         _items.Insert(newIndex, item);
     });
 }
Esempio n. 2
0
        private Widget buildListTile(_ListItem item)
        {
            Widget secondary = new Text(
                "Even more additional list item information appears on line three."
                );
            Widget listTile = null;

            switch (_itemType)
            {
            case _ReorderableListType.threeLine:
                listTile = new CheckboxListTile(
                    key: Key.key(item.value),
                    isThreeLine: true,
                    value: item.checkState ?? false,
                    onChanged: (bool?newValue) => { setState(() => { item.checkState = newValue.Value; }); },
                    title: new Text($"This item represents {item.value}."),
                    subtitle: secondary,
                    secondary: new Icon(Icons.drag_handle)
                    );
                break;

            case _ReorderableListType.horizontalAvatar:
            case _ReorderableListType.verticalAvatar:
                listTile = new Container(
                    key: Key.key(item.value),
                    height: 100.0f,
                    width: 100.0f,
                    child: new CircleAvatar(child: new Text(item.value),
                                            backgroundColor: Colors.green
                                            )
                    );
                break;
            }

            return(listTile);
        }