mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-10-19 23:00:39 +00:00
74d0a7101c
* removed redundant `UserPreferencesService` from `MeteringBloc` * wip * post-merge fixes * `MeasureEvent` tests * `MeasureEvent` tests revision * `MeasureEvent` tests added timeout * added stubs for other `MeteringBloc` events * rewritten `MeteringBloc` logic * wip * `IsoChangedEvent` tests * refined `IsoChangedEvent` tests * `NdChangedEvent` tests * `FilmChangedEvent` tests * `MeteringCommunicationBloc` tests * added test run to ci * overriden `==` for `MeasuredState` * `LuxMeteringEvent` tests * refined `LuxMeteringEvent` tests * rename * wip * wip * `InitializeEvent`/`DeinitializeEvent` tests * clamp minZoomLevel * fixed `MeteringCommunicationBloc` tests * wip * `ZoomChangedEvent` tests * `ExposureOffsetChangedEvent`/`ExposureOffsetResetEvent` tests * renamed test groups * added test coverage script * improved `CameraContainerBloc` test coverage * `EquipmentProfileChangedEvent` tests * verify response vibration * fixed running all tests * `MeteringCommunicationBloc` equality tests * `CameraContainerBloc` equality tests * removed generated code from coverage
75 lines
2 KiB
Dart
75 lines
2 KiB
Dart
import 'package:camera/camera.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:lightmeter/screens/metering/components/camera_container/models/camera_error_type.dart';
|
|
|
|
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,
|
|
});
|
|
|
|
@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,
|
|
);
|
|
}
|
|
|
|
class CameraErrorState extends CameraContainerState {
|
|
final CameraErrorType error;
|
|
|
|
const CameraErrorState(this.error);
|
|
|
|
@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);
|
|
}
|