custom static method

Widget custom({
  1. Key? key,
  2. required SliverChildDelegate childrenDelegate,
  3. KSmoothScrollMode mode = KSmoothScrollMode.auto,
  4. KScrollIntensity intensity = KScrollIntensity.slow,
  5. SmoothScrollPhysics? customPhysics,
  6. double? cacheExtent,
  7. Clip clipBehavior = Clip.hardEdge,
  8. ScrollController? controller,
  9. DragStartBehavior dragStartBehavior = DragStartBehavior.start,
  10. double? itemExtent,
  11. ScrollViewKeyboardDismissBehavior keyboardDismissBehavior = ScrollViewKeyboardDismissBehavior.manual,
  12. EdgeInsetsGeometry? padding,
  13. ScrollPhysics? physics,
  14. bool? primary,
  15. Widget? prototypeItem,
  16. String? restorationId,
  17. bool reverse = false,
  18. Axis scrollDirection = Axis.vertical,
  19. int? semanticChildCount,
  20. bool shrinkWrap = false,
})

Custom constructor for advanced use cases

Implementation

static Widget custom({
  Key? key,
  required SliverChildDelegate childrenDelegate,
  KSmoothScrollMode mode = KSmoothScrollMode.auto,
  KScrollIntensity intensity = KScrollIntensity.slow,
  SmoothScrollPhysics? customPhysics,
  double? cacheExtent,
  Clip clipBehavior = Clip.hardEdge,
  ScrollController? controller,
  DragStartBehavior dragStartBehavior = DragStartBehavior.start,
  double? itemExtent,
  ScrollViewKeyboardDismissBehavior keyboardDismissBehavior = ScrollViewKeyboardDismissBehavior.manual,
  EdgeInsetsGeometry? padding,
  ScrollPhysics? physics,
  bool? primary,
  Widget? prototypeItem,
  String? restorationId,
  bool reverse = false,
  Axis scrollDirection = Axis.vertical,
  int? semanticChildCount,
  bool shrinkWrap = false,
}) {
  final shouldApplySmooth = _shouldApplySmoothScrollStatic(mode);

  if (!shouldApplySmooth) {
    return ListView.custom(
      key: key,
      childrenDelegate: childrenDelegate,
      cacheExtent: cacheExtent,
      clipBehavior: clipBehavior,
      controller: controller,
      dragStartBehavior: dragStartBehavior,
      itemExtent: itemExtent,
      keyboardDismissBehavior: keyboardDismissBehavior,
      padding: padding,
      physics: physics,
      primary: primary,
      prototypeItem: prototypeItem,
      restorationId: restorationId,
      reverse: reverse,
      scrollDirection: scrollDirection,
      semanticChildCount: semanticChildCount,
      shrinkWrap: shrinkWrap,
    );
  }

  return _SmoothListViewCustom(
    key: key,
    childrenDelegate: childrenDelegate,
    mode: mode,
    intensity: intensity,
    customPhysics: customPhysics,
    cacheExtent: cacheExtent,
    clipBehavior: clipBehavior,
    controller: controller,
    dragStartBehavior: dragStartBehavior,
    itemExtent: itemExtent,
    keyboardDismissBehavior: keyboardDismissBehavior,
    padding: padding,
    physics: physics,
    primary: primary,
    prototypeItem: prototypeItem,
    restorationId: restorationId,
    reverse: reverse,
    scrollDirection: scrollDirection,
    semanticChildCount: semanticChildCount,
    shrinkWrap: shrinkWrap,
  );
}