2026-08-05 12:00:49 -07:00
|
|
|
import 'package:flutter/foundation.dart';
|
|
|
|
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
2025-03-06 23:28:24 +05:30
|
|
|
|
2026-08-05 12:00:49 -07:00
|
|
|
part 'exif.model.freezed.dart';
|
2025-03-06 23:28:24 +05:30
|
|
|
|
2026-08-05 12:00:49 -07:00
|
|
|
@freezed
|
|
|
|
|
abstract class ExifInfo with _$ExifInfo {
|
|
|
|
|
const ExifInfo._();
|
2025-03-06 23:28:24 +05:30
|
|
|
|
2026-08-05 12:00:49 -07:00
|
|
|
const factory ExifInfo({
|
2025-03-06 23:28:24 +05:30
|
|
|
int? assetId,
|
|
|
|
|
int? fileSize,
|
|
|
|
|
String? description,
|
2026-08-05 12:00:49 -07:00
|
|
|
@Default(false) bool isFlipped,
|
2025-03-06 23:28:24 +05:30
|
|
|
String? orientation,
|
|
|
|
|
String? timeZone,
|
|
|
|
|
DateTime? dateTimeOriginal,
|
2026-01-23 16:47:46 +01:00
|
|
|
int? rating,
|
2026-04-15 09:26:40 -05:00
|
|
|
int? width,
|
|
|
|
|
int? height,
|
2026-08-05 12:00:49 -07:00
|
|
|
|
|
|
|
|
// GPS
|
2025-03-06 23:28:24 +05:30
|
|
|
double? latitude,
|
|
|
|
|
double? longitude,
|
|
|
|
|
String? city,
|
|
|
|
|
String? state,
|
|
|
|
|
String? country,
|
2026-08-05 12:00:49 -07:00
|
|
|
|
|
|
|
|
// Camera related
|
2025-03-06 23:28:24 +05:30
|
|
|
String? make,
|
|
|
|
|
String? model,
|
|
|
|
|
String? lens,
|
|
|
|
|
double? f,
|
|
|
|
|
double? mm,
|
|
|
|
|
int? iso,
|
|
|
|
|
double? exposureSeconds,
|
2026-08-05 12:00:49 -07:00
|
|
|
}) = _ExifInfo;
|
|
|
|
|
|
|
|
|
|
bool get hasCoordinates => latitude != null && longitude != null && latitude != 0 && longitude != 0;
|
|
|
|
|
|
|
|
|
|
String get exposureTime {
|
|
|
|
|
if (exposureSeconds == null || exposureSeconds! <= 0 || exposureSeconds!.isNaN) {
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
if (exposureSeconds! < 1) {
|
|
|
|
|
return "1/${(1.0 / exposureSeconds!).round()} s";
|
|
|
|
|
}
|
|
|
|
|
return "${exposureSeconds!.toStringAsFixed(1)} s";
|
2025-03-06 23:28:24 +05:30
|
|
|
}
|
2026-08-05 12:00:49 -07:00
|
|
|
|
|
|
|
|
String get fNumber => f == null ? "" : f!.toStringAsFixed(1);
|
|
|
|
|
|
|
|
|
|
String get focalLength => mm == null ? "" : mm!.toStringAsFixed(3);
|
2025-03-06 23:28:24 +05:30
|
|
|
}
|