30 lines
1.4 KiB
Dart
30 lines
1.4 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import '../app/app_controller.dart';
|
|
import '../core/file_ops.dart' show samePath;
|
|
import '../l10n/tr.dart';
|
|
|
|
/// "완료 시 자동 동영상 추가" 로 다 받은 동영상을 MKV 목록에 넣고 다운로드 목록에서 뺐을 때의 알림.
|
|
/// 줄이 갑자기 사라져 "다운로드 (0)" 이 된 이유를 알 수 있게 [보기] (MKV 화면 · 그 동영상) 를 함께 (관리자 판단, 931)
|
|
void showAddedToMkvNotice(GlobalKey<ScaffoldMessengerState> messenger, GlobalKey<NavigatorState> navigator,
|
|
AppController c, {required String title, required List<String> files, required int added}) {
|
|
final m = messenger.currentState;
|
|
if (m == null) return;
|
|
m.showSnackBar(SnackBar(
|
|
duration: const Duration(seconds: 8),
|
|
showCloseIcon: true,
|
|
content: Text(added > 0
|
|
? trf('다 받은 {0} 을 MKV 목록에 넣고 다운로드 목록에서 뺐습니다 (받은 파일은 그대로)', [title])
|
|
: trf('다 받은 {0} 은 이미 MKV 목록에 있어 다운로드 목록에서 뺐습니다 (받은 파일은 그대로)', [title])),
|
|
action: SnackBarAction(
|
|
label: tr('보기'),
|
|
onPressed: () {
|
|
// MKV 화면 (맨 처음 화면) 으로 가서 그 동영상을 보이게
|
|
navigator.currentState?.popUntil((r) => r.isFirst);
|
|
final v = c.videos.where((x) => files.any((f) => samePath(f, x.path))).firstOrNull;
|
|
if (v != null) c.select(v);
|
|
},
|
|
),
|
|
));
|
|
}
|