Commit 6c639ee3 authored by Hans Muller's avatar Hans Muller

optional spring description

parent 1ad857b5
......@@ -18,11 +18,12 @@ class ScrollSimulation extends SimulationGroup {
double _offset = 0.0;
ScrollSimulation(double position, double velocity, double leading,
double trailing, SpringDescription spring, double drag)
double trailing, [SpringDescription spring, double drag])
: _leadingExtent = leading,
_trailingExtent = trailing,
_springDesc = spring,
_drag = drag {
assert((spring != null && drag != null) || (spring == null && drag == null));
_chooseSimulation(position, velocity, 0.0);
}
......@@ -40,6 +41,10 @@ class ScrollSimulation extends SimulationGroup {
bool _chooseSimulation(
double position, double velocity, double intervalOffset) {
if (_springDesc == null &&
(position > _trailingExtent || position < _leadingExtent))
return false;
/// This simulation can only step forward.
if (!_isSpringing) {
if (position > _trailingExtent) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment