public override Widget buildToolbar( BuildContext context, Rect globalEditableRegion, Offset position, TextSelectionDelegate selectionDelegate ) { float availableHeight = globalEditableRegion.top - MediaQuery.of(context).padding.top - CustomTextSelectionControlsUtils._kToolbarScreenPadding; _ArrowDirection direction = availableHeight > CustomTextSelectionControlsUtils._kToolbarHeight ? _ArrowDirection.down : _ArrowDirection.up; float y = direction == _ArrowDirection.up ? globalEditableRegion.height + CustomTextSelectionControlsUtils._kToolbarHeight + 6.0f : 0.0f; return(new ConstrainedBox( constraints: BoxConstraints.tight(globalEditableRegion.size), child: new CustomSingleChildLayout( layoutDelegate: new _TextSelectionToolbarLayout( MediaQuery.of(context).size, globalEditableRegion, new Offset(position.dx, position.dy + y) ), child: new _TextSelectionToolbar( handleCut: this.canCut(selectionDelegate) ? () => this.handleCut(selectionDelegate) : (VoidCallback)null, handleCopy: this.canCopy(selectionDelegate) ? () => this.handleCopy(selectionDelegate) : (VoidCallback)null, handlePaste: this.canPaste(selectionDelegate) ? () => this.handlePaste(selectionDelegate) : (VoidCallback)null, handleSelectAll: this.canSelectAll(selectionDelegate) ? () => this.handleSelectAll(selectionDelegate) : (VoidCallback)null, arrowDirection: direction ) ) )); }
internal _TextSelectionToolbarNotchPainter( _ArrowDirection arrowDirection ) { this.arrowDirection = arrowDirection; }