浏览代码

Update reorderable list.

/main
Yuncong Zhang 6 年前
当前提交
d86b8164
共有 1 个文件被更改,包括 35 次插入15 次删除
  1. 50
      Runtime/material/reorderable_list.cs

50
Runtime/material/reorderable_list.cs


List<Widget> children = null,
ReorderCallback onReorder = null,
Axis scrollDirection = Axis.vertical,
EdgeInsets padding = null
EdgeInsets padding = null,
bool reverse = false
) {
D.assert(onReorder != null);
D.assert(children != null);

this.scrollDirection = scrollDirection;
this.padding = padding;
this.onReorder = onReorder;
this.reverse = reverse;
}
public readonly Widget header;

public readonly ReorderCallback onReorder;
public readonly bool reverse;
public override State createState() {
return new _ReorderableListViewState();
}

children: this.widget.children,
scrollDirection: this.widget.scrollDirection,
onReorder: this.widget.onReorder,
padding: this.widget.padding
padding: this.widget.padding,
reverse: this.widget.reverse
);
}
);

List<Widget> children,
Axis scrollDirection,
EdgeInsets padding,
ReorderCallback onReorder
ReorderCallback onReorder,
bool? reverse = null
) {
this.header = header;
this.children = children;

this.reverse = reverse;
}
public readonly Widget header;

public readonly ReorderCallback onReorder;
public readonly bool? reverse;
public override State createState() {
return new _ReorderableListContentState();

Widget _wrap(Widget toWrap, int index, BoxConstraints constraints) {
D.assert(toWrap.key != null);
GlobalObjectKey<State<_ReorderableListContent>> keyIndexGlobalKey = new GlobalObjectKey<State<_ReorderableListContent>>(toWrap.key);
GlobalObjectKey<State<_ReorderableListContent>> keyIndexGlobalKey =
new GlobalObjectKey<State<_ReorderableListContent>>(toWrap.key);
void onDragStarted() {
this.setState(() => {

void onDragEnded() {
reorder(this._dragStartIndex, this._currentIndex);
}
return new KeyedSubtree(
key: keyIndexGlobalKey,
child: toWrap
);
return new KeyedSubtree(
key: keyIndexGlobalKey,
child: toWrap
);
}
Widget buildDragTarget(BuildContext context, List<Key> acceptedCandidates, List<Key> rejectedCandidates) {

break;
}
wrappedChildren.Add(this._wrap(
finalDropArea, this.widget.children.Count,
constraints)
);
if (this.widget.reverse == true) {
wrappedChildren.Insert(0, this._wrap(
finalDropArea,
this.widget.children.Count,
constraints)
);
}
else {
wrappedChildren.Add(this._wrap(
finalDropArea, this.widget.children.Count,
constraints)
);
}
controller: this._scrollController
controller: this._scrollController,
reverse: this.widget.reverse == true
);
});
}
正在加载...
取消
保存