buildToolbar method
Widget
buildToolbar(
- BuildContext context,
- Rect globalEditableRegion,
- double textLineHeight,
- Offset selectionMidpoint,
- List<
TextSelectionPoint> endpoints, - TextSelectionDelegate delegate,
- ClipboardStatusNotifier clipboardStatus,
- Offset? lastSecondaryTapDownPosition,
override
Builder for material-style copy/paste text selection toolbar.
Implementation
@override
Widget buildToolbar(
BuildContext context,
Rect globalEditableRegion,
double textLineHeight,
Offset selectionMidpoint,
List<TextSelectionPoint> endpoints,
TextSelectionDelegate delegate,
ClipboardStatusNotifier clipboardStatus,
Offset? lastSecondaryTapDownPosition,
) {
print("menu");
print(endpoints);
if (endpoints.length == 1) return SizedBox.shrink();
final TextSelectionPoint startTextSelectionPoint = endpoints[0];
final TextSelectionPoint endTextSelectionPoint =
endpoints.length > 1 ? endpoints[1] : endpoints[0];
final Offset anchorAbove = Offset(
globalEditableRegion.left + selectionMidpoint.dx,
globalEditableRegion.top +
startTextSelectionPoint.point.dy -
textLineHeight -
kToolbarContentDistance);
final Offset anchorBelow = Offset(
globalEditableRegion.left + selectionMidpoint.dx,
globalEditableRegion.top +
endTextSelectionPoint.point.dy +
kToolbarContentDistanceBelow,
);
print("building againnn");
return buildTextSelectionToolbar(anchorAbove, anchorBelow);
// return MyTextSelectionToolbar(
// anchorAbove: anchorAbove,
// anchorBelow: anchorBelow,
// clipboardStatus: clipboardStatus,
// handleCopy: canCopy(delegate) && handleCopy != null
// ? () => handleCopy(delegate, clipboardStatus)
// : null,
// handleCustomButton: () {
// delegate.textEditingValue = delegate.textEditingValue.copyWith(
// selection: TextSelection.collapsed(
// offset: delegate.textEditingValue.selection.baseOffset,
// ),
// );
// delegate.hideToolbar();
// },
// handleCut: canCut(delegate) && handleCut != null
// ? () => handleCut(delegate)
// : null,
// handlePaste: canPaste(delegate) && handlePaste != null
// ? () => handlePaste(delegate)
// : null,
// handleSelectAll: canSelectAll(delegate) && handleSelectAll != null
// ? () => handleSelectAll(delegate)
// : null,
// );
}