Esempio n. 1
0
        public RenderEditable(TextSpan text, TextDirection textDirection, ViewportOffset offset,
                              ValueNotifier <bool> showCursor,
                              TextAlign textAlign                = TextAlign.left, double textScaleFactor = 1.0, Color cursorColor = null,
                              bool?hasFocus                      = null, int?maxLines = 1, Color selectionColor = null,
                              TextSelection selection            = null, bool obscureText = false, SelectionChangedHandler onSelectionChanged = null,
                              CaretChangedHandler onCaretChanged = null, bool ignorePointer = false)
        {
            this._textPainter = new TextPainter(text: text, textAlign: textAlign, textDirection: textDirection,
                                                textScaleFactor: textScaleFactor);
            this._cursorColor       = cursorColor;
            this._showCursor        = showCursor ?? new ValueNotifier <bool>(false);
            this._hasFocus          = hasFocus ?? false;
            this._maxLines          = maxLines;
            this._selectionColor    = selectionColor;
            this._selection         = selection;
            this._obscureText       = obscureText;
            this._offset            = offset;
            this.ignorePointer      = ignorePointer;
            this.onCaretChanged     = onCaretChanged;
            this.onSelectionChanged = onSelectionChanged;

            D.assert(this._maxLines == null || this._maxLines > 0);
            D.assert(this._showCursor != null);
            D.assert(!this._showCursor.value || cursorColor != null);

            this._tap                   = new TapGestureRecognizer(this);
            this._doubleTap             = new DoubleTapGestureRecognizer(this);
            this._tap.onTapDown         = this._handleTapDown;
            this._tap.onTap             = this._handleTap;
            this._doubleTap.onDoubleTap = this._handleDoubleTap;
            this._longPress             = new LongPressGestureRecognizer(debugOwner: this);
            this._longPress.onLongPress = this._handleLongPress;
        }
Esempio n. 2
0
        public RenderListWheelViewport(
            IListWheelChildManager childManager,
            ViewportOffset offset,
            float itemExtent,
            float diameterRatio             = defaultDiameterRatio,
            float perspective               = defaultPerspective,
            float offAxisFraction           = 0.0f,
            bool useMagnifier               = false,
            float magnification             = 1.0f,
            float overAndUnderCenterOpacity = 1.0f,
            float squeeze   = 1.0f,
            bool clipToSize = true,
            bool renderChildrenOutsideViewport = false,
            List <RenderBox> children          = null
            )
        {
            D.assert(childManager != null);
            D.assert(offset != null);
            D.assert(diameterRatio > 0, () => diameterRatioZeroMessage);
            D.assert(perspective > 0);
            D.assert(perspective <= 0.01f, () => perspectiveTooHighMessage);
            D.assert(magnification > 0);
            D.assert(overAndUnderCenterOpacity >= 0 && overAndUnderCenterOpacity <= 1);
            D.assert(itemExtent > 0);
            D.assert(squeeze > 0);
            D.assert(
                !renderChildrenOutsideViewport || !clipToSize,
                () => clipToSizeAndRenderChildrenOutsideViewportConflict
                );

            this.childManager              = childManager;
            _offset                        = offset;
            _diameterRatio                 = diameterRatio;
            _perspective                   = perspective;
            _offAxisFraction               = offAxisFraction;
            _useMagnifier                  = useMagnifier;
            _magnification                 = magnification;
            _overAndUnderCenterOpacity     = overAndUnderCenterOpacity;
            _itemExtent                    = itemExtent;
            _squeeze                       = squeeze;
            _clipToSize                    = clipToSize;
            _renderChildrenOutsideViewport = renderChildrenOutsideViewport;
            addAll(children);
        }