88 lines
3.2 KiB
Dart
88 lines
3.2 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
import 'core/theme/teacher_theme.dart';
|
|
import 'data/repositories/teacher_repository.dart';
|
|
import 'logic/cubits/teacher_auth_cubit.dart';
|
|
import 'logic/cubits/teacher_studio_cubit.dart';
|
|
import 'logic/cubits/teacher_monetization_cubit.dart';
|
|
import 'logic/cubits/teacher_qna_cubit.dart';
|
|
import 'presentation/screens/auth/teacher_auth_screen.dart';
|
|
import 'presentation/screens/teacher_main_shell.dart';
|
|
|
|
/**
|
|
* ==============================================================================
|
|
* SAQEL ENTERPRISE (EDTECH 2.0) - TEACHER STUDIO APP (ZERO-MOCK PRODUCTION)
|
|
* ==============================================================================
|
|
*
|
|
* نقطة انطلاق تطبيق استوديو المعلم المعتمد:
|
|
* - بوابة مصادقة حقيقية عبر الواتساب (WhatsApp OTP via Nabeh Gateway)
|
|
* - استعلام وتحديد الصفوف والمواد التي يدرسها المعلم
|
|
* - غرفة المحادثات الحية والردود الصوتية السقراطية (Socratic Voice Notes)
|
|
* - بث مقاطع صوتية توجيهية لكافة طلبة الشعبة عبر الويب سوكت (0ms Broadcast).
|
|
*/
|
|
void main() {
|
|
WidgetsFlutterBinding.ensureInitialized();
|
|
final repository = TeacherRepository();
|
|
|
|
runApp(SaqelTeacherApp(repository: repository));
|
|
}
|
|
|
|
class SaqelTeacherApp extends StatelessWidget {
|
|
final TeacherRepository repository;
|
|
|
|
SaqelTeacherApp({super.key, TeacherRepository? repository})
|
|
: repository = repository ?? TeacherRepository();
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return MultiBlocProvider(
|
|
providers: [
|
|
BlocProvider<TeacherAuthCubit>(
|
|
create: (_) =>
|
|
TeacherAuthCubit(repository: repository)..checkSession(),
|
|
),
|
|
BlocProvider<TeacherStudioCubit>(
|
|
create: (_) => TeacherStudioCubit(repository: repository),
|
|
),
|
|
BlocProvider<TeacherMonetizationCubit>(
|
|
create: (_) => TeacherMonetizationCubit(repository: repository),
|
|
),
|
|
BlocProvider<TeacherQnACubit>(
|
|
create: (_) => TeacherQnACubit(repository: repository),
|
|
),
|
|
],
|
|
child: MaterialApp(
|
|
title: 'صَقِل — استوديو المعلم المعتمد',
|
|
debugShowCheckedModeBanner: false,
|
|
theme: TeacherTheme.darkTheme,
|
|
home: const TeacherAuthGate(),
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
class TeacherAuthGate extends StatelessWidget {
|
|
const TeacherAuthGate({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return BlocBuilder<TeacherAuthCubit, TeacherAuthState>(
|
|
builder: (context, state) {
|
|
if (state is TeacherAuthenticated) {
|
|
return TeacherMainShell(initialProfile: state.profile);
|
|
} else if (state is TeacherAuthInitial) {
|
|
return const Scaffold(
|
|
backgroundColor: TeacherTheme.backgroundDark,
|
|
body: Center(
|
|
child:
|
|
CircularProgressIndicator(color: TeacherTheme.emeraldPrimary),
|
|
),
|
|
);
|
|
}
|
|
// Keep TeacherAuthScreen mounted during TeacherAuthLoading, TeacherAuthOtpSent, TeacherAuthError, etc.
|
|
return const TeacherAuthScreen();
|
|
},
|
|
);
|
|
}
|
|
}
|