2021-10-04 15:53:03 +02:00
|
|
|
import 'package:nc_photos/entity/file.dart';
|
|
|
|
|
2021-12-19 12:30:56 +01:00
|
|
|
class DateGroupHelper {
|
|
|
|
DateGroupHelper({
|
2021-10-04 15:53:03 +02:00
|
|
|
required this.isMonthOnly,
|
|
|
|
});
|
|
|
|
|
|
|
|
DateTime? onFile(File file) {
|
|
|
|
final newDate = file.bestDateTime.toLocal();
|
|
|
|
if (newDate.year != _currentDate?.year ||
|
|
|
|
newDate.month != _currentDate?.month ||
|
|
|
|
(!isMonthOnly && newDate.day != _currentDate?.day)) {
|
|
|
|
_currentDate = newDate;
|
|
|
|
return newDate;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
final bool isMonthOnly;
|
|
|
|
DateTime? _currentDate;
|
|
|
|
}
|
2021-12-19 12:44:41 +01:00
|
|
|
|
|
|
|
int getThumbSize(int zoomLevel) {
|
|
|
|
switch (zoomLevel) {
|
|
|
|
case -1:
|
|
|
|
return 96;
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
return 176;
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
return 256;
|
|
|
|
|
|
|
|
case 0:
|
|
|
|
default:
|
|
|
|
return 112;
|
|
|
|
}
|
|
|
|
}
|