TreeReorderController<TKey> constructor
TreeReorderController<TKey> ({
- required TreeController<
TKey, Object?> treeController, - required TickerProvider vsync,
- bool canReorder(
- TKey key
- bool canAcceptDrop({
- int? index,
- required TKey movingKey,
- TKey? newParent,
- void onReorder(
- TKey key,
- TKey? newParent,
- int index
- double autoScrollEdgeZone = 48.0,
- double autoScrollMaxVelocity = 1200.0,
- Duration? autoExpandDelay = const Duration(milliseconds: 700),
Implementation
TreeReorderController({
required this.treeController,
required TickerProvider vsync,
this.canReorder,
this.canAcceptDrop,
this.onReorder,
this.autoScrollEdgeZone = 48.0,
this.autoScrollMaxVelocity = 1200.0,
this.autoExpandDelay = const Duration(milliseconds: 700),
}) {
// Runtime check in all build modes: asserts disappear in release.
// hasComparator, not comparator: reading the comparator getter through
// this class's covariant `TreeController<TKey, Object?>` view throws a
// TypeError (TData appears contravariantly in its function type).
if (treeController.hasComparator) {
throw ArgumentError.value(
treeController,
"treeController",
"TreeReorderController is incompatible with a comparator-based "
"TreeController: comparator auto-sort would override drag order. "
"Pass a controller with comparator: null, or remove the comparator.",
);
}
_vsync = vsync;
}