SelectionOverlay constructor Null safety

SelectionOverlay(
  1. {required BuildContext context,
  2. Widget? debugRequiredFor,
  3. required TextSelectionHandleType startHandleType,
  4. required double lineHeightAtStart,
  5. ValueListenable<bool>? startHandlesVisible,
  6. ValueChanged<DragStartDetails>? onStartHandleDragStart,
  7. ValueChanged<DragUpdateDetails>? onStartHandleDragUpdate,
  8. ValueChanged<DragEndDetails>? onStartHandleDragEnd,
  9. required TextSelectionHandleType endHandleType,
  10. required double lineHeightAtEnd,
  11. ValueListenable<bool>? endHandlesVisible,
  12. ValueChanged<DragStartDetails>? onEndHandleDragStart,
  13. ValueChanged<DragUpdateDetails>? onEndHandleDragUpdate,
  14. ValueChanged<DragEndDetails>? onEndHandleDragEnd,
  15. ValueListenable<bool>? toolbarVisible,
  16. required List<TextSelectionPoint> selectionEndpoints,
  17. required TextSelectionControls? selectionControls,
  18. required TextSelectionDelegate selectionDelegate,
  19. required ClipboardStatusNotifier? clipboardStatus,
  20. required LayerLink startHandleLayerLink,
  21. required LayerLink endHandleLayerLink,
  22. required LayerLink toolbarLayerLink,
  23. DragStartBehavior dragStartBehavior = DragStartBehavior.start,
  24. VoidCallback? onSelectionHandleTapped,
  25. Offset? toolbarLocation}
)

Creates an object that manages overlay entries for selection handles.

The context must not be null and must have an Overlay as an ancestor.

Implementation

SelectionOverlay({
  required this.context,
  this.debugRequiredFor,
  required TextSelectionHandleType startHandleType,
  required double lineHeightAtStart,
  this.startHandlesVisible,
  this.onStartHandleDragStart,
  this.onStartHandleDragUpdate,
  this.onStartHandleDragEnd,
  required TextSelectionHandleType endHandleType,
  required double lineHeightAtEnd,
  this.endHandlesVisible,
  this.onEndHandleDragStart,
  this.onEndHandleDragUpdate,
  this.onEndHandleDragEnd,
  this.toolbarVisible,
  required List<TextSelectionPoint> selectionEndpoints,
  required this.selectionControls,
  required this.selectionDelegate,
  required this.clipboardStatus,
  required this.startHandleLayerLink,
  required this.endHandleLayerLink,
  required this.toolbarLayerLink,
  this.dragStartBehavior = DragStartBehavior.start,
  this.onSelectionHandleTapped,
  Offset? toolbarLocation,
}) : _startHandleType = startHandleType,
     _lineHeightAtStart = lineHeightAtStart,
     _endHandleType = endHandleType,
     _lineHeightAtEnd = lineHeightAtEnd,
     _selectionEndpoints = selectionEndpoints,
     _toolbarLocation = toolbarLocation {
  final OverlayState? overlay = Overlay.of(context, rootOverlay: true);
  assert(
    overlay != null,
    'No Overlay widget exists above $context.\n'
    'Usually the Navigator created by WidgetsApp provides the overlay. Perhaps your '
    'app content was created above the Navigator with the WidgetsApp builder parameter.',
  );
}