2
2
/// [Author] Alex (https://github.com/AlexV525)
3
3
/// [Date] 2020/7/16 11:07
4
4
///
5
+ import 'package:camera/camera.dart' show CameraLensDirection, FlashMode;
5
6
6
- /// Text delegate that controls text in widgets.
7
- /// 控制部件中的文字实现
8
- abstract class CameraPickerTextDelegate {
7
+ /// Text delegate that controls text in widgets, implemented with Chinese .
8
+ /// 控制部件中的文字实现,中文。
9
+ class CameraPickerTextDelegate {
9
10
/// Confirm string for the confirm button.
10
11
/// 确认按钮的字段
11
- String get confirm;
12
+ String get confirm => '确认' ;
12
13
13
14
/// Tips string above the shooting button before shooting.
14
15
/// 拍摄前确认按钮上方的提示文字
15
- String get shootingTips;
16
+ String get shootingTips => '轻触拍照' ;
16
17
17
18
/// Load failed string for item.
18
19
/// 资源加载失败时的字段
19
- String get loadFailed;
20
- }
20
+ String get loadFailed => '加载失败' ;
21
21
22
- /// Default text delegate implements with Chinese .
23
- /// 中文文字实现
24
- class DefaultCameraPickerTextDelegate extends CameraPickerTextDelegate {
25
- @override
26
- String get confirm => '确认 ' ;
22
+ /// Semantics fields .
23
+ ///
24
+ /// Fields below are only for semantics usage. For customizable these fields,
25
+ /// head over to [EnglishCameraPickerTextDelegate] for fields understanding.
26
+ String get sActionManuallyFocusHint => '手动聚焦 ' ;
27
27
28
- @override
29
- String get shootingTips => '轻触拍照' ;
28
+ String get sActionPreviewHint => '预览' ;
30
29
31
- @override
32
- String get loadFailed => '加载失败' ;
30
+ String get sActionRecordHint => '录像' ;
31
+
32
+ String get sActionShootHint => '拍照' ;
33
+
34
+ String get sActionShootingButtonTooltip => '拍照按钮' ;
35
+
36
+ String get sActionStopRecordingHint => '停止录像' ;
37
+
38
+ String get sActionSwitchCameraTooltip => '切换摄像头' ;
39
+
40
+ String get sActionToggleFlashModeTooltip => '切换闪光模式' ;
41
+
42
+ String sCameraLensDirectionLabel (CameraLensDirection value) {
43
+ final String _direction;
44
+ switch (value) {
45
+ case CameraLensDirection .front:
46
+ _direction = '前置' ;
47
+ break ;
48
+ case CameraLensDirection .back:
49
+ _direction = '后置' ;
50
+ break ;
51
+ case CameraLensDirection .external :
52
+ _direction = '外置' ;
53
+ break ;
54
+ }
55
+ return '当前摄像头: $_direction ' ;
56
+ }
57
+
58
+ String sFlashModeLabel (FlashMode mode) {
59
+ final String _modeString;
60
+ switch (mode) {
61
+ case FlashMode .off:
62
+ _modeString = '关闭' ;
63
+ break ;
64
+ case FlashMode .auto:
65
+ _modeString = '自动' ;
66
+ break ;
67
+ case FlashMode .always:
68
+ _modeString = '拍照时闪光' ;
69
+ break ;
70
+ case FlashMode .torch:
71
+ _modeString = '始终闪光' ;
72
+ break ;
73
+ }
74
+ return '当前闪光模式: $_modeString ' ;
75
+ }
33
76
}
34
77
35
78
/// Default text delegate including recording implements with Chinese.
36
79
/// 中文文字实现(包括摄像)
37
- class DefaultCameraPickerTextDelegateWithRecording
38
- extends DefaultCameraPickerTextDelegate {
80
+ class CameraPickerTextDelegateWithRecording extends CameraPickerTextDelegate {
39
81
@override
40
82
String get shootingTips => '轻触拍照,长按摄像' ;
41
83
}
42
84
43
85
/// Default text delegate including only recording implements with Chinese.
44
86
/// 中文文字实现(仅摄像)
45
- class DefaultCameraPickerTextDelegateWithOnlyRecording
46
- extends DefaultCameraPickerTextDelegate {
87
+ class CameraPickerTextDelegateWithOnlyRecording
88
+ extends CameraPickerTextDelegate {
47
89
@override
48
90
String get shootingTips => '长按摄像' ;
49
91
}
50
92
51
93
/// Default text delegate including tap recording implements with Chinese.
52
94
/// 中文文字实现(仅轻触摄像)
53
- class DefaultCameraPickerTextDelegateWithTapRecording
54
- extends DefaultCameraPickerTextDelegate {
95
+ class CameraPickerTextDelegateWithTapRecording
96
+ extends CameraPickerTextDelegate {
55
97
@override
56
98
String get shootingTips => '轻触摄像' ;
57
99
}
58
100
59
101
/// Default text delegate implements with English.
60
102
/// 英文文字实现
61
- class EnglishCameraPickerTextDelegate implements CameraPickerTextDelegate {
103
+ class EnglishCameraPickerTextDelegate extends CameraPickerTextDelegate {
62
104
@override
63
105
String get confirm => 'Confirm' ;
64
106
@@ -67,6 +109,38 @@ class EnglishCameraPickerTextDelegate implements CameraPickerTextDelegate {
67
109
68
110
@override
69
111
String get loadFailed => 'Load failed' ;
112
+
113
+ @override
114
+ String get sActionManuallyFocusHint => 'manually focus' ;
115
+
116
+ @override
117
+ String get sActionPreviewHint => 'preview' ;
118
+
119
+ @override
120
+ String get sActionRecordHint => 'record' ;
121
+
122
+ @override
123
+ String get sActionShootHint => 'take picture' ;
124
+
125
+ @override
126
+ String get sActionShootingButtonTooltip => 'shooting button' ;
127
+
128
+ @override
129
+ String get sActionStopRecordingHint => 'stop recording' ;
130
+
131
+ @override
132
+ String get sActionSwitchCameraTooltip => 'switch camera' ;
133
+
134
+ @override
135
+ String get sActionToggleFlashModeTooltip => 'toggle flashlight' ;
136
+
137
+ @override
138
+ String sCameraLensDirectionLabel (CameraLensDirection value) =>
139
+ 'Current camera lens direction: ${value .name }' ;
140
+
141
+ @override
142
+ String sFlashModeLabel (FlashMode mode) =>
143
+ 'Current flashlight mode: ${mode .name }' ;
70
144
}
71
145
72
146
/// Default text delegate including recording implements with English.
0 commit comments