コード例 #1
0
 void _handleDragEnd(DragEndDetails details)
 {
     D.assert(mounted);
     D.assert(_backGestureController != null);
     _backGestureController.dragEnd(_convertToLogical(details.velocity.pixelsPerSecond.dx / context.size.width) ?? 0.0f);
     _backGestureController = null;
 }
コード例 #2
0
 void handleDragEnd(DragEndDetails details, bool?isClosing = null)
 {
     animationCurve = new _BottomSheetSuspendedCurve(
         widget.route.animation.value,
         curve: material_._modalBottomSheetCurve
         );
 }
コード例 #3
0
        void _handleDragEnd(DragEndDetails details)
        {
            if (this.widget.controller != null && this.widget.controller.activeState != this)
            {
                return;
            }

            this._dragUnderway = false;
            var velocity   = (float)details.primaryVelocity;
            var shouldOpen = velocity.sign() == this._dragExtent.sign();
            var fast       = velocity.abs() > this.widget.dismissibleDelegate.fastThreshold;

            if (this.dismissible && this.overallMoveAnimation.value > this.totalActionsExtent)
            {
                // We are in a dismiss state.
                if (this.overallMoveAnimation.value >= this.dismissThreshold)
                {
                    this.dismiss(null);
                }
                else
                {
                    this.open();
                }
            }
            else if (this.actionsMoveAnimation.value >= this.widget.showAllActionsThreshold || (shouldOpen && fast))
            {
                this.open();
            }
            else
            {
                this.close();
            }
        }
コード例 #4
0
        void _handleDragEnd(DragEndDetails details)
        {
            if (this._dismissUnderway)
            {
                return;
            }

            if (details.velocity.pixelsPerSecond.dy > BottomSheetUtils._kMinFlingVelocity)
            {
                float flingVelocity = -details.velocity.pixelsPerSecond.dy / this._childHeight.Value;
                if (this.widget.animationController.value > 0.0f)
                {
                    this.widget.animationController.fling(velocity: flingVelocity);
                }

                if (flingVelocity < 0.0f)
                {
                    this.widget.onClosing();
                }
            }
            else if (this.widget.animationController.value < BottomSheetUtils._kCloseProgressThreshold)
            {
                if (this.widget.animationController.value > 0.0f)
                {
                    this.widget.animationController.fling(velocity: -1.0f);
                }

                this.widget.onClosing();
            }
            else
            {
                this.widget.animationController.forward();
            }
        }
コード例 #5
0
        void _onPanEnd(DragEndDetails details)
        {
            if (details.velocity.pixelsPerSecond.dy.abs() >= CupertinoContextMenuUtils.kMinFlingVelocity)
            {
                bool  flingIsAway   = details.velocity.pixelsPerSecond.dy > 0;
                float finalPosition = flingIsAway
                    ? _moveAnimation.value.dy + 100.0f
                    : 0.0f;
                if (flingIsAway && _sheetController.status != AnimationStatus.forward)
                {
                    _sheetController.forward();
                }
                else if (!flingIsAway && _sheetController.status != AnimationStatus.reverse)
                {
                    _sheetController.reverse();
                }

                _moveAnimation = new OffsetTween(
                    begin: new Offset(0.0f, _moveAnimation.value.dy),
                    end: new  Offset(0.0f, finalPosition)
                    ).animate(_moveController);
                _moveController.reset();
                _moveController.duration = TimeSpan.FromMilliseconds(64);
                _moveController.forward();
                _moveController.addStatusListener(_flingStatusListener);
                return;
            }
            if (_lastScale == _kMinScale)
            {
                widget.onDismiss(context, _lastScale, _sheetOpacityAnimation.value);
                return;
            }
            _moveController.addListener(_moveListener);
            _moveController.reverse();
        }
コード例 #6
0
ファイル: drawer.cs プロジェクト: wxFancer/UIWidgets
        void _settle(DragEndDetails details)
        {
            if (this._controller.isDismissed)
            {
                return;
            }

            if (details.velocity.pixelsPerSecond.dx.abs() >= DrawerUtils._kMinFlingVelocity)
            {
                double visualVelocity = details.velocity.pixelsPerSecond.dx / DrawerUtils._kWidth;
                switch (this.widget.alignment)
                {
                case DrawerAlignment.start:
                    break;

                case DrawerAlignment.end:
                    visualVelocity = -visualVelocity;
                    break;
                }

                this._controller.fling(velocity: visualVelocity);
            }
            else if (this._controller.value < 0.5)
            {
                this.close();
            }
            else
            {
                this.open();
            }
        }
コード例 #7
0
    void _onPanEnd(DragEndDetails details)
    {
        if (_lockScroll)
        {
            return;
        }

        float velocity = widget.scrollDirection == Axis.horizontal
            ? details.velocity.pixelsPerSecond.dx
            : details.velocity.pixelsPerSecond.dy;

        if (_animationController.value >= 0.75f || velocity > 500.0f)
        {
            if (_currentIndex <= 0 && !widget.loop)
            {
                return;
            }
            _move(1.0f, nextIndex: _currentIndex - 1);
        }
        else if (_animationController.value < 0.25f || velocity < -500.0f)
        {
            if (_currentIndex >= widget.itemCount - 1 && !widget.loop)
            {
                return;
            }
            _move(0.0f, nextIndex: _currentIndex + 1);
        }
        else
        {
            _move(0.5f, _currentIndex);
        }
    }
