修改下载名称显示为书籍名称

This commit is contained in:
rang 2025-10-21 14:43:48 +08:00
parent 699b7de311
commit e0deb84123
4 changed files with 7 additions and 58 deletions

View file

@ -235,57 +235,3 @@ class AudiobookChapterProgressBar extends HookConsumerWidget {
// ! TODO remove onTap
void onTap() {}
class ProportionalAdjuster {
final double minValue;
final double maxValue;
ProportionalAdjuster({this.minValue = 0.0, this.maxValue = 1.0});
double adjust(double value, double ratio, {AdjustMethod method = AdjustMethod.linear}) {
switch (method) {
case AdjustMethod.linear:
return _linearAdjust(value, ratio);
case AdjustMethod.exponential:
return _exponentialAdjust(value, ratio);
case AdjustMethod.smooth:
return _smoothAdjust(value, ratio);
}
}
double _linearAdjust(double value, double ratio) {
if (value <= minValue) return minValue;
if (value >= maxValue) return maxValue;
double newValue;
if (ratio > 1) {
newValue = value + (maxValue - value) * (ratio - 1);
} else {
newValue = value * ratio;
}
return newValue.clamp(minValue, maxValue);
}
double _exponentialAdjust(double value, double ratio) {
if (value <= minValue) return minValue;
if (value >= maxValue) return maxValue;
double newValue;
if (ratio > 1) {
newValue = maxValue - (maxValue - value) / ratio;
} else {
newValue = value * ratio;
}
return newValue.clamp(minValue, maxValue);
}
double _smoothAdjust(double value, double progress) {
progress = progress.clamp(0.0, 1.0);
double target = value > (minValue + maxValue) / 2 ? maxValue : minValue;
return value + (target - value) * progress;
}
}
enum AdjustMethod { linear, exponential, smooth }