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); }
public ScrollIntent( AxisDirection direction, ScrollIncrementType type = ScrollIncrementType.line ) : base(ScrollAction.key) { this.direction = direction; this.type = type; }
public ScrollIncrementDetails( ScrollIncrementType type, ScrollMetrics metrics ) { D.assert(metrics != null); this.type = type; this.metrics = metrics; }