@@ -54,6 +54,11 @@ class SubtitleEditorState {
5454 /// 不阻断整个编辑流程。与「加载中(waveform == null 且未失败)」显式区分,
5555 /// 避免失败被误显示成永久「加载 0%」。
5656 final bool waveformFailed;
57+
58+ /// 当前 item 没有本地音频文件,无法生成波形。
59+ ///
60+ /// 这不是波形提取失败:用户仍可编辑已有字幕,但没有可重试的本地音频输入。
61+ final bool waveformAudioMissing;
5762 final double playbackSpeed;
5863 final double waveformZoomScale;
5964
@@ -93,6 +98,7 @@ class SubtitleEditorState {
9398 this .waveform,
9499 this .waveformProgress = 0 ,
95100 this .waveformFailed = false ,
101+ this .waveformAudioMissing = false ,
96102 this .playbackSpeed = 1.0 ,
97103 this .waveformZoomScale = 1.0 ,
98104 this .maxWaveformZoomScale = 1.0 ,
@@ -130,6 +136,7 @@ class SubtitleEditorState {
130136 Waveform ? waveform,
131137 double ? waveformProgress,
132138 bool ? waveformFailed,
139+ bool ? waveformAudioMissing,
133140 double ? playbackSpeed,
134141 double ? waveformZoomScale,
135142 double ? maxWaveformZoomScale,
@@ -161,6 +168,7 @@ class SubtitleEditorState {
161168 waveform: waveform ?? this .waveform,
162169 waveformProgress: waveformProgress ?? this .waveformProgress,
163170 waveformFailed: waveformFailed ?? this .waveformFailed,
171+ waveformAudioMissing: waveformAudioMissing ?? this .waveformAudioMissing,
164172 playbackSpeed: playbackSpeed ?? this .playbackSpeed,
165173 waveformZoomScale: waveformZoomScale ?? this .waveformZoomScale,
166174 maxWaveformZoomScale: maxWaveformZoomScale ?? this .maxWaveformZoomScale,
@@ -1226,7 +1234,11 @@ class SubtitleEditorController extends StateNotifier<SubtitleEditorState> {
12261234 /// 重新尝试提取波形(失败态下用户点「重试」)。
12271235 Future <void > retryWaveform () async {
12281236 if (_loadingWaveform) return ;
1229- state = state.copyWith (waveformFailed: false , waveformProgress: 0 );
1237+ state = state.copyWith (
1238+ waveformFailed: false ,
1239+ waveformAudioMissing: false ,
1240+ waveformProgress: 0 ,
1241+ );
12301242 await _loadWaveform ();
12311243 }
12321244
@@ -1236,7 +1248,7 @@ class SubtitleEditorController extends StateNotifier<SubtitleEditorState> {
12361248 try {
12371249 final audioPath = await state.audioItem.getFullAudioPath ();
12381250 if (audioPath == null ) {
1239- if (mounted) state = state.copyWith (waveformFailed : true );
1251+ if (mounted) state = state.copyWith (waveformAudioMissing : true );
12401252 return ;
12411253 }
12421254 final dataDir = await getAppDataDirectory ();
@@ -1248,7 +1260,11 @@ class SubtitleEditorController extends StateNotifier<SubtitleEditorState> {
12481260 if (await waveFile.exists ()) {
12491261 final waveform = await JustWaveform .parse (waveFile);
12501262 if (! mounted) return ;
1251- state = state.copyWith (waveform: waveform, waveformProgress: 1 );
1263+ state = state.copyWith (
1264+ waveform: waveform,
1265+ waveformProgress: 1 ,
1266+ waveformAudioMissing: false ,
1267+ );
12521268 return ;
12531269 }
12541270
@@ -1263,6 +1279,7 @@ class SubtitleEditorController extends StateNotifier<SubtitleEditorState> {
12631279 state = state.copyWith (
12641280 waveform: progress.waveform,
12651281 waveformProgress: progress.progress,
1282+ waveformAudioMissing: false ,
12661283 );
12671284 }
12681285 } catch (_) {
0 commit comments