DocumentCollapsedHandleBuilder typedef

DocumentCollapsedHandleBuilder = Widget Function(BuildContext, {required LeaderLink focalPoint, required DocumentHandleGestureDelegate gestureDelegate, required Key handleKey, required bool shouldShow})

Builds a full-screen collapsed drag handle display, with the handle positioned near the focalPoint, and with the handle attached to the given handleKey.

Implementers of this builder have the following responsibilities:

  • Attach the handleKey to the widget that renders the handle.
  • Wrap the handle widget with a Follower and attach the focalPoint to the Follower.
  • Wrap the handle widget with a GestureDetector and attach the provided gestureDelegate callbacks to the GestureDetector.
  • When shouldShow is false, hide the handle and ensure that no gestures are handled.
Widget buildCollapsedHandle(BuildContext context, {
  required LeaderLink focalPoint,
  required DocumentHandleGestureDelegate gestureDelegate,
  required Key handleKey,
  required bool shouldShow,
}) {
  if (!shouldShow) {
    return const SizedBox();
  }
  return Follower.withOffset(
    offset: Offset.zero,
    link: focalPoint,
    child: GestureDetector(
      onTap: gestureDelegate.onTap,
      onPanStart: gestureDelegate.onPanStart,
      onPanUpdate: gestureDelegate.onPanUpdate,
      onPanEnd: gestureDelegate.onPanEnd,
      onPanCancel: gestureDelegate.onPanCancel,
      child: CollapsedHandle(
        key: handleKey,
      ),
    ),
  );
}

Implementation

typedef DocumentCollapsedHandleBuilder = Widget Function(
  BuildContext, {
  required Key handleKey,
  required LeaderLink focalPoint,
  required DocumentHandleGestureDelegate gestureDelegate,
  required bool shouldShow,
});