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 {
|
|
|
|
const MeteringState();
|
|
|
|
}
|
|
|
|
|
|
|
|
class LoadingState extends MeteringState {
|
|
|
|
const LoadingState();
|
|
|
|
}
|
|
|
|
|
2023-05-05 21:08:20 +00:00
|
|
|
class MeteringDataState extends MeteringState {
|
|
|
|
final double? ev;
|
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
|
|
|
final List<ExposurePair> exposurePairs;
|
2023-05-05 21:08:20 +00:00
|
|
|
final bool continuousMetering;
|
2022-10-29 18:02:45 +00:00
|
|
|
|
2023-02-19 10:26:14 +00:00
|
|
|
const MeteringDataState({
|
2022-10-29 18:02:45 +00:00
|
|
|
required this.ev,
|
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,
|
|
|
|
required this.exposurePairs,
|
2023-05-05 21:08:20 +00:00
|
|
|
required this.continuousMetering,
|
2022-10-29 18:02:45 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
ExposurePair? get fastest => exposurePairs.isEmpty ? null : exposurePairs.first;
|
|
|
|
ExposurePair? get slowest => exposurePairs.isEmpty ? null : exposurePairs.last;
|
2023-05-05 21:08:20 +00:00
|
|
|
bool get hasError => ev == null;
|
2023-02-19 10:26:14 +00:00
|
|
|
}
|