コード例 #8
0
 public ScrollEndNotification(
     ScrollMetrics metrics      = null,
     BuildContext context       = null,
     DragEndDetails dragDetails = null
     ) : base(metrics: metrics, context: context)
 {
     this.dragDetails = dragDetails;
 }
コード例 #9
0
        void _handleDragEnd(DragEndDetails details)
        {
            if (!this._isActive || this._moveController.isAnimating)
            {
                return;
            }

            this._dragUnderway = false;
            if (this._moveController.isCompleted)
            {
                this._startResizeAnimation();
                return;
            }

            float flingVelocity = this._directionIsXAxis
                ? details.velocity.pixelsPerSecond.dx
                : details.velocity.pixelsPerSecond.dy;

            switch (this._describeFlingGesture(details.velocity))
            {
            case _FlingGestureKind.forward:
                D.assert(this._dragExtent != 0.0f);
                D.assert(!this._moveController.isDismissed);
                if ((this.widget.dismissThresholds.getOrDefault(this._dismissDirection) ?? _kDismissThreshold) >= 1.0)
                {
                    this._moveController.reverse();
                    break;
                }

                this._dragExtent = flingVelocity.sign();
                this._moveController.fling(velocity: flingVelocity.abs() *_kFlingVelocityScale);
                break;

            case _FlingGestureKind.reverse:
                D.assert(this._dragExtent != 0.0);
                D.assert(!this._moveController.isDismissed);
                this._dragExtent = flingVelocity.sign();
                this._moveController.fling(velocity: -flingVelocity.abs() * _kFlingVelocityScale);
                break;

            case _FlingGestureKind.none:
                if (!this._moveController.isDismissed)
                {
                    // we already know it's not completed, we check that above
                    if (this._moveController.value >
                        (this.widget.dismissThresholds.getOrDefault(this._dismissDirection) ?? _kDismissThreshold))
                    {
                        this._moveController.forward();
                    }
                    else
                    {
                        this._moveController.reverse();
                    }
                }

                break;
            }
        }
コード例 #10
0
 void _handleDragEnd(DragEndDetails details)
 {
     setState(() => { needsPositionAnimation = true; });
     if (position.value >= 0.5 != widget.value)
     {
         widget.onChanged(!widget.value);
     }
     _reactionController.reverse();
 }
コード例 #11
0
        void _handleDragEnd(DragEndDetails details)
        {
            D.assert(_hold == null || _drag == null);
            if (_drag != null)
            {
                _drag.end(details);
            }

            D.assert(_drag == null);
        }
コード例 #12
0
 public ScrollEndNotification(
     ScrollMetrics metrics      = null,
     BuildContext context       = null,
     DragEndDetails dragDetails = null,
     float overscroll           = 0,
     float velocity             = 0
     ) : base(metrics: metrics, context: context)
 {
     this.dragDetails = dragDetails;
 }
コード例 #13
0
        void _handleDragEnd(DragEndDetails details)
        {
            D.assert(this._hold == null || this._drag == null);
            if (this._drag != null)
            {
                this._drag.end(details);
            }

            D.assert(this._drag == null);
        }
コード例 #14
0
        void _handlePanEnd(DragEndDetails details)
        {
            Rect bounds =
                (Offset.zero & (Window.instance.physicalSize / Window.instance.devicePixelRatio)).deflate(
                    _kOffScreenMargin);

            if (!bounds.contains(this._lastPointerLocation))
            {
                this.setState(() => { this.selection.clear(); });
            }
        }
コード例 #15
0
        void _handleDragEnd(DragEndDetails details)
        {
            _needsPositionAnimation = true;

            if ((position.value >= 0.5f) != value)
            {
                onChanged(!value);
            }

            reactionController.reverse();
            state._didFinishDragging();
        }
コード例 #16
0
 void _handleDragEnd(DragEndDetails details)
 {
     if (this.position.value >= 0.5)
     {
         this.positionController.forward();
     }
     else
     {
         this.positionController.reverse();
     }
     this.reactionController.reverse();
 }
コード例 #17
0
        void _handleDragEnd(DragEndDetails details)
        {
            D.assert(widget.enableDrag);
            if (_dismissUnderway)
            {
                return;
            }

            bool isClosing = false;

            if (details.velocity.pixelsPerSecond.dy > material_._minFlingVelocity)
            {
                float?flingVelocity = -details.velocity.pixelsPerSecond.dy / _childHeight;
                if (widget.animationController.value > 0.0)
                {
                    widget.animationController.fling(velocity: flingVelocity ?? 0);
                }

                if (flingVelocity < 0.0)
                {
                    isClosing = true;
                }
            }
            else if (widget.animationController.value < material_._closeProgressThreshold)
            {
                if (widget.animationController.value > 0.0)
                {
                    widget.animationController.fling(velocity: -1.0f);
                }
                isClosing = true;
            }
            else
            {
                widget.animationController.forward();
            }

            if (widget.onDragEnd != null)
            {
                widget.onDragEnd(
                    details,
                    isClosing: isClosing
                    );
            }

            if (isClosing)
            {
                widget.onClosing();
            }
        }
