feat(apps): 重构 UI 架构为 presentation 层并新增 l10n 国际化支持

This commit is contained in:
qzl
2026-03-27 14:05:03 +08:00
parent b1f0eb8921
commit c592cc7854
178 changed files with 10748 additions and 5764 deletions
@@ -3,6 +3,8 @@ import 'dart:io';
import 'package:flutter/services.dart';
import 'package:record/record.dart';
import '../../../core/l10n/l10n.dart';
abstract class VoiceRecorder {
Future<void> start();
Future<String?> stop();
@@ -22,10 +24,10 @@ class RecordVoiceRecorder implements VoiceRecorder {
try {
hasPermission = await _recorder.hasPermission();
} on MissingPluginException catch (_) {
throw StateError('录音组件未加载,请完全重启 App 后重试');
throw StateError(L10n.current.homeRecorderPluginUnavailable);
}
if (!hasPermission) {
throw StateError('录音权限未授权');
throw StateError(L10n.current.homeRecorderPermissionDenied);
}
final fileName =
@@ -42,7 +44,7 @@ class RecordVoiceRecorder implements VoiceRecorder {
path: path,
);
} on MissingPluginException catch (_) {
throw StateError('录音组件未加载,请完全重启 App 后重试');
throw StateError(L10n.current.homeRecorderPluginUnavailable);
}
}
@@ -52,7 +54,7 @@ class RecordVoiceRecorder implements VoiceRecorder {
try {
stoppedPath = await _recorder.stop();
} on MissingPluginException catch (_) {
throw StateError('录音组件未加载,请完全重启 App 后重试');
throw StateError(L10n.current.homeRecorderPluginUnavailable);
}
return stoppedPath ?? _currentPath;
}