consumeWith method
Implementation
double consumeWith(
double available,
AppbarPropagation propagation,
Function(double, AppBarPosition) func,
) {
final targets = available < 0 ? _positions : _positions.reversed;
double consumed = 0;
for (final it in targets) {
final previousConsumed = consumed;
consumed += func.call(available - consumed, it);
// If when all consumed, stops the travel.
if ((consumed - available).abs() < precisionErrorTolerance) {
break;
}
// If when a current available not consumed by a appbar.
if ((consumed - previousConsumed).abs() > precisionErrorTolerance) {
if (propagation == AppbarPropagation.stop) break;
if (propagation == AppbarPropagation.next) continue;
}
}
return consumed;
}