コード例 #18
0
        void _settle(DragEndDetails details)
        {
            if (_controller.isDismissed)
            {
                return;
            }

            if (details.velocity.pixelsPerSecond.dx.abs() >= DrawerUtils._kMinFlingVelocity)
            {
                float visualVelocity = details.velocity.pixelsPerSecond.dx / DrawerUtils._kWidth;
                switch (widget.alignment)
                {
                case DrawerAlignment.start:
                    break;

                case DrawerAlignment.end:
                    visualVelocity = -visualVelocity;
                    break;
                }

                switch (Directionality.of(context))
                {
                case TextDirection.rtl:
                    _controller.fling(velocity: -visualVelocity);
                    if (widget.drawerCallback != null)
                    {
                        widget.drawerCallback(visualVelocity < 0.0f);
                    }
                    break;

                case TextDirection.ltr:
                    _controller.fling(velocity: visualVelocity);
                    if (widget.drawerCallback != null)
                    {
                        widget.drawerCallback(visualVelocity > 0.0f);
                    }
                    break;
                }
            }
            else if (_controller.value < 0.5f)
            {
                close();
            }
            else
            {
                open();
            }
        }
コード例 #19
0
        void _onEnd(DragEndDetails details)
        {
            if (_startedOnSelectedSegment)
            {
                _playThumbScaleAnimation(isExpanding: true);
                state.didChangeSelectedViaGesture();
            }

            if (pressedIndex != null)
            {
                highlightedIndex = pressedIndex;
                state.didChangeSelectedViaGesture();
            }
            pressedIndex              = null;
            _localDragOffset          = null;
            _startedOnSelectedSegment = false;
        }
コード例 #20
0
ファイル: text_selection.cs プロジェクト: zjuwjf/UIWidgets
        void _handleDragEnd(DragEndDetails details)
        {
            D.assert(this._lastDragStartDetails != null);
            if (this._lastDragUpdateDetails != null)
            {
                this._dragUpdateThrottleTimer.cancel();
                this._handleDragUpdateThrottled();
            }

            if (this.widget.onDragSelectionEnd != null)
            {
                this.widget.onDragSelectionEnd(details);
            }

            this._dragUpdateThrottleTimer = null;
            this._lastDragStartDetails    = null;
            this._lastDragUpdateDetails   = null;
        }
コード例 #21
0
    void _handleDragEnd(DragEndDetails details)
    {
        D.assert(_lastDragStartDetails != null);
        if (_lastDragUpdateDetails != null)
        {
            _dragUpdateThrottleTimer.cancel();
            _handleDragUpdateThrottled();
        }

        if (widget.onDragSelectionEnd != null)
        {
            widget.onDragSelectionEnd(details);
        }

        _dragUpdateThrottleTimer = null;
        _lastDragStartDetails    = null;
        _lastDragUpdateDetails   = null;
    }
コード例 #22
0
ファイル: scroll_activity.cs プロジェクト: wxFancer/UIWidgets
        public void end(DragEndDetails details)
        {
            D.assert(details.primaryVelocity != null);
            double velocity = -details.primaryVelocity.Value;

            if (this._reversed)
            {
                velocity = -velocity;
            }

            this._lastDetails = details;

            if (this._retainMomentum && velocity.sign() == this.carriedVelocity.Value.sign())
            {
                velocity += this.carriedVelocity.Value;
            }

            this.del.goBallistic(velocity);
        }
コード例 #23
0
        void _handleDragEnd(DragEndDetails details)
        {
            if (this._controller.isAnimating || this._controller.status == AnimationStatus.completed)
            {
                return;
            }

            float?flingVelocity = details.velocity.pixelsPerSecond.dy / this._backdropHeight;

            if (flingVelocity < 0.0f)
            {
                this._controller.fling(velocity: Mathf.Max(2.0f, -flingVelocity ?? 0.0f));
            }
            else if (flingVelocity > 0.0f)
            {
                this._controller.fling(velocity: Mathf.Min(-2.0f, -flingVelocity ?? 0.0f));
            }
            else
            {
                this._controller.fling(velocity: this._controller.value < 0.5 ? -2.0f : 2.0f);
            }
        }
コード例 #24
0
ファイル: drag_target.cs プロジェクト: wxFancer/UIWidgets
 public void end(DragEndDetails details)
 {
     this.finishDrag(_DragEndKind.dropped, this._restrictVelocityAxis(details.velocity));
 }
コード例 #25
0
 void _handleDragEnd(DragEndDetails details)
 {
     _endInteraction();
 }
コード例 #26
0
 protected override void onDragSelectionEnd(DragEndDetails details)
 {
     //(DragStartDetails details)
     _state._requestKeyboard();
 }
コード例 #27
0
 void _handleMouseDragSelectionEnd(DragEndDetails details)
 {
     this._requestKeyboard();
 }