Update Saqel Platform: 2026-09-08 18:19:28
This commit is contained in:
@@ -63,7 +63,8 @@ class _TeacherAuthScreenState extends State<TeacherAuthScreen> {
|
||||
void _onSendOtp() {
|
||||
final phone = _phoneController.text.trim();
|
||||
if (phone.isEmpty || phone.length < 9) {
|
||||
SaqelToast.showError(context, 'يرجى إدخال رقم هاتف أردني صحيح يبدأ بـ 07');
|
||||
SaqelToast.showError(
|
||||
context, 'يرجى إدخال رقم هاتف أردني صحيح يبدأ بـ 07');
|
||||
return;
|
||||
}
|
||||
context.read<TeacherAuthCubit>().sendOtp(phone);
|
||||
@@ -76,18 +77,22 @@ class _TeacherAuthScreenState extends State<TeacherAuthScreen> {
|
||||
SaqelToast.showError(context, 'يرجى إدخال رمز التحقق المكون من 6 أرقام');
|
||||
return;
|
||||
}
|
||||
if (_fullNameController.text.trim().isEmpty || _selectedSubject == null || _schoolController.text.trim().isEmpty || _selectedGrades.isEmpty) {
|
||||
SaqelToast.showError(context, 'أكمل الاسم والمادة والمدرسة وصفًا واحدًا على الأقل قبل التحقق');
|
||||
if (_fullNameController.text.trim().isEmpty ||
|
||||
_selectedSubject == null ||
|
||||
_schoolController.text.trim().isEmpty ||
|
||||
_selectedGrades.isEmpty) {
|
||||
SaqelToast.showError(context,
|
||||
'أكمل الاسم والمادة والمدرسة وصفًا واحدًا على الأقل قبل التحقق');
|
||||
return;
|
||||
}
|
||||
context.read<TeacherAuthCubit>().verifyOtp(
|
||||
phone,
|
||||
otp,
|
||||
fullName: _fullNameController.text.trim(),
|
||||
specialization: _selectedSubject,
|
||||
schoolName: _schoolController.text.trim(),
|
||||
gradesTaught: _selectedGrades.toList(),
|
||||
);
|
||||
phone,
|
||||
otp,
|
||||
fullName: _fullNameController.text.trim(),
|
||||
specialization: _selectedSubject,
|
||||
schoolName: _schoolController.text.trim(),
|
||||
gradesTaught: _selectedGrades.toList(),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -105,7 +110,8 @@ class _TeacherAuthScreenState extends State<TeacherAuthScreen> {
|
||||
child: BlocConsumer<TeacherAuthCubit, TeacherAuthState>(
|
||||
listener: (context, state) {
|
||||
if (state is TeacherAuthError) {
|
||||
SaqelToast.showError(context, state.message, title: 'تنبيه المصادقة');
|
||||
SaqelToast.showError(context, state.message,
|
||||
title: 'تنبيه المصادقة');
|
||||
} else if (state is TeacherAuthOtpSent) {
|
||||
setState(() => _isEnteringOtp = true);
|
||||
SaqelToast.showWhatsApp(
|
||||
@@ -117,14 +123,16 @@ class _TeacherAuthScreenState extends State<TeacherAuthScreen> {
|
||||
},
|
||||
builder: (context, state) {
|
||||
final isLoading = state is TeacherAuthLoading;
|
||||
final isOtpStep = _isEnteringOtp || state is TeacherAuthOtpSent;
|
||||
final isOtpStep =
|
||||
_isEnteringOtp || state is TeacherAuthOtpSent;
|
||||
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(28),
|
||||
decoration: BoxDecoration(
|
||||
color: TeacherTheme.surfaceDark,
|
||||
borderRadius: BorderRadius.circular(24),
|
||||
border: Border.all(color: TeacherTheme.surfaceBorder, width: 1.2),
|
||||
border: Border.all(
|
||||
color: TeacherTheme.surfaceBorder, width: 1.2),
|
||||
boxShadow: const [
|
||||
BoxShadow(
|
||||
color: Color(0x3310B981),
|
||||
@@ -143,7 +151,10 @@ class _TeacherAuthScreenState extends State<TeacherAuthScreen> {
|
||||
height: 68,
|
||||
decoration: BoxDecoration(
|
||||
gradient: const LinearGradient(
|
||||
colors: [TeacherTheme.emeraldPrimary, TeacherTheme.emeraldDark],
|
||||
colors: [
|
||||
TeacherTheme.emeraldPrimary,
|
||||
TeacherTheme.emeraldDark
|
||||
],
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
),
|
||||
@@ -194,11 +205,14 @@ class _TeacherAuthScreenState extends State<TeacherAuthScreen> {
|
||||
// Backend Live Gateway Badge
|
||||
Center(
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 4),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 12, vertical: 4),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFF0C241D),
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
border: Border.all(color: TeacherTheme.emeraldPrimary.withOpacity(0.4)),
|
||||
border: Border.all(
|
||||
color: TeacherTheme.emeraldPrimary
|
||||
.withOpacity(0.4)),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
@@ -213,7 +227,9 @@ class _TeacherAuthScreenState extends State<TeacherAuthScreen> {
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
Text(
|
||||
AppConfig.baseUrl.replaceAll('https://', '').replaceAll('http://', ''),
|
||||
AppConfig.baseUrl
|
||||
.replaceAll('https://', '')
|
||||
.replaceAll('http://', ''),
|
||||
style: const TextStyle(
|
||||
color: TeacherTheme.emeraldLight,
|
||||
fontSize: 11,
|
||||
@@ -230,7 +246,10 @@ class _TeacherAuthScreenState extends State<TeacherAuthScreen> {
|
||||
// Step 1: Teacher Info & Phone
|
||||
const Text(
|
||||
'اسم المعلم المعتمد:',
|
||||
style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 12.5),
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 12.5),
|
||||
),
|
||||
const SizedBox(height: 6),
|
||||
_buildTextField(
|
||||
@@ -242,30 +261,41 @@ class _TeacherAuthScreenState extends State<TeacherAuthScreen> {
|
||||
|
||||
const Text(
|
||||
'المادة الأكاديمية التخصصية:',
|
||||
style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 12.5),
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 12.5),
|
||||
),
|
||||
const SizedBox(height: 6),
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12),
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 12),
|
||||
decoration: BoxDecoration(
|
||||
color: TeacherTheme.surfaceCard,
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
border: Border.all(color: TeacherTheme.surfaceBorder),
|
||||
border: Border.all(
|
||||
color: TeacherTheme.surfaceBorder),
|
||||
),
|
||||
child: DropdownButtonHideUnderline(
|
||||
child: DropdownButton<String>(
|
||||
value: _selectedSubject,
|
||||
isExpanded: true,
|
||||
dropdownColor: TeacherTheme.surfaceDark,
|
||||
icon: const Icon(CupertinoIcons.chevron_down, color: TeacherTheme.emeraldPrimary, size: 18),
|
||||
icon: const Icon(CupertinoIcons.chevron_down,
|
||||
color: TeacherTheme.emeraldPrimary,
|
||||
size: 18),
|
||||
items: _availableSubjects.map((s) {
|
||||
return DropdownMenuItem(
|
||||
value: s,
|
||||
child: Text(s, style: const TextStyle(color: Colors.white, fontSize: 12.5)),
|
||||
child: Text(s,
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 12.5)),
|
||||
);
|
||||
}).toList(),
|
||||
onChanged: (val) {
|
||||
if (val != null) setState(() => _selectedSubject = val);
|
||||
if (val != null)
|
||||
setState(() => _selectedSubject = val);
|
||||
},
|
||||
),
|
||||
),
|
||||
@@ -274,7 +304,10 @@ class _TeacherAuthScreenState extends State<TeacherAuthScreen> {
|
||||
|
||||
const Text(
|
||||
'المدرسة / المديرية التابع لها:',
|
||||
style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 12.5),
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 12.5),
|
||||
),
|
||||
const SizedBox(height: 6),
|
||||
_buildTextField(
|
||||
@@ -286,21 +319,34 @@ class _TeacherAuthScreenState extends State<TeacherAuthScreen> {
|
||||
|
||||
const Text(
|
||||
'الصفوف والشعب التي تدرسها:',
|
||||
style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 12.5),
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 12.5),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Wrap(
|
||||
spacing: 8,
|
||||
runSpacing: 8,
|
||||
children: _allGrades.map((grade) {
|
||||
final isSelected = _selectedGrades.contains(grade);
|
||||
final isSelected =
|
||||
_selectedGrades.contains(grade);
|
||||
return FilterChip(
|
||||
selected: isSelected,
|
||||
label: Text(grade, style: TextStyle(color: isSelected ? Colors.black : Colors.white, fontSize: 11.5, fontWeight: FontWeight.bold)),
|
||||
label: Text(grade,
|
||||
style: TextStyle(
|
||||
color: isSelected
|
||||
? Colors.black
|
||||
: Colors.white,
|
||||
fontSize: 11.5,
|
||||
fontWeight: FontWeight.bold)),
|
||||
selectedColor: TeacherTheme.emeraldPrimary,
|
||||
backgroundColor: TeacherTheme.surfaceCard,
|
||||
checkmarkColor: Colors.black,
|
||||
side: BorderSide(color: isSelected ? TeacherTheme.emeraldPrimary : TeacherTheme.surfaceBorder),
|
||||
side: BorderSide(
|
||||
color: isSelected
|
||||
? TeacherTheme.emeraldPrimary
|
||||
: TeacherTheme.surfaceBorder),
|
||||
onSelected: (selected) {
|
||||
setState(() {
|
||||
if (selected) {
|
||||
@@ -319,7 +365,10 @@ class _TeacherAuthScreenState extends State<TeacherAuthScreen> {
|
||||
|
||||
const Text(
|
||||
'رقم الهاتف للدخول والتحقق (WhatsApp OTP):',
|
||||
style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 12.5),
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 12.5),
|
||||
),
|
||||
const SizedBox(height: 6),
|
||||
_buildTextField(
|
||||
@@ -335,15 +384,23 @@ class _TeacherAuthScreenState extends State<TeacherAuthScreen> {
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: TeacherTheme.emeraldPrimary,
|
||||
foregroundColor: Colors.black,
|
||||
padding: const EdgeInsets.symmetric(vertical: 16),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(14)),
|
||||
padding:
|
||||
const EdgeInsets.symmetric(vertical: 16),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(14)),
|
||||
elevation: 0,
|
||||
),
|
||||
child: isLoading
|
||||
? const SizedBox(width: 20, height: 20, child: CircularProgressIndicator(color: Colors.black, strokeWidth: 2))
|
||||
? const SizedBox(
|
||||
width: 20,
|
||||
height: 20,
|
||||
child: CircularProgressIndicator(
|
||||
color: Colors.black, strokeWidth: 2))
|
||||
: const Text(
|
||||
'إرسال رمز التحقق عبر الواتساب 📲',
|
||||
style: TextStyle(fontSize: 14, fontWeight: FontWeight.w900),
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w900),
|
||||
),
|
||||
),
|
||||
] else ...[
|
||||
@@ -353,25 +410,34 @@ class _TeacherAuthScreenState extends State<TeacherAuthScreen> {
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFF0C241D),
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
border: Border.all(color: const Color(0xFF25D366).withOpacity(0.5)),
|
||||
border: Border.all(
|
||||
color: const Color(0xFF25D366)
|
||||
.withOpacity(0.5)),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: const [
|
||||
Icon(CupertinoIcons.chat_bubble_2_fill, color: Color(0xFF25D366), size: 20),
|
||||
Icon(CupertinoIcons.chat_bubble_2_fill,
|
||||
color: Color(0xFF25D366), size: 20),
|
||||
SizedBox(width: 8),
|
||||
Text(
|
||||
'تم إرسال الرمز عبر الواتساب بنجاح 📲',
|
||||
style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 13),
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 13),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 6),
|
||||
Text(
|
||||
'أدخل رمز التحقق المرسل إلى: ${_phoneController.text}',
|
||||
style: const TextStyle(color: TeacherTheme.emeraldLight, fontSize: 13, fontWeight: FontWeight.w700),
|
||||
style: const TextStyle(
|
||||
color: TeacherTheme.emeraldLight,
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w700),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
],
|
||||
@@ -381,7 +447,10 @@ class _TeacherAuthScreenState extends State<TeacherAuthScreen> {
|
||||
|
||||
const Text(
|
||||
'رمز التحقق المعتمد (OTP):',
|
||||
style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 13),
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 13),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
_buildOtpField(controller: _otpController),
|
||||
@@ -392,15 +461,23 @@ class _TeacherAuthScreenState extends State<TeacherAuthScreen> {
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: TeacherTheme.emeraldPrimary,
|
||||
foregroundColor: Colors.black,
|
||||
padding: const EdgeInsets.symmetric(vertical: 16),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(14)),
|
||||
padding:
|
||||
const EdgeInsets.symmetric(vertical: 16),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(14)),
|
||||
elevation: 0,
|
||||
),
|
||||
child: isLoading
|
||||
? const SizedBox(width: 20, height: 20, child: CircularProgressIndicator(color: Colors.black, strokeWidth: 2))
|
||||
? const SizedBox(
|
||||
width: 20,
|
||||
height: 20,
|
||||
child: CircularProgressIndicator(
|
||||
color: Colors.black, strokeWidth: 2))
|
||||
: const Text(
|
||||
'تأكيد الدخول لملف المعلم ✨',
|
||||
style: TextStyle(fontSize: 14, fontWeight: FontWeight.w900),
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w900),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 14),
|
||||
@@ -410,16 +487,31 @@ class _TeacherAuthScreenState extends State<TeacherAuthScreen> {
|
||||
children: [
|
||||
TextButton.icon(
|
||||
onPressed: isLoading ? null : _onSendOtp,
|
||||
icon: const Icon(CupertinoIcons.refresh_circled, size: 16, color: Color(0xFF25D366)),
|
||||
label: const Text('إعادة إرسال الرمز 📲', style: TextStyle(color: Color(0xFF25D366), fontSize: 12, fontWeight: FontWeight.bold)),
|
||||
icon: const Icon(
|
||||
CupertinoIcons.refresh_circled,
|
||||
size: 16,
|
||||
color: Color(0xFF25D366)),
|
||||
label: const Text('إعادة إرسال الرمز 📲',
|
||||
style: TextStyle(
|
||||
color: Color(0xFF25D366),
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.bold)),
|
||||
),
|
||||
TextButton.icon(
|
||||
onPressed: () {
|
||||
setState(() => _isEnteringOtp = false);
|
||||
context.read<TeacherAuthCubit>().resetToPhone();
|
||||
context
|
||||
.read<TeacherAuthCubit>()
|
||||
.resetToPhone();
|
||||
},
|
||||
icon: const Icon(CupertinoIcons.pencil_ellipsis_rectangle, size: 16, color: Color(0xFF94A3B8)),
|
||||
label: const Text('تعديل رقم الهاتف ✏️', style: TextStyle(color: Color(0xFF94A3B8), fontSize: 12)),
|
||||
icon: const Icon(
|
||||
CupertinoIcons.pencil_ellipsis_rectangle,
|
||||
size: 16,
|
||||
color: Color(0xFF94A3B8)),
|
||||
label: const Text('تعديل رقم الهاتف ✏️',
|
||||
style: TextStyle(
|
||||
color: Color(0xFF94A3B8),
|
||||
fontSize: 12)),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -452,13 +544,15 @@ class _TeacherAuthScreenState extends State<TeacherAuthScreen> {
|
||||
child: TextField(
|
||||
controller: controller,
|
||||
keyboardType: keyboardType,
|
||||
style: const TextStyle(color: Colors.white, fontSize: 13.5, fontWeight: FontWeight.w600),
|
||||
style: const TextStyle(
|
||||
color: Colors.white, fontSize: 13.5, fontWeight: FontWeight.w600),
|
||||
decoration: InputDecoration(
|
||||
prefixIcon: Icon(icon, color: TeacherTheme.emeraldPrimary, size: 18),
|
||||
hintText: hint,
|
||||
hintStyle: const TextStyle(color: Color(0xFF64748B), fontSize: 12.5),
|
||||
border: InputBorder.none,
|
||||
contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 14),
|
||||
contentPadding:
|
||||
const EdgeInsets.symmetric(horizontal: 16, vertical: 14),
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -471,7 +565,8 @@ class _TeacherAuthScreenState extends State<TeacherAuthScreen> {
|
||||
decoration: BoxDecoration(
|
||||
color: TeacherTheme.surfaceCard,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
border: Border.all(color: TeacherTheme.emeraldPrimary.withOpacity(0.6), width: 1.5),
|
||||
border: Border.all(
|
||||
color: TeacherTheme.emeraldPrimary.withOpacity(0.6), width: 1.5),
|
||||
boxShadow: const [
|
||||
BoxShadow(
|
||||
color: Color(0x2210B981),
|
||||
@@ -493,7 +588,8 @@ class _TeacherAuthScreenState extends State<TeacherAuthScreen> {
|
||||
),
|
||||
decoration: const InputDecoration(
|
||||
counterText: '',
|
||||
prefixIcon: Icon(CupertinoIcons.lock_shield_fill, color: TeacherTheme.emeraldPrimary, size: 22),
|
||||
prefixIcon: Icon(CupertinoIcons.lock_shield_fill,
|
||||
color: TeacherTheme.emeraldPrimary, size: 22),
|
||||
hintText: '• • • • • •',
|
||||
hintStyle: TextStyle(
|
||||
color: Color(0xFF475569),
|
||||
|
||||
Reference in New Issue
Block a user