Exemplo n.º 1
0
        public _DragAvatar(
            OverlayState overlayState,
            T data    = default,
            Axis?axis = null,
            Offset initialPosition = null,
            Offset dragStartPoint  = null,
            Widget feedback        = null,
            Offset feedbackOffset  = null,
            _OnDragEnd onDragEnd   = null
            )
        {
            if (feedbackOffset == null)
            {
                feedbackOffset = Offset.zero;
            }

            D.assert(overlayState != null);
            this.overlayState   = overlayState;
            this.data           = data;
            this.axis           = axis;
            this.dragStartPoint = dragStartPoint ?? Offset.zero;
            this.feedback       = feedback;
            this.feedbackOffset = feedbackOffset ?? Offset.zero;
            this.onDragEnd      = onDragEnd;

            _entry = new OverlayEntry(_build);
            this.overlayState.insert(_entry);
            _position = initialPosition ?? Offset.zero;
            updateDrag(initialPosition);
        }
Exemplo n.º 2
0
        public _DragAvatar(
            T data,
            OverlayState overlayState,
            Axis?axis = null,
            Offset initialPosition = null,
            Offset dragStartPoint  = null,
            Widget feedback        = null,
            Offset feedbackOffset  = null,
            _OnDragEnd onDragEnd   = null
            )
        {
            if (initialPosition == null)
            {
                initialPosition = Offset.zero;
            }

            if (dragStartPoint == null)
            {
                dragStartPoint = Offset.zero;
            }

            if (feedbackOffset == null)
            {
                feedbackOffset = Offset.zero;
            }

            D.assert(overlayState != null);
            this.overlayState   = overlayState;
            this.data           = data;
            this.axis           = axis;
            this.dragStartPoint = dragStartPoint;
            this.feedback       = feedback;
            this.feedbackOffset = feedbackOffset;
            this.onDragEnd      = onDragEnd;

            this._entry = new OverlayEntry(this._build);

            this.overlayState.insert(this._entry);
            this._position = initialPosition;
            this.updateDrag(initialPosition);
        }