Exemple #1
0
        public TextSelectionOverlay(TextEditingValue value                  = null,
                                    BuildContext context                    = null, Widget debugRequiredFor = null,
                                    LayerLink layerLink                     = null,
                                    RenderEditable renderObject             = null,
                                    TextSelectionControls selectionControls = null,
                                    TextSelectionDelegate selectionDelegate = null,
                                    DragStartBehavior dragStartBehavior     = DragStartBehavior.start)
        {
            D.assert(value != null);
            D.assert(context != null);
            this.context           = context;
            this.debugRequiredFor  = debugRequiredFor;
            this.layerLink         = layerLink;
            this.renderObject      = renderObject;
            this.selectionControls = selectionControls;
            this.selectionDelegate = selectionDelegate;
            this._value            = value;
            OverlayState overlay = Overlay.of(context);

            D.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.");
            this._toolbarController = new AnimationController(duration: fadeDuration, vsync: overlay);
            this.dragStartBehavior  = dragStartBehavior;
        }
Exemple #2
0
        public EditableText(TextEditingController controller, FocusNode focusNode, TextStyle style,
                            Color cursorColor, bool obscureText = false, bool autocorrect                           = false,
                            TextAlign textAlign                       = TextAlign.left, TextDirection?textDirection = null,
                            float?textScaleFactor                     = null, int?maxLines          = 1,
                            bool autofocus                            = false, Color selectionColor = null, TextSelectionControls selectionControls = null,
                            TextInputType keyboardType                = null, TextInputAction?textInputAction = null,
                            TextCapitalization textCapitalization     = TextCapitalization.none,
                            ValueChanged <string> onChanged           = null, VoidCallback onEditingComplete = null,
                            ValueChanged <string> onSubmitted         = null, SelectionChangedCallback onSelectionChanged = null,
                            List <TextInputFormatter> inputFormatters = null, bool rendererIgnoresPointer                 = false,
                            EdgeInsets scrollPadding                  = null, bool unityTouchKeyboard = false,
                            Key key = null) : base(key)
        {
            D.assert(controller != null);
            D.assert(focusNode != null);
            D.assert(style != null);
            D.assert(cursorColor != null);
            D.assert(maxLines == null || maxLines > 0);
            this.keyboardType = keyboardType ?? (maxLines == 1 ? TextInputType.text : TextInputType.multiline);

            this.scrollPadding          = scrollPadding ?? EdgeInsets.all(20.0f);
            this.controller             = controller;
            this.focusNode              = focusNode;
            this.obscureText            = obscureText;
            this.autocorrect            = autocorrect;
            this.style                  = style;
            this.textAlign              = textAlign;
            this.textDirection          = textDirection;
            this.textScaleFactor        = textScaleFactor;
            this.textInputAction        = textInputAction;
            this.textCapitalization     = textCapitalization;
            this.cursorColor            = cursorColor;
            this.maxLines               = maxLines;
            this.autofocus              = autofocus;
            this.selectionColor         = selectionColor;
            this.onChanged              = onChanged;
            this.onSubmitted            = onSubmitted;
            this.onSelectionChanged     = onSelectionChanged;
            this.onEditingComplete      = onEditingComplete;
            this.rendererIgnoresPointer = rendererIgnoresPointer;
            this.selectionControls      = selectionControls;
            this.unityTouchKeyboard     = unityTouchKeyboard;
            if (maxLines == 1)
            {
                this.inputFormatters = new List <TextInputFormatter>();
                this.inputFormatters.Add(BlacklistingTextInputFormatter.singleLineFormatter);
                if (inputFormatters != null)
                {
                    this.inputFormatters.AddRange(inputFormatters);
                }
            }
            else
            {
                this.inputFormatters = inputFormatters;
            }
        }
