2023-04-01 18:58:23 +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 18:58:23 +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 18:58:23 +00:00
|
|
|
@immutable
|
2023-02-19 10:26:14 +00:00
|
|
|
abstract class MeteringState {
|
|
|
|
const MeteringState();
|
|
|
|
}
|
|
|
|
|
|
|
|
class LoadingState extends MeteringState {
|
|
|
|
const LoadingState();
|
|
|
|
}
|
|
|
|
|
|
|
|
abstract class MeteringDataState extends MeteringState {
|
2022-10-29 18:02:45 +00:00
|
|
|
final double ev;
|
2023-04-01 18:58:23 +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-02-19 10:26:14 +00:00
|
|
|
const MeteringDataState({
|
2022-10-29 18:02:45 +00:00
|
|
|
required this.ev,
|
2023-04-01 18:58:23 +00:00
|
|
|
required this.film,
|
2022-10-29 18:02:45 +00:00
|
|
|
required this.iso,
|
|
|
|
required this.nd,
|
|
|
|
required this.exposurePairs,
|
|
|
|
});
|
|
|
|
|
|
|
|
ExposurePair? get fastest => exposurePairs.isEmpty ? null : exposurePairs.first;
|
|
|
|
ExposurePair? get slowest => exposurePairs.isEmpty ? null : exposurePairs.last;
|
|
|
|
}
|
2023-02-19 10:26:14 +00:00
|
|
|
|
|
|
|
class MeteringInProgressState extends MeteringDataState {
|
2023-04-01 18:58:23 +00:00
|
|
|
const MeteringInProgressState({
|
2023-02-19 10:26:14 +00:00
|
|
|
required super.ev,
|
2023-04-01 18:58:23 +00:00
|
|
|
required super.film,
|
2023-02-19 10:26:14 +00:00
|
|
|
required super.iso,
|
|
|
|
required super.nd,
|
|
|
|
required super.exposurePairs,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
class MeteringEndedState extends MeteringDataState {
|
2023-04-01 18:58:23 +00:00
|
|
|
const MeteringEndedState({
|
2023-02-19 10:26:14 +00:00
|
|
|
required super.ev,
|
2023-04-01 18:58:23 +00:00
|
|
|
required super.film,
|
2023-02-19 10:26:14 +00:00
|
|
|
required super.iso,
|
|
|
|
required super.nd,
|
|
|
|
required super.exposurePairs,
|
|
|
|
});
|
|
|
|
}
|