2023-01-29 16:57:47 +00:00
|
|
|
import 'package:camera/camera.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
2023-02-10 21:49:51 +00:00
|
|
|
import 'package:lightmeter/screens/metering/components/camera_container/models/camera_error_type.dart';
|
2023-01-29 16:57:47 +00:00
|
|
|
|
|
|
|
abstract class CameraContainerState {
|
|
|
|
const CameraContainerState();
|
|
|
|
}
|
|
|
|
|
|
|
|
class CameraInitState extends CameraContainerState {
|
|
|
|
const CameraInitState();
|
|
|
|
}
|
|
|
|
|
|
|
|
class CameraLoadingState extends CameraContainerState {
|
|
|
|
const CameraLoadingState();
|
|
|
|
}
|
|
|
|
|
|
|
|
class CameraInitializedState extends CameraContainerState {
|
|
|
|
final CameraController controller;
|
|
|
|
|
|
|
|
const CameraInitializedState(this.controller);
|
|
|
|
}
|
|
|
|
|
|
|
|
class CameraActiveState extends CameraContainerState {
|
|
|
|
final RangeValues zoomRange;
|
|
|
|
final double currentZoom;
|
|
|
|
final RangeValues exposureOffsetRange;
|
|
|
|
final double? exposureOffsetStep;
|
|
|
|
final double currentExposureOffset;
|
|
|
|
|
|
|
|
const CameraActiveState({
|
|
|
|
required this.zoomRange,
|
|
|
|
required this.currentZoom,
|
|
|
|
required this.exposureOffsetRange,
|
|
|
|
required this.exposureOffsetStep,
|
|
|
|
required this.currentExposureOffset,
|
|
|
|
});
|
2023-06-14 21:23:54 +00:00
|
|
|
|
|
|
|
@override
|
|
|
|
bool operator ==(Object other) {
|
|
|
|
if (identical(this, other)) return true;
|
|
|
|
if (other.runtimeType != runtimeType) return false;
|
|
|
|
return other is CameraActiveState &&
|
|
|
|
other.zoomRange == zoomRange &&
|
|
|
|
other.currentZoom == currentZoom &&
|
|
|
|
other.exposureOffsetRange == exposureOffsetRange &&
|
|
|
|
other.exposureOffsetStep == exposureOffsetStep &&
|
|
|
|
other.currentExposureOffset == currentExposureOffset;
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
int get hashCode => Object.hash(
|
|
|
|
runtimeType,
|
|
|
|
zoomRange,
|
|
|
|
currentZoom,
|
|
|
|
exposureOffsetRange,
|
|
|
|
exposureOffsetStep,
|
|
|
|
currentExposureOffset,
|
|
|
|
);
|
2023-01-29 16:57:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
class CameraErrorState extends CameraContainerState {
|
2023-02-10 21:49:51 +00:00
|
|
|
final CameraErrorType error;
|
|
|
|
|
|
|
|
const CameraErrorState(this.error);
|
2023-06-20 06:26:25 +00:00
|
|
|
|
|
|
|
@override
|
|
|
|
bool operator ==(Object other) {
|
|
|
|
if (identical(this, other)) return true;
|
|
|
|
if (other.runtimeType != runtimeType) return false;
|
|
|
|
return other is CameraErrorState && other.error == error;
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
int get hashCode => Object.hash(error, runtimeType);
|
2023-01-29 16:57:47 +00:00
|
|
|
}
|