TreeReorderController<TKey, TData> constructor

TreeReorderController<TKey, TData>({
  1. required TreeController<TKey, TData> treeController,
  2. required TickerProvider vsync,
  3. bool canReorder(
    1. TKey key
    )?,
  4. bool canAcceptDrop({
    1. int? index,
    2. required TKey movingKey,
    3. TKey? newParent,
    })?,
  5. Duration slideDuration = const Duration(milliseconds: 220),
  6. Curve slideCurve = Curves.easeOutCubic,
  7. double autoScrollEdgeZone = 48.0,
  8. double autoScrollMaxVelocity = 1200.0,
})

Implementation

TreeReorderController({
  required this.treeController,
  required TickerProvider vsync,
  this.canReorder,
  this.canAcceptDrop,
  this.slideDuration = const Duration(milliseconds: 220),
  this.slideCurve = Curves.easeOutCubic,
  this.autoScrollEdgeZone = 48.0,
  this.autoScrollMaxVelocity = 1200.0,
}) {
  // Runtime check in all build modes — asserts disappear in release.
  if (treeController.comparator != null) {
    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.",
    );
  }
  _autoScrollTicker = vsync.createTicker(_onAutoScrollTick);
}