Update Saqel Platform: 2026-09-20 16:38:51
This commit is contained in:
@@ -38,6 +38,8 @@ class TeacherStudioState {
|
||||
final String? uploadSuccessMessage;
|
||||
final double uploadProgress;
|
||||
final String uploadPhase;
|
||||
final bool isReplacement;
|
||||
final int versionNumber;
|
||||
|
||||
const TeacherStudioState({
|
||||
required this.lessonTitle,
|
||||
@@ -62,6 +64,8 @@ class TeacherStudioState {
|
||||
this.uploadSuccessMessage,
|
||||
this.uploadProgress = 0.0,
|
||||
this.uploadPhase = 'idle',
|
||||
this.isReplacement = false,
|
||||
this.versionNumber = 1,
|
||||
});
|
||||
|
||||
TeacherStudioState copyWith({
|
||||
@@ -88,6 +92,8 @@ class TeacherStudioState {
|
||||
String? uploadSuccessMessage,
|
||||
double? uploadProgress,
|
||||
String? uploadPhase,
|
||||
bool? isReplacement,
|
||||
int? versionNumber,
|
||||
}) {
|
||||
return TeacherStudioState(
|
||||
lessonTitle: lessonTitle ?? this.lessonTitle,
|
||||
@@ -112,6 +118,8 @@ class TeacherStudioState {
|
||||
uploadSuccessMessage: uploadSuccessMessage ?? this.uploadSuccessMessage,
|
||||
uploadProgress: uploadProgress ?? this.uploadProgress,
|
||||
uploadPhase: uploadPhase ?? this.uploadPhase,
|
||||
isReplacement: isReplacement ?? this.isReplacement,
|
||||
versionNumber: versionNumber ?? this.versionNumber,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -359,6 +367,12 @@ class TeacherStudioCubit extends Cubit<TeacherStudioState> {
|
||||
));
|
||||
return false;
|
||||
}
|
||||
final isReplacement = preflight['replacement'] == true;
|
||||
final versionNum = (preflight['version_number'] as num?)?.toInt() ?? 1;
|
||||
emit(state.copyWith(
|
||||
isReplacement: isReplacement,
|
||||
versionNumber: versionNum,
|
||||
));
|
||||
final videoVersionId = preflight['video_version_id']?.toString();
|
||||
if (videoVersionId == null || videoVersionId.isEmpty) {
|
||||
throw StateError('لم ينشئ الخادم نسخة فيديو صالحة للرفع.');
|
||||
|
||||
@@ -553,6 +553,29 @@ class _TeacherStudioUploadTabState extends State<TeacherStudioUploadTab> {
|
||||
minHeight: 8,
|
||||
),
|
||||
),
|
||||
if (state.isReplacement) ...[
|
||||
const SizedBox(height: 10),
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 6),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.amber.withOpacity(0.12),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.all(color: Colors.amber.withOpacity(0.35)),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
const Icon(CupertinoIcons.arrow_2_circlepath, color: Colors.amber, size: 14),
|
||||
const SizedBox(width: 6),
|
||||
Expanded(
|
||||
child: Text(
|
||||
'نسخة مرشحة للاستبدال (إصدار ${state.versionNumber}) — الحصة المنشورة الحالية تظل متاحة للطلاب حتى اجتياز الفحص.',
|
||||
style: const TextStyle(color: Colors.amber, fontSize: 11, fontWeight: FontWeight.bold),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user