159 lines
6.3 KiB
Dart
159 lines
6.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:get/get.dart';
|
|
import 'package:siro_admin/controller/auth/register_controller.dart';
|
|
|
|
class _C {
|
|
static const bg = Color(0xFF0A0D14);
|
|
static const card = Color(0xFF161D2E);
|
|
static const border = Color(0xFF1F2D4A);
|
|
static const accent = Color(0xFF00E5FF);
|
|
static const textPrimary = Color(0xFFE8F0FE);
|
|
static const textSec = Color(0xFF7A8BAA);
|
|
static const inputBg = Color(0xFF0C1120);
|
|
}
|
|
|
|
class AdminRegisterPage extends StatelessWidget {
|
|
const AdminRegisterPage({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final controller = Get.put(AdminRegisterController());
|
|
|
|
return Scaffold(
|
|
backgroundColor: _C.bg,
|
|
appBar: AppBar(
|
|
backgroundColor: Colors.transparent,
|
|
elevation: 0,
|
|
leading: IconButton(
|
|
icon: const Icon(Icons.arrow_back_ios, color: _C.textPrimary),
|
|
onPressed: () => Get.back(),
|
|
),
|
|
),
|
|
body: SafeArea(
|
|
child: Center(
|
|
child: SingleChildScrollView(
|
|
padding: const EdgeInsets.symmetric(horizontal: 28),
|
|
child: ConstrainedBox(
|
|
constraints: const BoxConstraints(maxWidth: 440),
|
|
child: Form(
|
|
key: controller.formKey,
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
const Icon(Icons.admin_panel_settings, size: 80, color: _C.accent),
|
|
const SizedBox(height: 24),
|
|
const Text(
|
|
'تسجيل مشرف جديد',
|
|
style: TextStyle(
|
|
color: _C.textPrimary,
|
|
fontSize: 26,
|
|
fontWeight: FontWeight.w800,
|
|
),
|
|
),
|
|
const SizedBox(height: 8),
|
|
const Text(
|
|
'أدخل بياناتك لتقديم طلب الإشراف',
|
|
style: TextStyle(color: _C.textSec, fontSize: 14),
|
|
),
|
|
const SizedBox(height: 40),
|
|
Container(
|
|
padding: const EdgeInsets.all(28),
|
|
decoration: BoxDecoration(
|
|
color: _C.card,
|
|
borderRadius: BorderRadius.circular(24),
|
|
border: Border.all(color: _C.accent.withOpacity(0.18), width: 1.2),
|
|
),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
children: [
|
|
_buildLabel('الاسم الكامل', Icons.person),
|
|
const SizedBox(height: 10),
|
|
_buildTextField(
|
|
controller: controller.nameCtrl,
|
|
hint: 'أحمد محمود',
|
|
icon: Icons.person_outline,
|
|
),
|
|
const SizedBox(height: 20),
|
|
_buildLabel('رقم الهاتف', Icons.phone_android),
|
|
const SizedBox(height: 10),
|
|
_buildTextField(
|
|
controller: controller.phoneCtrl,
|
|
hint: '07XXXXXXXX',
|
|
keyboardType: TextInputType.phone,
|
|
icon: Icons.phone_outlined,
|
|
),
|
|
const SizedBox(height: 20),
|
|
_buildLabel('كلمة المرور', Icons.lock_outline),
|
|
const SizedBox(height: 10),
|
|
_buildTextField(
|
|
controller: controller.passCtrl,
|
|
hint: '••••••••',
|
|
obscureText: true,
|
|
icon: Icons.lock_outline,
|
|
),
|
|
const SizedBox(height: 40),
|
|
Obx(() => MaterialButton(
|
|
onPressed: controller.isLoading.value ? null : () => controller.register(),
|
|
color: _C.accent,
|
|
height: 55,
|
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)),
|
|
child: controller.isLoading.value
|
|
? const CircularProgressIndicator(color: _C.bg)
|
|
: const Text(
|
|
'تقديم الطلب',
|
|
style: TextStyle(color: _C.bg, fontSize: 18, fontWeight: FontWeight.bold),
|
|
),
|
|
)),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget _buildLabel(String text, IconData icon) {
|
|
return Row(
|
|
children: [
|
|
Icon(icon, color: _C.accent, size: 16),
|
|
const SizedBox(width: 8),
|
|
Text(
|
|
text,
|
|
style: const TextStyle(color: _C.textSec, fontSize: 13, fontWeight: FontWeight.w600),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
|
|
Widget _buildTextField({
|
|
required TextEditingController controller,
|
|
required String hint,
|
|
required IconData icon,
|
|
bool obscureText = false,
|
|
TextInputType keyboardType = TextInputType.text,
|
|
}) {
|
|
return TextFormField(
|
|
controller: controller,
|
|
obscureText: obscureText,
|
|
keyboardType: keyboardType,
|
|
style: const TextStyle(color: _C.textPrimary, fontSize: 16),
|
|
decoration: InputDecoration(
|
|
hintText: hint,
|
|
hintStyle: const TextStyle(color: _C.textSec),
|
|
filled: true,
|
|
fillColor: _C.inputBg,
|
|
prefixIcon: Icon(icon, color: _C.textSec),
|
|
border: OutlineInputBorder(borderRadius: BorderRadius.circular(14), borderSide: BorderSide.none),
|
|
focusedBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(14), borderSide: const BorderSide(color: _C.accent, width: 1.5)),
|
|
contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 16),
|
|
),
|
|
validator: (val) => (val == null || val.isEmpty) ? 'هذا الحقل مطلوب' : null,
|
|
);
|
|
}
|
|
}
|