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
handleKeyto the widget that renders the handle. - Wrap the handle widget with a
Followerand attach thefocalPointto theFollower. - Wrap the handle widget with a
GestureDetectorand attach the providedgestureDelegatecallbacks to theGestureDetector. - When
shouldShowisfalse, 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,
});