m3_lightmeter/lib/utils/double_to_zoom.dart
Vadim 7c96b5a47d
ML-220 Show focal length when zooming (#233)
* extract focal length from exif

* added focal length section

* wip

* [android] calculate EFL

* split other platform handlers to separate files

* [ios] calculate EFL

* updated translations

* deleted `focalLengthFromTags`

* fixed unit tests

* [ios] link missing files

* updated Pro features screen

* [ios] fixed signing

* fixed screenshot generator

* updated goldens

* [android] updated store screenshots

* wip

* [ios] updated store screenshots

* enable focal length feature by default

* mock camera focal length for integration tests

* cleanup

* added logging to `CameraInfoService`
2025-05-14 10:26:59 +02:00

19 lines
824 B
Dart

import 'package:flutter/material.dart';
import 'package:lightmeter/data/models/camera_feature.dart';
import 'package:lightmeter/providers/services_provider.dart';
import 'package:lightmeter/providers/user_preferences_provider.dart';
extension DoubleToZoom on double {
String toZoom(BuildContext context) {
final showFocalLength = UserPreferencesProvider.cameraFeatureOf(context, CameraFeature.showFocalLength);
final cameraFocalLength = ServicesProvider.of(context).userPreferencesService.cameraFocalLength;
if (showFocalLength && cameraFocalLength != null) {
ServicesProvider.of(context).userPreferencesService.cameraFocalLength;
final zoomedFocalLength = (this * cameraFocalLength).round();
return '${zoomedFocalLength}mm';
} else {
return 'x${toStringAsFixed(2)}';
}
}
}