Update Saqel Platform: 2026-09-08 13:43:36
This commit is contained in:
@@ -79,7 +79,14 @@ class _TeacherAuthScreenState extends State<TeacherAuthScreen> {
|
||||
SaqelToast.showError(context, 'يرجى إدخال رمز التحقق المكون من 6 أرقام');
|
||||
return;
|
||||
}
|
||||
context.read<TeacherAuthCubit>().verifyOtp(phone, otp, fullName: _fullNameController.text.trim());
|
||||
context.read<TeacherAuthCubit>().verifyOtp(
|
||||
phone,
|
||||
otp,
|
||||
fullName: _fullNameController.text.trim(),
|
||||
specialization: _selectedSubject,
|
||||
schoolName: _schoolController.text.trim(),
|
||||
gradesTaught: _selectedGrades.toList(),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -109,6 +116,7 @@ class _TeacherAuthScreenState extends State<TeacherAuthScreen> {
|
||||
},
|
||||
builder: (context, state) {
|
||||
final isLoading = state is TeacherAuthLoading;
|
||||
final isOtpStep = _isEnteringOtp || state is TeacherAuthOtpSent;
|
||||
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(28),
|
||||
@@ -217,7 +225,7 @@ class _TeacherAuthScreenState extends State<TeacherAuthScreen> {
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
|
||||
if (!_isEnteringOtp) ...[
|
||||
if (!isOtpStep) ...[
|
||||
// Step 1: Teacher Info & Phone
|
||||
const Text(
|
||||
'اسم المعلم المعتمد:',
|
||||
@@ -338,20 +346,46 @@ class _TeacherAuthScreenState extends State<TeacherAuthScreen> {
|
||||
),
|
||||
),
|
||||
] else ...[
|
||||
// Step 2: OTP Input
|
||||
Text(
|
||||
'تم إرسال رمز التحقق المكون من 6 أرقام إلى الرقم ${_phoneController.text}',
|
||||
style: const TextStyle(color: Colors.white70, fontSize: 13),
|
||||
textAlign: TextAlign.center,
|
||||
// Step 2: OTP Input (WhatsApp Gateway)
|
||||
Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFF0C241D),
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
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),
|
||||
SizedBox(width: 8),
|
||||
Text(
|
||||
'تم إرسال الرمز عبر الواتساب بنجاح 📲',
|
||||
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),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
_buildTextField(
|
||||
controller: _otpController,
|
||||
hint: 'أدخل رمز الـ OTP (مثال: 123456)',
|
||||
icon: CupertinoIcons.lock_shield_fill,
|
||||
keyboardType: TextInputType.number,
|
||||
const SizedBox(height: 22),
|
||||
|
||||
const Text(
|
||||
'رمز التحقق المعتمد (OTP):',
|
||||
style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 13),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
_buildOtpField(controller: _otpController),
|
||||
const SizedBox(height: 20),
|
||||
|
||||
ElevatedButton(
|
||||
onPressed: isLoading ? null : _onVerifyOtp,
|
||||
style: ElevatedButton.styleFrom(
|
||||
@@ -359,6 +393,7 @@ class _TeacherAuthScreenState extends State<TeacherAuthScreen> {
|
||||
foregroundColor: Colors.black,
|
||||
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))
|
||||
@@ -367,10 +402,25 @@ class _TeacherAuthScreenState extends State<TeacherAuthScreen> {
|
||||
style: TextStyle(fontSize: 14, fontWeight: FontWeight.w900),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
TextButton(
|
||||
onPressed: () => setState(() => _isEnteringOtp = false),
|
||||
child: const Text('تعديل رقم الهاتف والبيانات', style: TextStyle(color: TeacherTheme.emeraldLight)),
|
||||
const SizedBox(height: 14),
|
||||
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
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)),
|
||||
),
|
||||
TextButton.icon(
|
||||
onPressed: () {
|
||||
setState(() => _isEnteringOtp = false);
|
||||
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)),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
],
|
||||
@@ -412,4 +462,47 @@ class _TeacherAuthScreenState extends State<TeacherAuthScreen> {
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildOtpField({
|
||||
required TextEditingController controller,
|
||||
}) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: TeacherTheme.surfaceCard,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
border: Border.all(color: TeacherTheme.emeraldPrimary.withOpacity(0.6), width: 1.5),
|
||||
boxShadow: const [
|
||||
BoxShadow(
|
||||
color: Color(0x2210B981),
|
||||
blurRadius: 16,
|
||||
offset: Offset(0, 4),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: TextField(
|
||||
controller: controller,
|
||||
keyboardType: TextInputType.number,
|
||||
textAlign: TextAlign.center,
|
||||
maxLength: 6,
|
||||
style: const TextStyle(
|
||||
color: TeacherTheme.emeraldLight,
|
||||
fontSize: 24,
|
||||
fontWeight: FontWeight.w900,
|
||||
letterSpacing: 10,
|
||||
),
|
||||
decoration: const InputDecoration(
|
||||
counterText: '',
|
||||
prefixIcon: Icon(CupertinoIcons.lock_shield_fill, color: TeacherTheme.emeraldPrimary, size: 22),
|
||||
hintText: '• • • • • •',
|
||||
hintStyle: TextStyle(
|
||||
color: Color(0xFF475569),
|
||||
fontSize: 20,
|
||||
letterSpacing: 6,
|
||||
),
|
||||
border: InputBorder.none,
|
||||
contentPadding: EdgeInsets.symmetric(horizontal: 16, vertical: 16),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user