Exemplo n.º 1
0
 public override void dispose()
 {
     this.widget.controller.removeListener(this._didChangeTextEditingValue);
     this._closeInputConnectionIfNeeded();
     D.assert(!this._hasInputConnection);
     this._stopCursorTimer();
     D.assert(this._cursorTimer == null);
     this._selectionOverlay?.dispose();
     this._selectionOverlay = null;
     this.widget.focusNode.removeListener(this._handleFocusChanged);
     base.dispose();
 }
Exemplo n.º 2
0
 void _updateOrDisposeSelectionOverlayIfNeeded()
 {
     if (this._selectionOverlay != null)
     {
         if (this._hasFocus)
         {
             this._selectionOverlay.update(this._value);
         }
         else
         {
             this._selectionOverlay.dispose();
             this._selectionOverlay = null;
         }
     }
 }
Exemplo n.º 3
0
        void _handleSelectionChanged(TextSelection selection, RenderEditable renderObject,
                                     SelectionChangedCause cause)
        {
            this.widget.controller.selection = selection;
            this.requestKeyboard();

            this._hideSelectionOverlayIfNeeded();

            if (this.widget.selectionControls != null)
            {
                this._selectionOverlay = new TextSelectionOverlay(
                    context: this.context,
                    value: this._value,
                    debugRequiredFor: this.widget,
                    layerLink: this._layerLink,
                    renderObject: renderObject,
                    selectionControls: this.widget.selectionControls,
                    selectionDelegate: this
                    );
                bool longPress = cause == SelectionChangedCause.longPress;
                if (cause != SelectionChangedCause.keyboard && (this._value.text.isNotEmpty() || longPress))
                {
                    this._selectionOverlay.showHandles();
                }

                if (longPress || cause == SelectionChangedCause.doubleTap)
                {
                    this._selectionOverlay.showToolbar();
                }
            }

            if (this.widget.onSelectionChanged != null)
            {
                this.widget.onSelectionChanged(selection, cause);
            }
        }
Exemplo n.º 4
0
 void _hideSelectionOverlayIfNeeded()
 {
     this._selectionOverlay?.hide();
     this._selectionOverlay = null;
 }