Ejemplo n.º 1
0
        float _calculateScrollIncrement(ScrollableState state, ScrollIncrementType type = ScrollIncrementType.line)
        {
            D.assert(state.position != null);
            D.assert(state.position.havePixels);
            D.assert(state.widget.physics == null || state.widget.physics.shouldAcceptUserOffset(state.position));

            if (state.widget.incrementCalculator != null)
            {
                return(state.widget.incrementCalculator(
                           new ScrollIncrementDetails(
                               type: type,
                               metrics: state.position
                               )
                           ));
            }

            switch (type)
            {
            case ScrollIncrementType.line:
                return(50.0f);

            case ScrollIncrementType.page:
                return(0.8f * state.position.viewportDimension);
            }

            return(0.0f);
        }
Ejemplo n.º 2
0
 public ScrollIntent(
     AxisDirection direction,
     ScrollIncrementType type = ScrollIncrementType.line
     ) : base(ScrollAction.key)
 {
     this.direction = direction;
     this.type      = type;
 }
Ejemplo n.º 3
0
 public ScrollIncrementDetails(
     ScrollIncrementType type,
     ScrollMetrics metrics
     )
 {
     D.assert(metrics != null);
     this.type    = type;
     this.metrics = metrics;
 }