TLA Line data Source code
1 : // Copyright (c) 2026 Flipdare Pty Ltd. All rights reserved.
2 : //
3 : // This file is part of Flipdare's proprietary software and contains
4 : // confidential and copyrighted material. Unauthorised copying,
5 : // modification, distribution, or use of this file is strictly
6 : // prohibited without prior written permission from Flipdare Pty Ltd.
7 : //
8 : // This software includes third-party components licensed under MIT,
9 : // BSD, and Apache 2.0 licences. See THIRD_PARTY_NOTICES for details.
10 : //
11 :
12 : import 'package:camera/camera.dart';
13 :
14 : enum CameraState {
15 : setup,
16 : initializing,
17 : ready,
18 : recording,
19 : paused,
20 : resumed,
21 : stopped,
22 : error;
23 :
24 HIT 1 : static CameraState fromController(CameraController? controller) {
25 : if (controller == null) return CameraState.setup;
26 :
27 2 : if (!controller.value.isInitialized) {
28 : return CameraState.initializing;
29 : }
30 :
31 2 : if (!controller.value.isRecordingVideo) {
32 : return CameraState.ready;
33 : }
34 :
35 2 : return (controller.value.isRecordingPaused) ? CameraState.paused : CameraState.recording;
36 : }
37 :
38 1 : bool get isSettingUp =>
39 2 : (this == CameraState.initializing || this == CameraState.setup) ? true : false;
40 2 : bool get isError => (this == CameraState.error) ? true : false;
41 2 : bool get isRecording => (this == CameraState.recording) ? true : false;
42 2 : bool get isPaused => (this == CameraState.paused) ? true : false;
43 2 : bool get isResumed => (this == CameraState.resumed) ? true : false;
44 2 : bool get isStopped => (this == CameraState.stopped) ? true : false;
45 :
46 2 : bool get isRecordingNotPaused => (this == CameraState.recording) ? true : false;
47 1 : bool get isPausedOrNotRecording =>
48 2 : (this == CameraState.paused || this == CameraState.ready) ? true : false;
49 :
50 4 : bool get showTimer => isRecording || isPaused || isResumed;
51 4 : bool get hasContent => isResumed || isPaused || isRecording;
52 : }
|