Exemple #3
0
 internal _TextSelectionHandleOverlay(
     Key key = null,
     TextSelection selection = null,
     _TextSelectionHandlePosition position = _TextSelectionHandlePosition.start,
     LayerLink layerLink         = null,
     RenderEditable renderObject = null,
     ValueChanged <TextSelection> onSelectionHandleChanged = null,
     VoidCallback onSelectionHandleTapped    = null,
     TextSelectionControls selectionControls = null
     ) : base(key: key)
 {
     this.selection                = selection;
     this.position                 = position;
     this.layerLink                = layerLink;
     this.renderObject             = renderObject;
     this.onSelectionHandleChanged = onSelectionHandleChanged;
     this.onSelectionHandleTapped  = onSelectionHandleTapped;
     this.selectionControls        = selectionControls;
 }
Exemple #4
0
        public TextSelectionOverlay(TextEditingValue value                  = null,
                                    BuildContext context                    = null, Widget debugRequiredFor = null,
                                    LayerLink layerLink                     = null,
                                    RenderEditable renderObject             = null,
                                    TextSelectionControls selectionControls = null,
                                    TextSelectionDelegate selectionDelegate = null)
        {
            D.assert(value != null);
            D.assert(context != null);
            this.context           = context;
            this.debugRequiredFor  = debugRequiredFor;
            this.layerLink         = layerLink;
            this.renderObject      = renderObject;
            this.selectionControls = selectionControls;
            this.selectionDelegate = selectionDelegate;
            this._value            = value;
            OverlayState overlay = Overlay.of(context);

            D.assert(overlay != null);
            this._handleController  = new AnimationController(duration: _fadeDuration, vsync: overlay);
            this._toolbarController = new AnimationController(duration: _fadeDuration, vsync: overlay);
        }
Exemple #5
0
 internal _TextSelectionHandleOverlay(
     Key key = null,
     TextSelection selection = null,
     _TextSelectionHandlePosition position = _TextSelectionHandlePosition.start,
     LayerLink startHandleLayerLink        = null,
     LayerLink endHandleLayerLink          = null,
     RenderEditable renderObject           = null,
     ValueChanged <TextSelection> onSelectionHandleChanged = null,
     VoidCallback onSelectionHandleTapped    = null,
     TextSelectionControls selectionControls = null,
     DragStartBehavior dragStartBehavior     = DragStartBehavior.start
     ) : base(key: key)
 {
     this.selection                = selection;
     this.position                 = position;
     this.startHandleLayerLink     = startHandleLayerLink;
     this.endHandleLayerLink       = endHandleLayerLink;
     this.renderObject             = renderObject;
     this.onSelectionHandleChanged = onSelectionHandleChanged;
     this.onSelectionHandleTapped  = onSelectionHandleTapped;
     this.selectionControls        = selectionControls;
     this.dragStartBehavior        = dragStartBehavior;
 }
Exemple #6
0
        public TextSelectionOverlay(
            TextEditingValue value                  = null,
            BuildContext context                    = null,
            Widget debugRequiredFor                 = null,
            LayerLink toolbarLayerLink              = null,
            LayerLink startHandleLayerLink          = null,
            LayerLink endHandleLayerLink            = null,
            RenderEditable renderObject             = null,
            TextSelectionControls selectionControls = null,
            bool?handlesVisible = false,
            TextSelectionDelegate selectionDelegate = null,
            DragStartBehavior dragStartBehavior     = DragStartBehavior.start,
            VoidCallback onSelectionHandleTapped    = null)
        {
            D.assert(value != null);
            D.assert(context != null);
            D.assert(handlesVisible != null);
            _handlesVisible              = handlesVisible.Value;
            this.context                 = context;
            this.debugRequiredFor        = debugRequiredFor;
            this.toolbarLayerLink        = toolbarLayerLink;
            this.startHandleLayerLink    = startHandleLayerLink;
            this.endHandleLayerLink      = endHandleLayerLink;
            this.renderObject            = renderObject;
            this.selectionControls       = selectionControls;
            this.selectionDelegate       = selectionDelegate;
            this.onSelectionHandleTapped = onSelectionHandleTapped;
            _value = value;
            OverlayState overlay = Overlay.of(context, rootOverlay: true);

            D.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.");
            _toolbarController     = new AnimationController(duration: fadeDuration, vsync: overlay);
            this.dragStartBehavior = dragStartBehavior;
        }