2023-04-01 19:04:55 +00:00
|
|
|
import 'package:flutter/material.dart';
|
2022-12-16 08:08:12 +00:00
|
|
|
import 'package:lightmeter/data/models/exposure_pair.dart';
|
2023-04-01 19:04:55 +00:00
|
|
|
import 'package:lightmeter/data/models/film.dart';
|
2023-03-30 19:24:18 +00:00
|
|
|
import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart';
|
2022-10-29 18:02:45 +00:00
|
|
|
|
2023-04-01 19:04:55 +00:00
|
|
|
@immutable
|
2023-02-19 10:26:14 +00:00
|
|
|
abstract class MeteringState {
|
2023-04-01 19:04:55 +00:00
|
|
|
final Film film;
|
2022-12-01 20:49:06 +00:00
|
|
|
final IsoValue iso;
|
2022-12-04 19:12:52 +00:00
|
|
|
final NdValue nd;
|
2022-10-29 18:02:45 +00:00
|
|
|
|
2023-05-16 09:47:53 +00:00
|
|
|
const MeteringState({
|
2023-04-01 19:04:55 +00:00
|
|
|
required this.film,
|
2022-10-29 18:02:45 +00:00
|
|
|
required this.iso,
|
|
|
|
required this.nd,
|
|
|
|
});
|
|
|
|
}
|
2023-02-19 10:26:14 +00:00
|
|
|
|
2023-05-16 09:47:53 +00:00
|
|
|
class LoadingState extends MeteringState {
|
|
|
|
const LoadingState({
|
2023-04-01 19:04:55 +00:00
|
|
|
required super.film,
|
2023-02-19 10:26:14 +00:00
|
|
|
required super.iso,
|
|
|
|
required super.nd,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2023-05-16 09:47:53 +00:00
|
|
|
class MeteringDataState extends MeteringState {
|
|
|
|
final double? ev;
|
|
|
|
final List<ExposurePair> exposurePairs;
|
|
|
|
final bool continuousMetering;
|
|
|
|
|
|
|
|
const MeteringDataState({
|
|
|
|
required this.ev,
|
2023-04-01 19:04:55 +00:00
|
|
|
required super.film,
|
2023-02-19 10:26:14 +00:00
|
|
|
required super.iso,
|
|
|
|
required super.nd,
|
2023-05-16 09:47:53 +00:00
|
|
|
required this.exposurePairs,
|
|
|
|
required this.continuousMetering,
|
2023-02-19 10:26:14 +00:00
|
|
|
});
|
2023-05-16 09:47:53 +00:00
|
|
|
|
|
|
|
ExposurePair? get fastest => exposurePairs.isEmpty ? null : exposurePairs.first;
|
|
|
|
ExposurePair? get slowest => exposurePairs.isEmpty ? null : exposurePairs.last;
|
|
|
|
bool get hasError => ev == null;
|
2023-02-19 10:26:14 +00:00
|
|
|
}
|